"use client"; import { useAtom } from "jotai"; import { Brain, CircleUser, Globe, KeyRound, Monitor, ReceiptText, Sparkles } from "lucide-react"; import dynamic from "next/dynamic"; import { useTranslations } from "next-intl"; import { useMemo } from "react"; import { userSettingsDialogAtom } from "@/atoms/settings/settings-dialog.atoms"; import { SettingsDialog } from "@/components/settings/settings-dialog"; import { usePlatform } from "@/hooks/use-platform"; const ProfileContent = dynamic( () => import("@/app/dashboard/[search_space_id]/user-settings/components/ProfileContent").then( (m) => ({ default: m.ProfileContent }) ), { ssr: false } ); const ApiKeyContent = dynamic( () => import("@/app/dashboard/[search_space_id]/user-settings/components/ApiKeyContent").then( (m) => ({ default: m.ApiKeyContent }) ), { ssr: false } ); const PromptsContent = dynamic( () => import("@/app/dashboard/[search_space_id]/user-settings/components/PromptsContent").then( (m) => ({ default: m.PromptsContent }) ), { ssr: false } ); const CommunityPromptsContent = dynamic( () => import( "@/app/dashboard/[search_space_id]/user-settings/components/CommunityPromptsContent" ).then((m) => ({ default: m.CommunityPromptsContent })), { ssr: false } ); const PurchaseHistoryContent = dynamic( () => import( "@/app/dashboard/[search_space_id]/user-settings/components/PurchaseHistoryContent" ).then((m) => ({ default: m.PurchaseHistoryContent })), { ssr: false } ); const DesktopContent = dynamic( () => import("@/app/dashboard/[search_space_id]/user-settings/components/DesktopContent").then( (m) => ({ default: m.DesktopContent }) ), { ssr: false } ); const MemoryContent = dynamic( () => import("@/app/dashboard/[search_space_id]/user-settings/components/MemoryContent").then( (m) => ({ default: m.MemoryContent }) ), { ssr: false } ); export function UserSettingsDialog() { const t = useTranslations("userSettings"); const [state, setState] = useAtom(userSettingsDialogAtom); const { isDesktop } = usePlatform(); const navItems = useMemo( () => [ { value: "profile", label: t("profile_nav_label"), icon: }, { value: "api-key", label: t("api_key_nav_label"), icon: , }, { value: "prompts", label: "My Prompts", icon: , }, { value: "community-prompts", label: "Community Prompts", icon: , }, { value: "memory", label: "Memory", icon: , }, { value: "purchases", label: "Purchase History", icon: , }, ...(isDesktop ? [{ value: "desktop", label: "Desktop", icon: }] : []), ], [t, isDesktop] ); return ( setState((prev) => ({ ...prev, open }))} title={t("title")} navItems={navItems} activeItem={state.initialTab} onItemChange={(tab) => setState((prev) => ({ ...prev, initialTab: tab }))} >
{state.initialTab === "profile" && } {state.initialTab === "api-key" && } {state.initialTab === "prompts" && } {state.initialTab === "community-prompts" && } {state.initialTab === "memory" && } {state.initialTab === "purchases" && } {state.initialTab === "desktop" && }
); }