2025-11-12 00:28:29 +00:00
|
|
|
"use client";
|
|
|
|
|
|
2025-11-26 11:42:31 +00:00
|
|
|
import { useState, useEffect } from "react";
|
2025-11-12 00:28:29 +00:00
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import { Input } from "@/components/ui/input";
|
|
|
|
|
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/components/ui/card";
|
|
|
|
|
import {
|
|
|
|
|
User,
|
|
|
|
|
Mail,
|
|
|
|
|
Phone,
|
|
|
|
|
Save,
|
|
|
|
|
ArrowLeft,
|
|
|
|
|
Lock,
|
|
|
|
|
Eye,
|
|
|
|
|
EyeOff,
|
2025-11-26 11:42:31 +00:00
|
|
|
Loader2,
|
2025-11-12 00:28:29 +00:00
|
|
|
} from "lucide-react";
|
|
|
|
|
import Link from "next/link";
|
|
|
|
|
import { Navbar } from "@/components/Navbar";
|
2025-11-13 11:10:00 +00:00
|
|
|
import { useAppTheme } from "@/components/ThemeProvider";
|
2025-11-26 11:42:31 +00:00
|
|
|
import { getProfile, updateProfile } from "@/lib/actions/auth";
|
|
|
|
|
import { useAuth } from "@/hooks/useAuth";
|
|
|
|
|
import { toast } from "sonner";
|
2025-11-12 00:28:29 +00:00
|
|
|
|
|
|
|
|
export default function SettingsPage() {
|
2025-11-13 11:10:00 +00:00
|
|
|
const { theme } = useAppTheme();
|
|
|
|
|
const isDark = theme === "dark";
|
2025-11-26 11:42:31 +00:00
|
|
|
const { user } = useAuth();
|
2025-11-12 00:28:29 +00:00
|
|
|
const [loading, setLoading] = useState(false);
|
2025-11-26 11:42:31 +00:00
|
|
|
const [fetching, setFetching] = useState(true);
|
2025-11-12 00:28:29 +00:00
|
|
|
const [formData, setFormData] = useState({
|
2025-11-26 11:42:31 +00:00
|
|
|
firstName: "",
|
|
|
|
|
lastName: "",
|
|
|
|
|
email: "",
|
|
|
|
|
phone: "",
|
2025-11-12 00:28:29 +00:00
|
|
|
});
|
|
|
|
|
const [passwordData, setPasswordData] = useState({
|
|
|
|
|
currentPassword: "",
|
|
|
|
|
newPassword: "",
|
|
|
|
|
confirmPassword: "",
|
|
|
|
|
});
|
|
|
|
|
const [showPasswords, setShowPasswords] = useState({
|
|
|
|
|
current: false,
|
|
|
|
|
new: false,
|
|
|
|
|
confirm: false,
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-26 11:42:31 +00:00
|
|
|
// Fetch profile data on mount
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const fetchProfile = async () => {
|
|
|
|
|
setFetching(true);
|
|
|
|
|
try {
|
|
|
|
|
const profile = await getProfile();
|
|
|
|
|
setFormData({
|
|
|
|
|
firstName: profile.first_name || "",
|
|
|
|
|
lastName: profile.last_name || "",
|
|
|
|
|
email: profile.email || "",
|
|
|
|
|
phone: profile.phone_number || "",
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Failed to fetch profile:", error);
|
|
|
|
|
const errorMessage = error instanceof Error ? error.message : "Failed to load profile";
|
|
|
|
|
toast.error(errorMessage);
|
|
|
|
|
} finally {
|
|
|
|
|
setFetching(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
fetchProfile();
|
|
|
|
|
}, []);
|
|
|
|
|
|
2025-11-12 00:28:29 +00:00
|
|
|
const handleInputChange = (field: string, value: string) => {
|
|
|
|
|
setFormData((prev) => ({
|
|
|
|
|
...prev,
|
|
|
|
|
[field]: value,
|
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handlePasswordChange = (field: string, value: string) => {
|
|
|
|
|
setPasswordData((prev) => ({
|
|
|
|
|
...prev,
|
|
|
|
|
[field]: value,
|
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const togglePasswordVisibility = (field: "current" | "new" | "confirm") => {
|
|
|
|
|
setShowPasswords((prev) => ({
|
|
|
|
|
...prev,
|
|
|
|
|
[field]: !prev[field],
|
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleSave = async () => {
|
2025-11-26 11:42:31 +00:00
|
|
|
if (!formData.firstName || !formData.lastName) {
|
|
|
|
|
toast.error("First name and last name are required");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-12 00:28:29 +00:00
|
|
|
setLoading(true);
|
2025-11-26 11:42:31 +00:00
|
|
|
try {
|
|
|
|
|
await updateProfile({
|
|
|
|
|
first_name: formData.firstName,
|
|
|
|
|
last_name: formData.lastName,
|
|
|
|
|
phone_number: formData.phone || undefined,
|
|
|
|
|
});
|
|
|
|
|
toast.success("Profile updated successfully");
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Failed to update profile:", error);
|
|
|
|
|
const errorMessage = error instanceof Error ? error.message : "Failed to update profile";
|
|
|
|
|
toast.error(errorMessage);
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
2025-11-12 00:28:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handlePasswordSave = async () => {
|
2025-11-26 11:42:31 +00:00
|
|
|
if (!passwordData.currentPassword) {
|
|
|
|
|
toast.error("Please enter your current password");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-11-12 00:28:29 +00:00
|
|
|
if (passwordData.newPassword !== passwordData.confirmPassword) {
|
2025-11-26 11:42:31 +00:00
|
|
|
toast.error("New passwords do not match");
|
2025-11-12 00:28:29 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (passwordData.newPassword.length < 8) {
|
2025-11-26 11:42:31 +00:00
|
|
|
toast.error("Password must be at least 8 characters long");
|
2025-11-12 00:28:29 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2025-11-26 11:42:31 +00:00
|
|
|
|
2025-11-12 00:28:29 +00:00
|
|
|
setLoading(true);
|
2025-11-26 11:42:31 +00:00
|
|
|
try {
|
|
|
|
|
// Note: The API might not have a change password endpoint for authenticated users
|
|
|
|
|
// This would need to be implemented on the backend
|
|
|
|
|
// For now, we'll show a message that this feature is coming soon
|
|
|
|
|
toast.error("Password change feature is not yet available. Please use the forgot password flow.");
|
|
|
|
|
// Reset password fields
|
|
|
|
|
setPasswordData({
|
|
|
|
|
currentPassword: "",
|
|
|
|
|
newPassword: "",
|
|
|
|
|
confirmPassword: "",
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Failed to update password:", error);
|
|
|
|
|
const errorMessage = error instanceof Error ? error.message : "Failed to update password";
|
|
|
|
|
toast.error(errorMessage);
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
2025-11-12 00:28:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2025-11-13 11:10:00 +00:00
|
|
|
<div className={`min-h-screen ${isDark ? 'bg-gray-900' : 'bg-gray-50'}`}>
|
2025-11-12 00:28:29 +00:00
|
|
|
<Navbar />
|
|
|
|
|
|
|
|
|
|
{/* Main Content */}
|
|
|
|
|
<main className="container mx-auto px-4 sm:px-6 lg:px-8 space-y-6 pt-20 sm:pt-24 pb-8">
|
|
|
|
|
{/* Header */}
|
2025-11-13 11:42:56 +00:00
|
|
|
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6">
|
2025-11-12 00:28:29 +00:00
|
|
|
<div className="flex items-center gap-4">
|
|
|
|
|
<Link href="/user/dashboard">
|
2025-11-13 11:10:00 +00:00
|
|
|
<Button variant="ghost" size="icon" className={isDark ? 'hover:bg-gray-800 text-gray-300' : 'hover:bg-gray-100'}>
|
2025-11-12 00:28:29 +00:00
|
|
|
<ArrowLeft className="w-4 h-4" />
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
<div>
|
2025-11-13 11:10:00 +00:00
|
|
|
<h1 className={`text-2xl font-semibold mb-1 ${isDark ? 'text-white' : 'text-gray-900'}`}>
|
2025-11-12 00:28:29 +00:00
|
|
|
Settings
|
|
|
|
|
</h1>
|
2025-11-13 11:10:00 +00:00
|
|
|
<p className={`text-sm ${isDark ? 'text-gray-400' : 'text-gray-600'}`}>
|
2025-11-12 00:28:29 +00:00
|
|
|
Manage your account settings and preferences
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-11-26 11:42:31 +00:00
|
|
|
{fetching ? (
|
|
|
|
|
<div className="flex items-center justify-center py-12">
|
|
|
|
|
<Loader2 className={`w-8 h-8 animate-spin ${isDark ? 'text-gray-400' : 'text-gray-600'}`} />
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="max-w-4xl mx-auto">
|
|
|
|
|
<div className="space-y-6">
|
|
|
|
|
{/* Profile Information */}
|
|
|
|
|
<Card className={isDark ? 'bg-gray-800 border-gray-700' : 'bg-white border-gray-200'}>
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<User className={`w-5 h-5 ${isDark ? 'text-gray-400' : 'text-gray-600'}`} />
|
|
|
|
|
<CardTitle className={isDark ? 'text-white' : 'text-gray-900'}>Profile Information</CardTitle>
|
|
|
|
|
</div>
|
|
|
|
|
<CardDescription className={isDark ? 'text-gray-400' : 'text-gray-600'}>
|
|
|
|
|
Update your personal information and contact details
|
|
|
|
|
</CardDescription>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent className="space-y-4">
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<label className={`text-sm font-medium ${isDark ? 'text-gray-300' : 'text-gray-700'}`}>
|
|
|
|
|
Full Name
|
|
|
|
|
</label>
|
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
|
|
|
<div className="relative">
|
|
|
|
|
<Input
|
|
|
|
|
type="text"
|
|
|
|
|
value={formData.firstName}
|
|
|
|
|
onChange={(e) => handleInputChange("firstName", e.target.value)}
|
|
|
|
|
className={`${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`}
|
|
|
|
|
placeholder="First name"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="relative">
|
|
|
|
|
<Input
|
|
|
|
|
type="text"
|
|
|
|
|
value={formData.lastName}
|
|
|
|
|
onChange={(e) => handleInputChange("lastName", e.target.value)}
|
|
|
|
|
className={`${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`}
|
|
|
|
|
placeholder="Last name"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-11-12 00:28:29 +00:00
|
|
|
</div>
|
|
|
|
|
|
2025-11-26 11:42:31 +00:00
|
|
|
<div className="space-y-2">
|
|
|
|
|
<label className={`text-sm font-medium ${isDark ? 'text-gray-300' : 'text-gray-700'}`}>
|
|
|
|
|
Email Address
|
|
|
|
|
</label>
|
|
|
|
|
<div className="relative">
|
|
|
|
|
<Mail className={`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 ${isDark ? 'text-gray-500' : 'text-gray-400'}`} />
|
|
|
|
|
<Input
|
|
|
|
|
type="email"
|
|
|
|
|
value={formData.email}
|
|
|
|
|
disabled
|
|
|
|
|
className={`pl-10 ${isDark ? 'bg-gray-700/50 border-gray-600 text-gray-400 cursor-not-allowed' : 'bg-gray-50 border-gray-300 text-gray-500 cursor-not-allowed'}`}
|
|
|
|
|
placeholder="Enter your email"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<p className={`text-xs ${isDark ? 'text-gray-500' : 'text-gray-500'}`}>
|
|
|
|
|
Email address cannot be changed
|
|
|
|
|
</p>
|
2025-11-12 00:28:29 +00:00
|
|
|
</div>
|
|
|
|
|
|
2025-11-26 11:42:31 +00:00
|
|
|
<div className="space-y-2">
|
|
|
|
|
<label className={`text-sm font-medium ${isDark ? 'text-gray-300' : 'text-gray-700'}`}>
|
|
|
|
|
Phone Number
|
|
|
|
|
</label>
|
|
|
|
|
<div className="relative">
|
|
|
|
|
<Phone className={`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 ${isDark ? 'text-gray-500' : 'text-gray-400'}`} />
|
|
|
|
|
<Input
|
|
|
|
|
type="tel"
|
|
|
|
|
value={formData.phone}
|
|
|
|
|
onChange={(e) => handleInputChange("phone", e.target.value)}
|
|
|
|
|
className={`pl-10 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`}
|
|
|
|
|
placeholder="Enter your phone number"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2025-11-12 00:28:29 +00:00
|
|
|
</div>
|
2025-11-26 11:42:31 +00:00
|
|
|
|
|
|
|
|
<div className="pt-2">
|
|
|
|
|
<Button
|
|
|
|
|
onClick={handleSave}
|
|
|
|
|
disabled={loading}
|
|
|
|
|
className="bg-gradient-to-r from-rose-500 to-pink-600 hover:from-rose-600 hover:to-pink-700 text-white"
|
|
|
|
|
>
|
|
|
|
|
{loading ? (
|
|
|
|
|
<>
|
|
|
|
|
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
|
|
|
|
Saving...
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<Save className="w-4 h-4 mr-2" />
|
|
|
|
|
Save Changes
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
2025-11-12 00:28:29 +00:00
|
|
|
|
|
|
|
|
{/* Change Password */}
|
2025-11-13 11:10:00 +00:00
|
|
|
<Card className={isDark ? 'bg-gray-800 border-gray-700' : 'bg-white border-gray-200'}>
|
2025-11-12 00:28:29 +00:00
|
|
|
<CardHeader>
|
|
|
|
|
<div className="flex items-center gap-2">
|
2025-11-13 11:10:00 +00:00
|
|
|
<Lock className={`w-5 h-5 ${isDark ? 'text-gray-400' : 'text-gray-600'}`} />
|
|
|
|
|
<CardTitle className={isDark ? 'text-white' : 'text-gray-900'}>Change Password</CardTitle>
|
2025-11-12 00:28:29 +00:00
|
|
|
</div>
|
2025-11-13 11:10:00 +00:00
|
|
|
<CardDescription className={isDark ? 'text-gray-400' : 'text-gray-600'}>
|
2025-11-12 00:28:29 +00:00
|
|
|
Update your password to keep your account secure
|
|
|
|
|
</CardDescription>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent className="space-y-4">
|
|
|
|
|
<div className="space-y-2">
|
2025-11-13 11:10:00 +00:00
|
|
|
<label className={`text-sm font-medium ${isDark ? 'text-gray-300' : 'text-gray-700'}`}>
|
2025-11-12 00:28:29 +00:00
|
|
|
Current Password
|
|
|
|
|
</label>
|
|
|
|
|
<div className="relative">
|
2025-11-13 11:10:00 +00:00
|
|
|
<Lock className={`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 ${isDark ? 'text-gray-500' : 'text-gray-400'}`} />
|
2025-11-12 00:28:29 +00:00
|
|
|
<Input
|
|
|
|
|
type={showPasswords.current ? "text" : "password"}
|
|
|
|
|
value={passwordData.currentPassword}
|
|
|
|
|
onChange={(e) => handlePasswordChange("currentPassword", e.target.value)}
|
2025-11-26 11:42:31 +00:00
|
|
|
className={`pl-10 pr-10 h-11 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`}
|
2025-11-12 00:28:29 +00:00
|
|
|
placeholder="Enter your current password"
|
|
|
|
|
/>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={() => togglePasswordVisibility("current")}
|
2025-11-13 11:10:00 +00:00
|
|
|
className={`absolute right-3 top-1/2 transform -translate-y-1/2 ${isDark ? 'text-gray-400 hover:text-gray-300' : 'text-gray-400 hover:text-gray-600'}`}
|
2025-11-12 00:28:29 +00:00
|
|
|
>
|
|
|
|
|
{showPasswords.current ? (
|
|
|
|
|
<EyeOff className="w-4 h-4" />
|
|
|
|
|
) : (
|
|
|
|
|
<Eye className="w-4 h-4" />
|
|
|
|
|
)}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="space-y-2">
|
2025-11-13 11:10:00 +00:00
|
|
|
<label className={`text-sm font-medium ${isDark ? 'text-gray-300' : 'text-gray-700'}`}>
|
2025-11-12 00:28:29 +00:00
|
|
|
New Password
|
|
|
|
|
</label>
|
|
|
|
|
<div className="relative">
|
2025-11-13 11:10:00 +00:00
|
|
|
<Lock className={`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 ${isDark ? 'text-gray-500' : 'text-gray-400'}`} />
|
2025-11-12 00:28:29 +00:00
|
|
|
<Input
|
|
|
|
|
type={showPasswords.new ? "text" : "password"}
|
|
|
|
|
value={passwordData.newPassword}
|
|
|
|
|
onChange={(e) => handlePasswordChange("newPassword", e.target.value)}
|
2025-11-26 11:42:31 +00:00
|
|
|
className={`pl-10 pr-10 h-11 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`}
|
2025-11-12 00:28:29 +00:00
|
|
|
placeholder="Enter your new password"
|
|
|
|
|
/>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={() => togglePasswordVisibility("new")}
|
2025-11-13 11:10:00 +00:00
|
|
|
className={`absolute right-3 top-1/2 transform -translate-y-1/2 ${isDark ? 'text-gray-400 hover:text-gray-300' : 'text-gray-400 hover:text-gray-600'}`}
|
2025-11-12 00:28:29 +00:00
|
|
|
>
|
|
|
|
|
{showPasswords.new ? (
|
|
|
|
|
<EyeOff className="w-4 h-4" />
|
|
|
|
|
) : (
|
|
|
|
|
<Eye className="w-4 h-4" />
|
|
|
|
|
)}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-11-13 11:10:00 +00:00
|
|
|
<p className={`text-xs ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>
|
2025-11-12 00:28:29 +00:00
|
|
|
Password must be at least 8 characters long
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="space-y-2">
|
2025-11-13 11:10:00 +00:00
|
|
|
<label className={`text-sm font-medium ${isDark ? 'text-gray-300' : 'text-gray-700'}`}>
|
2025-11-12 00:28:29 +00:00
|
|
|
Confirm New Password
|
|
|
|
|
</label>
|
|
|
|
|
<div className="relative">
|
2025-11-13 11:10:00 +00:00
|
|
|
<Lock className={`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 ${isDark ? 'text-gray-500' : 'text-gray-400'}`} />
|
2025-11-12 00:28:29 +00:00
|
|
|
<Input
|
|
|
|
|
type={showPasswords.confirm ? "text" : "password"}
|
|
|
|
|
value={passwordData.confirmPassword}
|
|
|
|
|
onChange={(e) => handlePasswordChange("confirmPassword", e.target.value)}
|
2025-11-26 11:42:31 +00:00
|
|
|
className={`pl-10 pr-10 h-11 ${isDark ? 'bg-gray-700 border-gray-600 text-white placeholder:text-gray-400' : 'bg-white border-gray-300 text-gray-900'}`}
|
2025-11-12 00:28:29 +00:00
|
|
|
placeholder="Confirm your new password"
|
|
|
|
|
/>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={() => togglePasswordVisibility("confirm")}
|
2025-11-13 11:10:00 +00:00
|
|
|
className={`absolute right-3 top-1/2 transform -translate-y-1/2 ${isDark ? 'text-gray-400 hover:text-gray-300' : 'text-gray-400 hover:text-gray-600'}`}
|
2025-11-12 00:28:29 +00:00
|
|
|
>
|
|
|
|
|
{showPasswords.confirm ? (
|
|
|
|
|
<EyeOff className="w-4 h-4" />
|
|
|
|
|
) : (
|
|
|
|
|
<Eye className="w-4 h-4" />
|
|
|
|
|
)}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="pt-2">
|
|
|
|
|
<Button
|
|
|
|
|
onClick={handlePasswordSave}
|
|
|
|
|
disabled={loading || !passwordData.currentPassword || !passwordData.newPassword || !passwordData.confirmPassword}
|
2025-11-13 11:10:00 +00:00
|
|
|
className="bg-gradient-to-r from-rose-500 to-pink-600 hover:from-rose-600 hover:to-pink-700 text-white"
|
2025-11-12 00:28:29 +00:00
|
|
|
>
|
|
|
|
|
{loading ? (
|
2025-11-26 11:42:31 +00:00
|
|
|
<>
|
|
|
|
|
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
|
|
|
|
Updating...
|
|
|
|
|
</>
|
2025-11-12 00:28:29 +00:00
|
|
|
) : (
|
2025-11-26 11:42:31 +00:00
|
|
|
<>
|
|
|
|
|
<Lock className="w-4 h-4 mr-2" />
|
|
|
|
|
Update Password
|
|
|
|
|
</>
|
2025-11-12 00:28:29 +00:00
|
|
|
)}
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
2025-11-26 11:42:31 +00:00
|
|
|
</div>
|
2025-11-12 00:28:29 +00:00
|
|
|
</div>
|
2025-11-26 11:42:31 +00:00
|
|
|
)}
|
2025-11-12 00:28:29 +00:00
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|