mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import { useAtom } from "jotai";
|
|
import { KeyRound, User } from "lucide-react";
|
|
import { useTranslations } from "next-intl";
|
|
import { ApiKeyContent } from "@/app/dashboard/[search_space_id]/user-settings/components/ApiKeyContent";
|
|
import { ProfileContent } from "@/app/dashboard/[search_space_id]/user-settings/components/ProfileContent";
|
|
import { userSettingsDialogAtom } from "@/atoms/settings/settings-dialog.atoms";
|
|
import { SettingsDialog } from "@/components/settings/settings-dialog";
|
|
|
|
export function UserSettingsDialog() {
|
|
const t = useTranslations("userSettings");
|
|
const [state, setState] = useAtom(userSettingsDialogAtom);
|
|
|
|
const navItems = [
|
|
{ value: "profile", label: t("profile_nav_label"), icon: <User className="h-4 w-4" /> },
|
|
{
|
|
value: "api-key",
|
|
label: t("api_key_nav_label"),
|
|
icon: <KeyRound className="h-4 w-4" />,
|
|
},
|
|
];
|
|
|
|
return (
|
|
<SettingsDialog
|
|
open={state.open}
|
|
onOpenChange={(open) => setState((prev) => ({ ...prev, open }))}
|
|
title={t("title")}
|
|
navItems={navItems}
|
|
activeItem={state.initialTab}
|
|
onItemChange={(tab) => setState((prev) => ({ ...prev, initialTab: tab }))}
|
|
>
|
|
<div className="pt-4">
|
|
{state.initialTab === "profile" && <ProfileContent />}
|
|
{state.initialTab === "api-key" && <ApiKeyContent />}
|
|
</div>
|
|
</SettingsDialog>
|
|
);
|
|
}
|