diff --git a/src/app/(protected)/settings/page.tsx b/src/app/(protected)/settings/page.tsx index d72324e..47097e8 100644 --- a/src/app/(protected)/settings/page.tsx +++ b/src/app/(protected)/settings/page.tsx @@ -53,12 +53,12 @@ export default function SettingsPage({ onClose }: SettingsPageProps) { newPassword: string; }) => { console.log("Changing password"); - return true; + return true; }; const handleDeleteAccount = async () => { console.log("Deleting account"); - return true; + return true; }; const handleExportData = () => { @@ -116,12 +116,18 @@ export default function SettingsPage({ onClose }: SettingsPageProps) { : "text-slate-400 hover:bg-slate-800/50 hover:text-white" }`} > - +
-
+
{tab.label}
-
+
{tab.description}
@@ -138,7 +144,9 @@ export default function SettingsPage({ onClose }: SettingsPageProps) { )} {activeTab === "password" && ( - + )} {activeTab === "danger" && ( @@ -152,4 +160,4 @@ export default function SettingsPage({ onClose }: SettingsPageProps) {
); -} \ No newline at end of file +} diff --git a/src/app/auth/page.tsx b/src/app/auth/page.tsx index e778df5..c0ada97 100644 --- a/src/app/auth/page.tsx +++ b/src/app/auth/page.tsx @@ -110,7 +110,7 @@ export default function AuthPage() { - Shikक्षya + ShikShya diff --git a/src/components/layout/sidebar.tsx b/src/components/layout/sidebar.tsx index 1180b74..52726b5 100644 --- a/src/components/layout/sidebar.tsx +++ b/src/components/layout/sidebar.tsx @@ -8,7 +8,6 @@ import { motion, AnimatePresence } from "framer-motion"; import { X, LogOut, - User, Settings, ShieldCheck, Mail, diff --git a/src/lib/auth-client.ts b/src/lib/auth-client.ts index 737816f..d38658e 100644 --- a/src/lib/auth-client.ts +++ b/src/lib/auth-client.ts @@ -8,4 +8,4 @@ export const authClient = createAuthClient({ (typeof window !== "undefined" ? window.location.origin : undefined), }); -export const { signIn, signUp, signOut, useSession } = authClient; +export const { signIn, signUp, signOut, useSession, updateUser } = authClient; diff --git a/src/modules/settings/type.ts b/src/modules/settings/type.ts index dd313ca..ff0125f 100644 --- a/src/modules/settings/type.ts +++ b/src/modules/settings/type.ts @@ -1,6 +1,6 @@ export interface Data { - firstName: string; - lastName: string; - email: string; - bio?: string; -} \ No newline at end of file + firstName: string; + lastName: string; + email: string; + bio?: string; +} diff --git a/src/modules/settings/ui/accountDeletion.tsx b/src/modules/settings/ui/accountDeletion.tsx index 14683c6..2c121af 100644 --- a/src/modules/settings/ui/accountDeletion.tsx +++ b/src/modules/settings/ui/accountDeletion.tsx @@ -1,12 +1,7 @@ "use client"; import React, { useState } from "react"; -import { - Trash2, - AlertTriangle, - Shield, - X, -} from "lucide-react"; +import { Trash2, AlertTriangle, Shield, X } from "lucide-react"; interface AccountDeletionProps { onDelete?: () => Promise; @@ -242,7 +237,8 @@ export default function AccountDeletion({ Need help? {" "} - If you're experiencing issues or have concerns, please{" "} + If you're experiencing issues or have concerns, + please{" "} void; -} -export default function PersonalSettings({ - initialData, - onSave, -}: PersonalSettingsProps) { +export default function PersonalSettings() { const [formData, setFormData] = useState({ - name: initialData?.name ?? "Shikshya", - email: initialData?.email ?? "shikshya@example.com", - bio: initialData?.bio ?? "Learning enthusiast", + name: "", }); const [isSaving, setIsSaving] = useState(false); + const [error, setError] = useState(null); - const handleInputChange = (field: string, value: string) => { + const handleChange = (field: "name", value: string) => { setFormData((prev) => ({ ...prev, [field]: value })); }; - const handleSave = () => { + const handleSave = async () => { setIsSaving(true); - setTimeout(() => { + setError(null); + + try { + if (formData.name) { + await updateUser({ name: formData.name }); + } + } catch (err) { + console.error(err); + } finally { setIsSaving(false); - onSave?.(formData); - }, 1000); + } }; return ( -
-
- {/* Header */} -
-

- Personal Information -

-

- Update your profile details and information -

-
+
+

+ Personal Information +

+

+ Update your profile details +

- {/* Profile Picture */} -
-
-
- {formData.name.charAt(0).toUpperCase()} -
- -
-
-

- Profile Photo -

+ {/* Profile avatar */} +
+
+
+ {formData.name?.charAt(0)?.toUpperCase() || "U"}
-
- - {/* Form Fields */} -
-
- - - handleInputChange("name", e.target.value) - } - className="w-full rounded-xl border border-slate-700/50 bg-slate-800/50 px-4 py-3 text-white placeholder-slate-500 transition-all focus:border-indigo-500/50 focus:ring-2 focus:ring-indigo-500/50 focus:outline-none" - placeholder="Enter your full name" - /> -
- -
- -
- - handleInputChange("email", e.target.value) - } - className="w-full rounded-xl border border-slate-700/50 bg-slate-800/50 px-4 py-3 text-white placeholder-slate-500 transition-all focus:border-indigo-500/50 focus:ring-2 focus:ring-indigo-500/50 focus:outline-none" - placeholder="your.email@example.com" - /> -
-

- We'll send verification to this email -

-
- -
- -