Skip to content

chore(storybook): borrower profile storybook baseline AD-267#6997

Merged
emuvente merged 7 commits into
mainfrom
chore/borrower-profile-storybook-baseline
Jun 17, 2026
Merged

chore(storybook): borrower profile storybook baseline AD-267#6997
emuvente merged 7 commits into
mainfrom
chore/borrower-profile-storybook-baseline

Conversation

@emuvente

Copy link
Copy Markdown
Collaborator

Adding stories for Borrower Profile components before the migration work lands.

Copilot summary:
This pull request adds comprehensive Storybook stories for all major components of the Borrower Profile feature, ensuring each component can be visually tested in isolation with realistic data scenarios. It also improves Storybook's Vue router handling to prevent navigation issues within the Storybook iframe and enhances the Apollo mock mixin for better compatibility with stories that use variable changes.

The most important changes are:

Storybook stories for Borrower Profile components:

  • Added new Storybook stories for the following components, each with realistic mock data and multiple scenarios: BorrowerCountry, BorrowerSideSheetContent, BorrowerSideSheetWrapper, CommentsAndWhySpecial, CountryInfo, DescriptionListItem, DetailsTabs, FieldPartnerDetails, JournalUpdates, LendCta, LendersAndTeams, and LoanDetails. These stories cover various states and edge cases for each component. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Improvements to Storybook router setup:

  • Changed the Vue router in Storybook from createWebHistory to createMemoryHistory and added a catch-all route to prevent navigation from breaking Storybook's iframe when components use $router.push() or similar methods. [1] [2]

Enhancements to Apollo mock mixin:

  • Added a stub implementation of setVariables() to the Apollo Storybook mixin to improve compatibility with components that interact with Apollo queries using variables.

emuvente added 3 commits June 16, 2026 14:42
Add a no-op setVariables() to the mocked watchQuery so components that
re-issue queries don't throw, and switch the preview router to memory
history with a catch-all route so route-dependent stories don't navigate
the iframe away or fail to match.
Add standalone Storybook stories for the existing borrower-profile
components (LoanProgress, SummaryCard, DetailsTabs, CountryInfo, LendCta,
LoanStory, LoanDetails, FieldPartnerDetails, TrusteeDetails, and others),
backed by shared mockLoanFixtures, plus Empty and CurrentUserHighlighted
variants for SupportedByLenders. Stories render against the components as
they exist on main.
@emuvente emuvente force-pushed the chore/borrower-profile-storybook-baseline branch from 18e52a9 to ceb2f55 Compare June 16, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Storybook “baseline” set of stories for Borrower Profile components (plus shared mock fixtures) to support upcoming migration work, and tweaks Storybook’s app-level setup to behave better with in-story navigation and Apollo usage.

