Repository navigation
feat(ui): confirm connected account row actions #9753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6fe9ce9
feat(ui): add connected account row actions and removal dialog
austincalvelage 5384e33
docs(swingset): add interactive connected account examples
austincalvelage bda4612
fix(ui): frame connected account provider icons
austincalvelage 91587d3
refactor(ui): share connected and available account row layout
austincalvelage 0c24e13
refactor(ui): inline connected provider icon in account row
austincalvelage 286b484
fix(ui): hide connected account section without available actions
austincalvelage d5e4813
fix(ui): mark connected account logos as decorative
austincalvelage 4507388
fix(ui): hide empty connected accounts section
austincalvelage 0c654fa
test(ui): trim duplicate connected account callback checks
austincalvelage 366fb80
fix(ui): template connected account action labels
austincalvelage 56181f9
fix(ui): update connected account imports after feature move
austincalvelage b59de4f
Merge branch 'main' into austin/connected-accounts-actions
austincalvelage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/swingset/src/stories/fixtures/user-profile-connected-accounts.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import type { | ||
| UserProfileConnectedAccount, | ||
| UserProfileConnectionProvider, | ||
| } from '@clerk/ui/mosaic/features/user-profile/user-profile-connected-accounts-section.view'; | ||
| import { useState } from 'react'; | ||
|
|
||
| export const connectedAccount = { | ||
| id: 'google', | ||
| provider: 'Google', | ||
| identifier: 'test@example.com', | ||
| iconUrl: 'https://img.clerk.com/static/google.svg', | ||
| }; | ||
| const connectionProviders: UserProfileConnectionProvider[] = [ | ||
| { id: 'google', provider: 'Google', iconUrl: 'https://img.clerk.com/static/google.svg' }, | ||
| { id: 'apple', provider: 'Apple', iconUrl: 'https://img.clerk.com/static/apple.svg' }, | ||
| ]; | ||
|
|
||
| export function useConnectedAccountsFixture({ | ||
| initialAccounts = [connectedAccount], | ||
| providers = connectionProviders, | ||
| removalState, | ||
| }: { | ||
| initialAccounts?: UserProfileConnectedAccount[]; | ||
| providers?: UserProfileConnectionProvider[]; | ||
| removalState?: 'pending' | 'error'; | ||
| } = {}) { | ||
| const [accounts, setAccounts] = useState(initialAccounts); | ||
| const availableProviders = providers.filter(provider => !accounts.some(account => account.id === provider.id)); | ||
|
|
||
| return { | ||
| accounts, | ||
| availableProviders, | ||
| onConnect: (id: string) => { | ||
| const provider = providers.find(item => item.id === id); | ||
| if (provider) { | ||
| setAccounts(current => [ | ||
| ...current, | ||
| { id: provider.id, provider: provider.provider, iconUrl: provider.iconUrl, identifier: 'test@example.com' }, | ||
| ]); | ||
| } | ||
| }, | ||
| onReconnect: (id: string) => | ||
| setAccounts(current => | ||
| current.map(account => | ||
| account.id === id | ||
| ? { ...account, status: 'connected', reconnectError: undefined, verificationError: undefined } | ||
| : account, | ||
| ), | ||
| ), | ||
| onRemove: (id: string) => | ||
| setAccounts(current => { | ||
| const account = current.find(item => item.id === id); | ||
| if (removalState === 'pending') { | ||
| return current.map(item => (item.id === id ? { ...item, isRemoving: true } : item)); | ||
| } | ||
| if (removalState === 'error' && account && !account.removalError) { | ||
| return current.map(item => | ||
| item.id === id ? { ...item, removalError: 'Unable to remove this account. Please try again.' } : item, | ||
| ); | ||
| } | ||
| return current.filter(item => item.id !== id); | ||
| }), | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.