"use client";
import { cn } from "@/lib/utils";
import {
Dialog,
DialogContent,
DialogTrigger,
} from "@/app/_components/ui/dialog";
import { ScrollArea } from "@/app/_components/ui/scroll-area";
import { Separator } from "@/app/_components/ui/separator";
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/app/_components/ui/avatar";
import {
IconAdjustmentsHorizontal,
IconBaselineDensityLarge,
IconBell,
IconFileExport,
IconFileImport,
IconFingerprint,
IconLock,
IconPlugConnected,
IconSettings,
IconUser,
IconUsers,
IconWorld,
} from "@tabler/icons-react";
import type { User } from "@/src/models/users/users.model";
import { ProfileSettings } from "./profile-settings";
import { DialogTitle } from "@radix-ui/react-dialog";
import { useState } from "react";
import NotificationsSetting from "./notification-settings";
import PreferencesSettings from "./preference-settings";
import ImportData from "./import-data";
interface SettingsDialogProps {
user: User | null;
trigger: React.ReactNode;
defaultTab?: string;
open?: boolean;
onOpenChange?: (open: boolean) => void;
}
interface SettingsTab {
id: string;
icon: typeof IconUser;
title: string;
content: React.ReactNode;
}
interface SettingsSection {
title: string;
tabs: SettingsTab[];
}
export function SettingsDialog({
user,
trigger,
defaultTab = "account",
open,
onOpenChange,
}: SettingsDialogProps) {
const [selectedTab, setSelectedTab] = useState(defaultTab);
// Get user display name
const preferredName = user?.profile?.first_name || "";
const userEmail = user?.email || "";
const displayName = preferredName || userEmail?.split("@")[0] || "User";
const userAvatar = user?.profile?.avatar || "";
const sections: SettingsSection[] = [
{
title: "Account",
tabs: [
{
id: "account",
icon: IconUser,
title: "My Account",
content: