From 3a8d197437868ca10d294f0174afa013f138ec33 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Sat, 5 Oct 2024 16:35:47 +0000
Subject: feature(web): Change the settings page to be tabbed

---
 apps/web/app/dashboard/settings/page.tsx | 70 ++++++++++++++++++++++----------
 1 file changed, 49 insertions(+), 21 deletions(-)

(limited to 'apps/web/app/dashboard/settings/page.tsx')

diff --git a/apps/web/app/dashboard/settings/page.tsx b/apps/web/app/dashboard/settings/page.tsx
index 97048657..c116fb86 100644
--- a/apps/web/app/dashboard/settings/page.tsx
+++ b/apps/web/app/dashboard/settings/page.tsx
@@ -1,32 +1,60 @@
-import Link from "next/link";
+import AISettings from "@/components/dashboard/settings/AISettings";
 import ApiKeySettings from "@/components/dashboard/settings/ApiKeySettings";
 import { ChangePassword } from "@/components/dashboard/settings/ChangePassword";
 import ImportExport from "@/components/dashboard/settings/ImportExport";
 import UserDetails from "@/components/dashboard/settings/UserDetails";
-import { ExternalLink } from "lucide-react";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { Download, KeyRound, Sparkle, User } from "lucide-react";
 
 export default async function Settings() {
   return (
-    <>
-      <div className="rounded-md border bg-background p-4">
-        <UserDetails />
-        <ChangePassword />
-      </div>
-      <div className="mt-4 rounded-md border bg-background p-4">
-        <Link
-          className="flex items-center gap-2 text-lg font-medium"
-          href="/dashboard/settings/ai"
-        >
+    <Tabs
+      defaultValue="info"
+      orientation="horizontal"
+      className="flex flex-col gap-1"
+    >
+      <TabsList className="flex justify-start">
+        <TabsTrigger className="flex items-center gap-2 p-3" value="info">
+          <User className="size-4" />
+          User Info
+        </TabsTrigger>
+        <TabsTrigger className="flex items-center gap-2 p-3" value="ai">
+          <Sparkle className="size-4" />
           AI Settings
-          <ExternalLink />
-        </Link>
-      </div>
-      <div className="mt-4 rounded-md border bg-background p-4">
-        <ImportExport />
-      </div>
-      <div className="mt-4 rounded-md border bg-background p-4">
-        <ApiKeySettings />
+        </TabsTrigger>
+        <TabsTrigger
+          className="flex items-center gap-2 p-3"
+          value="importexport"
+        >
+          <Download className="size-4" />
+          Import / Export
+        </TabsTrigger>
+        <TabsTrigger className="flex items-center gap-2 p-3" value="apikeys">
+          <KeyRound className="size-4" />
+          API Keys
+        </TabsTrigger>
+      </TabsList>
+      <div className="w-full">
+        <TabsContent value="info">
+          <div className="rounded-md border bg-background p-4">
+            <UserDetails />
+            <ChangePassword />
+          </div>
+        </TabsContent>
+        <TabsContent value="ai">
+          <AISettings />
+        </TabsContent>
+        <TabsContent value="importexport">
+          <div className="rounded-md border bg-background p-4">
+            <ImportExport />
+          </div>
+        </TabsContent>
+        <TabsContent value="apikeys">
+          <div className="rounded-md border bg-background p-4">
+            <ApiKeySettings />
+          </div>
+        </TabsContent>
       </div>
-    </>
+    </Tabs>
   );
 }
-- 
cgit v1.2.3-70-g09d2