Changes:

  • Added many new Storybook stories under Components/BorrowerProfile/* backed by a shared mockLoanFixtures.js.
  • Updated Storybook’s Vue Router setup to use in-memory history and added a catch-all route.
  • Extended the Apollo Storybook mixin’s watchQuery() mock to include setVariables().

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
.storybook/stories/SupportedByLenders.stories.js Adds additional scenarios for SupportedByLenders story.
.storybook/stories/BorrowerProfile/TrusteeDetails.stories.js New BorrowerProfile TrusteeDetails stories.
.storybook/stories/BorrowerProfile/SummaryCard.stories.js New SummaryCard stories using shared Apollo/cookie/auth mixins.
.storybook/stories/BorrowerProfile/ShareButton.stories.js New ShareButton story using shared fixtures/mixins.
.storybook/stories/BorrowerProfile/RepaymentSchedule.stories.js New RepaymentSchedule story.
.storybook/stories/BorrowerProfile/MoreAboutLoan.stories.js New MoreAboutLoan stories (partner/direct/loading).
.storybook/stories/BorrowerProfile/mockLoanFixtures.js Shared mock loan/user/queryResult fixtures for BorrowerProfile stories.
.storybook/stories/BorrowerProfile/LoanStory.stories.js New LoanStory stories (single/group/repeat borrower variants).
.storybook/stories/BorrowerProfile/LoanProgress.stories.js New LoanProgress stories covering many statuses.
.storybook/stories/BorrowerProfile/LoanDetails.stories.js New LoanDetails stories for partner/direct and date variants.
.storybook/stories/BorrowerProfile/LendersAndTeams.stories.js New LendersAndTeams stories (lenders/teams/empty).
.storybook/stories/BorrowerProfile/LendCta.stories.js New LendCta stories for fundraising/funded/post-fundraising.
.storybook/stories/BorrowerProfile/JournalUpdates.stories.js New JournalUpdates stories (default/none).
.storybook/stories/BorrowerProfile/FieldPartnerDetails.stories.js New FieldPartnerDetails stories/variants.
.storybook/stories/BorrowerProfile/DetailsTabs.stories.js New DetailsTabs stories for partner/direct loan scenarios.
.storybook/stories/BorrowerProfile/DescriptionListItem.stories.js New DescriptionListItem stories.
.storybook/stories/BorrowerProfile/CountryInfo.stories.js New CountryInfo story using fixtures/mixins.
.storybook/stories/BorrowerProfile/CommentsAndWhySpecial.stories.js New CommentsAndWhySpecial stories (admin/subscribed variants).
.storybook/stories/BorrowerProfile/BorrowerSideSheetWrapper.stories.js New side sheet wrapper stories (open/closed).
.storybook/stories/BorrowerProfile/BorrowerSideSheetContent.stories.js New side sheet content story.
.storybook/stories/BorrowerProfile/BorrowerCountry.stories.js New BorrowerCountry stories (geocode fallback/loading).
.storybook/preview.js Switches Storybook router to createMemoryHistory() and adds route handling.
.storybook/mixins/apollo-story-mixin.js Adds setVariables() stub on mocked watchQuery() observable.

Comment thread .storybook/stories/BorrowerProfile/BorrowerCountry.stories.js
Comment thread .storybook/stories/BorrowerProfile/MoreAboutLoan.stories.js
Comment thread .storybook/stories/BorrowerProfile/mockLoanFixtures.js Outdated
Comment thread .storybook/preview.js
Comment thread .storybook/stories/BorrowerProfile/SummaryCard.stories.js Outdated
Comment thread .storybook/stories/BorrowerProfile/SummaryCard.stories.js Outdated
Comment thread .storybook/stories/BorrowerProfile/FieldPartnerDetails.stories.js
emuvente added 4 commits June 16, 2026 17:36
BorrowerCountry and MoreAboutLoan Loading stories passed a Promise as
queryResult, which apolloStoryMixin ignores; without loading:true the
mocked query resolved immediately and no loading state rendered. Use
loading:true with createQueryResult(), matching the SummaryCard pattern.

AD-267
…ants

The LessThanOneYear and MissingOptionalFields variants only toggled
fields the component does not accept as props (startDate, loansPosted,
totalAmountRaised, avgLoanSizePercentPerCapitaIncome), so they rendered
identically to AllMetrics. Replace them with NoAverageCost (avgBorrowerCost
0 -> "N/A") and HighRiskRating, which drive props the component renders.

AD-267
createMockLoan derived plannedExpirationDate from new Date(), making the
fixture (and any rendered time/repayment text) drift day to day. Pin it to
a fixed ISO date so story output is deterministic for visual regression.

AD-267
SummaryCard declares no props; it derives loanId from the route and fetches
the loan via Apollo. The :loan binding and its setup() were dead, so remove
them to keep the stories aligned with the component's API.

AD-267
@emuvente emuvente force-pushed the chore/borrower-profile-storybook-baseline branch from dec2891 to 043ccad Compare June 17, 2026 00:38
@emuvente emuvente merged commit e8f9d05 into main Jun 17, 2026
5 checks passed
@emuvente emuvente deleted the chore/borrower-profile-storybook-baseline branch June 17, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants