/* ┌──────────────────────────────────────────────────────────────────────────────┐ │ @author: Davidson Gomes │ │ @file: /app/profile/page.tsx │ │ Developed by: Davidson Gomes │ │ Creation date: May 13, 2025 │ │ Contact: contato@evolution-api.com │ ├──────────────────────────────────────────────────────────────────────────────┤ │ @copyright © Evolution API 2025. All rights reserved. │ │ Licensed under the Apache License, Version 2.0 │ │ │ │ You may not use this file except in compliance with the License. │ │ You may obtain a copy of the License at │ │ │ │ http://www.apache.org/licenses/LICENSE-2.0 │ │ │ │ Unless required by applicable law or agreed to in writing, software │ │ distributed under the License is distributed on an "AS IS" BASIS, │ │ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. │ │ See the License for the specific language governing permissions and │ │ limitations under the License. │ ├──────────────────────────────────────────────────────────────────────────────┤ │ @important │ │ For any future changes to the code in this file, it is recommended to │ │ include, together with the modification, the information of the developer │ │ who changed it and the date of modification. │ └──────────────────────────────────────────────────────────────────────────────┘ */ "use client" import type React from "react" import { useState, useEffect } from "react" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" import { useToast } from "@/components/ui/use-toast" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { User } from "lucide-react" import { useRouter } from "next/navigation" export default function ProfilePage() { const { toast } = useToast() const router = useRouter() const [isLoading, setIsLoading] = useState(false) const [userData, setUserData] = useState(() => { if (typeof window !== "undefined") { const user = localStorage.getItem("user") if (user) return JSON.parse(user) } return { id: "", name: "", email: "", is_admin: false, email_verified: false, created_at: "", } }) const [profileData, setProfileData] = useState({ name: userData.name, email: userData.email, }) useEffect(() => { setProfileData({ name: userData.name, email: userData.email }) }, [userData]) const handleProfileUpdate = async (e: React.FormEvent) => { e.preventDefault() setIsLoading(true) try { await new Promise((resolve) => setTimeout(resolve, 1000)) setUserData({ ...userData, name: profileData.name, email: profileData.email, }) toast({ title: "Profile updated", description: "Your information has been updated successfully.", }) } catch (error) { toast({ title: "Error updating profile", description: "Unable to update your information. Please try again.", variant: "destructive", }) } finally { setIsLoading(false) } } return (