The submodule collapse was only half applied: .gitmodules was deleted but backend/ and frontend/ were still recorded as gitlinks, so none of their files were tracked. Replace the gitlinks with the real trees. Also untrack .env (it carried placeholder secrets) in favour of a tracked .env.example, drop the committed __pycache__, and narrow the blanket *.png ignore that would have swallowed design assets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
import { createFileRoute } from "@tanstack/react-router"
|
|
|
|
import ChangePassword from "@/components/UserSettings/ChangePassword"
|
|
import DeleteAccount from "@/components/UserSettings/DeleteAccount"
|
|
import UserInformation from "@/components/UserSettings/UserInformation"
|
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
|
|
import useAuth from "@/hooks/useAuth"
|
|
|
|
const tabsConfig = [
|
|
{ value: "my-profile", title: "My profile", component: UserInformation },
|
|
{ value: "password", title: "Password", component: ChangePassword },
|
|
{ value: "danger-zone", title: "Danger zone", component: DeleteAccount },
|
|
]
|
|
|
|
export const Route = createFileRoute("/_layout/settings")({
|
|
component: UserSettings,
|
|
head: () => ({
|
|
meta: [
|
|
{
|
|
title: "Settings - FastAPI Cloud",
|
|
},
|
|
],
|
|
}),
|
|
})
|
|
|
|
function UserSettings() {
|
|
const { user: currentUser } = useAuth()
|
|
const finalTabs = currentUser?.is_superuser
|
|
? tabsConfig.slice(0, 3)
|
|
: tabsConfig
|
|
|
|
if (!currentUser) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<div className="flex flex-col gap-6">
|
|
<div>
|
|
<h1 className="text-2xl font-bold tracking-tight">User Settings</h1>
|
|
<p className="text-muted-foreground">
|
|
Manage your account settings and preferences
|
|
</p>
|
|
</div>
|
|
|
|
<Tabs defaultValue="my-profile">
|
|
<TabsList>
|
|
{finalTabs.map((tab) => (
|
|
<TabsTrigger key={tab.value} value={tab.value}>
|
|
{tab.title}
|
|
</TabsTrigger>
|
|
))}
|
|
</TabsList>
|
|
{finalTabs.map((tab) => (
|
|
<TabsContent key={tab.value} value={tab.value}>
|
|
<tab.component />
|
|
</TabsContent>
|
|
))}
|
|
</Tabs>
|
|
</div>
|
|
)
|
|
}
|