Skip to content

Commit 35b00e4

Browse files
committed
✨ Update settings route to use new UserSettings components
1 parent 5f357f2 commit 35b00e4

File tree

1 file changed

+7
-37
lines changed

1 file changed

+7
-37
lines changed
Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
import { createFileRoute } from "@tanstack/react-router"
22

3-
import ChangePassword from "@/components/UserSettings/ChangePassword"
4-
import DeleteAccount from "@/components/UserSettings/DeleteAccount"
5-
import UserInformation from "@/components/UserSettings/UserInformation"
6-
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
3+
import { ProfileContent } from "@/components/UserSettings/ProfileContent"
4+
import { ProfileHeader } from "@/components/UserSettings/ProfileHeader"
75
import useAuth from "@/hooks/useAuth"
86

9-
const tabsConfig = [
10-
{ value: "my-profile", title: "My profile", component: UserInformation },
11-
{ value: "password", title: "Password", component: ChangePassword },
12-
{ value: "danger-zone", title: "Danger zone", component: DeleteAccount },
13-
]
14-
157
export const Route = createFileRoute("/_layout/settings")({
168
component: UserSettings,
179
head: () => ({
@@ -24,38 +16,16 @@ export const Route = createFileRoute("/_layout/settings")({
2416
})
2517

2618
function UserSettings() {
27-
const { user: currentUser } = useAuth()
28-
const finalTabs = currentUser?.is_superuser
29-
? tabsConfig.slice(0, 3)
30-
: tabsConfig
19+
const { user } = useAuth()
3120

32-
if (!currentUser) {
21+
if (!user) {
3322
return null
3423
}
3524

3625
return (
37-
<div className="flex flex-col gap-6">
38-
<div>
39-
<h1 className="text-2xl font-bold tracking-tight">User Settings</h1>
40-
<p className="text-muted-foreground">
41-
Manage your account settings and preferences
42-
</p>
43-
</div>
44-
45-
<Tabs defaultValue="my-profile">
46-
<TabsList>
47-
{finalTabs.map((tab) => (
48-
<TabsTrigger key={tab.value} value={tab.value}>
49-
{tab.title}
50-
</TabsTrigger>
51-
))}
52-
</TabsList>
53-
{finalTabs.map((tab) => (
54-
<TabsContent key={tab.value} value={tab.value}>
55-
<tab.component />
56-
</TabsContent>
57-
))}
58-
</Tabs>
26+
<div className="mx-auto w-full max-w-4xl flex flex-col gap-6 px-4 py-6 sm:px-6">
27+
<ProfileHeader />
28+
<ProfileContent />
5929
</div>
6030
)
6131
}

0 commit comments

Comments
 (0)