|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import dynamic from "next/dynamic"; |
| 4 | +import Link from "next/link"; |
| 5 | +import { WorkspaceSettingsForm } from "@/components/workspace-settings-form"; |
| 6 | +import { Separator } from "@/components/ui/separator"; |
| 7 | +import type { Workspace } from "@/lib/types"; |
| 8 | + |
| 9 | +const ChangePasswordSection = dynamic( |
| 10 | + () => |
| 11 | + import("@/components/change-password-section").then( |
| 12 | + (mod) => mod.ChangePasswordSection, |
| 13 | + ), |
| 14 | +); |
| 15 | + |
| 16 | +const DangerZoneSettings = dynamic( |
| 17 | + () => |
| 18 | + import("@/components/danger-zone-settings").then( |
| 19 | + (mod) => mod.DangerZoneSettings, |
| 20 | + ), |
| 21 | +); |
| 22 | + |
| 23 | +interface SettingsPageContentProps { |
| 24 | + workspace: Workspace; |
| 25 | + userId: string; |
| 26 | + userEmail: string; |
| 27 | +} |
| 28 | + |
| 29 | +export function SettingsPageContent({ |
| 30 | + workspace, |
| 31 | + userId, |
| 32 | + userEmail, |
| 33 | +}: SettingsPageContentProps) { |
| 34 | + return ( |
| 35 | + <div className="mx-auto max-w-xl p-6"> |
| 36 | + <div className="flex items-center gap-4"> |
| 37 | + <h1 className="text-2xl font-semibold">Workspace settings</h1> |
| 38 | + <Link |
| 39 | + href={`/${workspace.slug}/settings/members`} |
| 40 | + className="text-sm text-accent underline-offset-4 hover:underline" |
| 41 | + > |
| 42 | + Members |
| 43 | + </Link> |
| 44 | + </div> |
| 45 | + <p className="mt-1 text-sm text-muted-foreground"> |
| 46 | + Manage your workspace name, URL, and other settings. |
| 47 | + </p> |
| 48 | + <div className="mt-6"> |
| 49 | + <WorkspaceSettingsForm workspace={workspace} userId={userId} /> |
| 50 | + </div> |
| 51 | + {workspace.is_personal && ( |
| 52 | + <> |
| 53 | + <Separator className="mt-8 bg-overlay-border" /> |
| 54 | + <div className="mt-8"> |
| 55 | + <ChangePasswordSection /> |
| 56 | + </div> |
| 57 | + <Separator className="mt-8 bg-overlay-border" /> |
| 58 | + <div className="mt-8"> |
| 59 | + <DangerZoneSettings userEmail={userEmail} /> |
| 60 | + </div> |
| 61 | + </> |
| 62 | + )} |
| 63 | + </div> |
| 64 | + ); |
| 65 | +} |
0 commit comments