Skip to content

Commit 1ab419f

Browse files
maxyingerclaude
andcommitted
feat(ui): rough in the user-profile account section flow
Adds the view layer for every action on the account section that opens a dialog: adding and verifying an email address or phone number, removing one, promoting one to primary, and editing the name, username and profile picture. That is the whole of `UserProfileAccountSection`, which is what the flow is named for — the intent is one flow per section, each named after the section component it drives. The views are pure. Each branches on a snapshot and sends events back, holding no flow state of its own, so the layer that decides when a step changes can be swapped without touching them. Today that layer is a simulated backend in swingset, with configurable latency, injected failures and a reverification gate; later it is a state machine and its Clerk controller. Every delay in the harness maps to an invoke, every branch to a guard. Legacy `packages/ui/src/components/UserProfile` is the spec. All three email verification strategies are covered, since the instance picks between them rather than the user: a code, an email link with its own waiting screen and throttled resend, and enterprise SSO. Set-as-primary gains a confirmation it does not have today, where its pending and failed states can live. The dialog chrome, the reverification challenge and the shared flow types sit apart from the account-specific dialogs, since the next section's flow will reuse them. Inputs Mosaic does not have yet — the code field, the country picker, the file picker, the unattributed-error banner, and the dialog header/body/footer — are hand-rolled and marked with TODOs naming their replacements. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent ea8cb05 commit 1ab419f

16 files changed

Lines changed: 4268 additions & 0 deletions
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/swingset/src/components/DocsViewer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const docModules: Record<string, Record<string, React.ComponentType>> = {
1515
},
1616
'user-profile': {
1717
'user-page': dynamic(() => import('../stories/user-page.mdx')),
18+
'user-profile-account-section-flow': dynamic(() => import('../stories/user-profile-account-section-flow.mdx')),
1819
'user-profile-profile-panel': dynamic(() => import('../stories/user-profile-profile-panel.mdx')),
1920
'user-profile-security-panel': dynamic(() => import('../stories/user-profile-security-panel.mdx')),
2021
'user-profile-billing-panel': dynamic(() => import('../stories/user-profile-billing-panel.mdx')),

packages/swingset/src/lib/registry.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ import {
107107
meta as userProfileAccountSectionMeta,
108108
MultipleAccounts as UserProfileAccountSectionMultipleAccounts,
109109
} from '../stories/user-profile-account-section.stories';
110+
import {
111+
Default as UserProfileAccountSectionFlowDefault,
112+
meta as userProfileAccountSectionFlowMeta,
113+
ProfileStates as UserProfileAccountSectionFlowProfileStates,
114+
States as UserProfileAccountSectionFlowStates,
115+
} from '../stories/user-profile-account-section-flow.stories';
110116
import {
111117
Default as UserProfileActiveDevicesSectionDefault,
112118
meta as userProfileActiveDevicesSectionMeta,
@@ -291,6 +297,12 @@ const userPageModule: StoryModule = {
291297
meta: userPageMeta,
292298
Default: UserPageDefault,
293299
};
300+
const userProfileAccountSectionFlowModule: StoryModule = {
301+
meta: userProfileAccountSectionFlowMeta,
302+
Default: UserProfileAccountSectionFlowDefault,
303+
States: UserProfileAccountSectionFlowStates,
304+
ProfileStates: UserProfileAccountSectionFlowProfileStates,
305+
};
294306

295307
const userProfileAccountSectionModule: StoryModule = {
296308
meta: userProfileAccountSectionMeta,
@@ -359,6 +371,7 @@ export const registry: StoryModule[] = [
359371
userButtonModule,
360372
// User Profile
361373
userPageModule,
374+
userProfileAccountSectionFlowModule,
362375
// User Profile · Panels
363376
userProfileProfilePanelModule,
364377
userProfileSecurityPanelModule,

0 commit comments

Comments
 (0)