-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(dashboard): Clerk based settings page #7202
base: next
Are you sure you want to change the base?
Changes from 5 commits
4a4bf00
e462996
0ab6a0a
7daa076
aef9c43
abcce8b
465fa4e
0a8d6d6
bf051dc
93d5957
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import { Card } from '@/components/primitives/card'; | ||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/primitives/tabs'; | ||
import { OrganizationProfile, UserProfile } from '@clerk/clerk-react'; | ||
import { useOrganization } from '@clerk/clerk-react'; | ||
import { DashboardLayout } from '../components/dashboard-layout'; | ||
import { useNavigate, useLocation } from 'react-router-dom'; | ||
import { ROUTES } from '@/utils/routes'; | ||
|
||
export const clerkComponentAppearance = { | ||
elements: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please update the primary font color (black) to match the Dashboard primary font color |
||
navbar: { display: 'none' }, | ||
navbarMobileMenuRow: { display: 'none !important' }, | ||
rootBox: { | ||
width: '100%', | ||
height: '100%', | ||
}, | ||
cardBox: { | ||
display: 'block', | ||
width: '100%', | ||
height: '100%', | ||
boxShadow: 'none', | ||
}, | ||
|
||
pageScrollBox: { | ||
padding: '0 !important', | ||
}, | ||
header: { | ||
display: 'none', | ||
}, | ||
profileSection: { | ||
borderTop: 'none', | ||
borderBottom: '1px solid #e0e0e0', | ||
}, | ||
page: { | ||
padding: '0 5px', | ||
}, | ||
}, | ||
}; | ||
|
||
export function SettingsPage() { | ||
const navigate = useNavigate(); | ||
const location = useLocation(); | ||
|
||
const currentTab = | ||
location.pathname === ROUTES.SETTINGS ? 'account' : location.pathname.split('/settings/')[1] || 'account'; | ||
|
||
const handleTabChange = (value: string) => { | ||
switch (value) { | ||
case 'account': | ||
navigate(ROUTES.SETTINGS_ACCOUNT); | ||
break; | ||
case 'organization': | ||
navigate(ROUTES.SETTINGS_ORGANIZATION); | ||
break; | ||
case 'team': | ||
navigate(ROUTES.SETTINGS_TEAM); | ||
break; | ||
} | ||
}; | ||
|
||
return ( | ||
<DashboardLayout headerStartItems={<h1 className="text-foreground-950">Settings</h1>}> | ||
<Tabs value={currentTab} onValueChange={handleTabChange} className="w-full"> | ||
<TabsList | ||
align="center" | ||
className="border-border/20 relative mt-4 flex w-full items-end justify-start space-x-2 rounded-none border-b bg-transparent px-1.5 pb-0" | ||
SokratisVidros marked this conversation as resolved.
Show resolved
Hide resolved
|
||
> | ||
<TabsTrigger | ||
value="account" | ||
className="text-muted-foreground hover:text-foreground data-[state=active]:border-primary data-[state=active]:text-foreground flex items-center rounded-none border-b-2 border-transparent px-4 py-2.5 font-medium transition-all" | ||
> | ||
Account | ||
</TabsTrigger> | ||
<TabsTrigger | ||
value="organization" | ||
className="text-muted-foreground hover:text-foreground data-[state=active]:border-primary data-[state=active]:text-foreground flex items-center rounded-none border-b-2 border-transparent px-4 py-2.5 font-medium transition-all" | ||
> | ||
Organization | ||
</TabsTrigger> | ||
<TabsTrigger | ||
value="team" | ||
className="text-muted-foreground hover:text-foreground data-[state=active]:border-primary data-[state=active]:text-foreground flex items-center rounded-none border-b-2 border-transparent px-4 py-2.5 font-medium transition-all" | ||
> | ||
Team | ||
</TabsTrigger> | ||
</TabsList> | ||
|
||
<div className="mx-auto mt-1 max-w-[700px] px-1.5"> | ||
<TabsContent value="account" className="rounded-lg"> | ||
<Card className="mx-auto mt-10 border-none shadow-none"> | ||
<UserProfile appearance={clerkComponentAppearance}> | ||
<UserProfile.Page label="account" /> | ||
<UserProfile.Page label="security" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For posterity: This issue has been reported to Clerk. |
||
</UserProfile> | ||
|
||
<h1 className="text-foreground mb-6 mt-10 text-xl font-semibold">Security</h1> | ||
<UserProfile appearance={clerkComponentAppearance}> | ||
<UserProfile.Page label="security" /> | ||
<UserProfile.Page label="account" /> | ||
</UserProfile> | ||
</Card> | ||
</TabsContent> | ||
|
||
<TabsContent value="organization" className="rounded-lg"> | ||
<Card className="border-none shadow-none"> | ||
<OrganizationProfile appearance={clerkComponentAppearance}> | ||
<OrganizationProfile.Page label="general" /> | ||
<OrganizationProfile.Page label="members" /> | ||
</OrganizationProfile> | ||
</Card> | ||
</TabsContent> | ||
|
||
<TabsContent value="team" className="rounded-lg"> | ||
<Card className="border-none shadow-none"> | ||
<OrganizationProfile appearance={clerkComponentAppearance}> | ||
<OrganizationProfile.Page label="members" /> | ||
<OrganizationProfile.Page label="general" /> | ||
</OrganizationProfile> | ||
</Card> | ||
</TabsContent> | ||
</div> | ||
</Tabs> | ||
</DashboardLayout> | ||
); | ||
} |
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.
Added control on tabs alignment