-
Notifications
You must be signed in to change notification settings - Fork 295
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(clerk-js): Support open userProfile and organizationProfile modals to specific navitems #3732
feat(clerk-js): Support open userProfile and organizationProfile modals to specific navitems #3732
Conversation
🦋 Changeset detectedLatest commit: e92ffe0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…dal on specific page
e5a8015
to
5953bb2
Compare
packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx
Outdated
Show resolved
Hide resolved
packages/clerk-js/src/ui/components/UserButton/useMultisessionActions.tsx
Outdated
Show resolved
Hide resolved
const to = '/' + router.basePath + router.flowStartPath; | ||
const to = router.indexPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you briefly, our discoveries and why this is a "safe" change ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the current modal setup, the first element is associated with the '/' path. Previously, clicking the back button in the modal's sidebar navigation would navigate back to the path constructed by '/' + router.basePath + router.flowStartPath, since the modal always opened with the first element selected.
Now, with the ability to open the modal on a specific element, the router.flowStartPath is not necessarily the path for the first element anymore. That's why we should now navigate to router.indexPath instead of the previously used router.flowStartPath.
@EmmanouelaPothitou can we have an example code snippet of how this will be used by the users? |
@anagstef This function will not be used directly by the user. Instead, it will be utilized by custom menu items, which will be introduced in another PR that Nikos will open in the next days. Therefore, I do not have an example code snippet at this time. |
packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx
Outdated
Show resolved
Hide resolved
} | ||
openUserProfile({ | ||
...opts.userProfileProps, | ||
...(__experimental_startPath && { __experimental_startPath }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓Shouldn't we update the types of UserProfileModalProps and OrgProfileModalProps to include __experimental_startPath
?
…izationSwitcherPopover.tsx Co-authored-by: panteliselef <[email protected]>
Co-authored-by: panteliselef <[email protected]>
Co-authored-by: panteliselef <[email protected]>
f3b0b4c
to
a642fce
Compare
packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx
Show resolved
Hide resolved
packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx
Show resolved
Hide resolved
@@ -128,7 +128,7 @@ export const mountComponentRenderer = (clerk: Clerk, environment: EnvironmentRes | |||
void preloadComponent(preloadHint); | |||
} | |||
componentsControlsResolver = import('./lazyModules/common').then(({ createRoot }) => { | |||
createRoot(clerkRoot!).render( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this changed by mistake from the linter or it's a conscious change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linter changed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should revert it then
!preview |
Hey @octoper, your preview is available.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 Good job @EmmanouelaPothitou!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Co-authored-by: Vaggelis Yfantis <[email protected]>
Co-authored-by: Stefanos Anagnostou <[email protected]>
…ls to specific navitems (#3732) Co-authored-by: panteliselef <[email protected]> Co-authored-by: Vaggelis Yfantis <[email protected]> Co-authored-by: Stefanos Anagnostou <[email protected]>
Description
Support opening the userProfileModal and organizationProfileModal to specific navigation items through the userButton and organizationSwitcher.
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change