-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
profile page updated and minor changes in dashboard sidebar
- Loading branch information
Showing
3 changed files
with
40 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import { useState } from "react"; | |
import { zodResolver } from "@hookform/resolvers/zod"; | ||
import { useForm } from "react-hook-form"; | ||
import * as z from "zod"; | ||
import { Loader2, User } from "lucide-react"; | ||
import { Loader2, User } from 'lucide-react'; | ||
import { Button } from "@/components/ui/button"; | ||
import { | ||
Form, | ||
|
@@ -16,7 +16,7 @@ import { | |
} from "@/components/ui/form"; | ||
import { Input } from "@/components/ui/input"; | ||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; | ||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; | ||
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; | ||
import { useSupabase } from "@/components/providers/SupabaseProvider"; | ||
import { useToast } from "@/hooks/use-toast"; | ||
import { ToastAction } from "@/components/ui/toast"; | ||
|
@@ -48,6 +48,7 @@ export default function ProfilePage() { | |
}); | ||
if (error) throw error; | ||
toast({ | ||
title: "Success! 🎉", | ||
description: "Profile updated successfully", | ||
}); | ||
} catch (error) { | ||
|
@@ -63,20 +64,33 @@ export default function ProfilePage() { | |
} | ||
|
||
return ( | ||
<div className="max-w-2xl mx-auto space-y-6"> | ||
<Card> | ||
<CardHeader> | ||
<CardTitle>Profile Settings</CardTitle> | ||
<div className="container mx-auto px-4 py-8 sm:px-6 lg:px-8"> | ||
<Card className="max-w-2xl mx-auto"> | ||
<CardHeader className="text-center"> | ||
<CardTitle className="text-2xl sm:text-3xl font-bold">Your Profile</CardTitle> | ||
<CardDescription className="mt-2 text-sm sm:text-base">Manage your account details and preferences</CardDescription> | ||
</CardHeader> | ||
<CardContent className="space-y-6"> | ||
<div className="flex items-center gap-4"> | ||
<Avatar className="h-20 w-20"> | ||
<AvatarImage src={user?.user_metadata?.avatar_url} /> | ||
<AvatarFallback> | ||
<User className="h-10 w-10" /> | ||
</AvatarFallback> | ||
</Avatar> | ||
<Button variant="outline">Change Avatar</Button> | ||
<div className="flex flex-col items-center gap-4 sm:gap-6"> | ||
<div className="relative"> | ||
<Avatar className="h-24 w-24 sm:h-32 sm:w-32 border-4 border-primary"> | ||
<AvatarImage src={user?.user_metadata?.avatar_url} /> | ||
<AvatarFallback className="bg-secondary text-secondary-foreground"> | ||
<User className="h-12 w-12 sm:h-16 sm:w-16" /> | ||
</AvatarFallback> | ||
</Avatar> | ||
{/* <Button | ||
size="icon" | ||
className="absolute bottom-0 right-0 rounded-full" | ||
variant="secondary" | ||
> | ||
<Camera className="h-4 w-4" /> | ||
</Button> */} | ||
</div> | ||
<div className="text-center"> | ||
<p className="text-lg sm:text-xl font-medium">{user?.user_metadata?.full_name || "Your Name"}</p> | ||
<p className="text-sm text-muted-foreground mt-1">{user?.email || "[email protected]"}</p> | ||
</div> | ||
</div> | ||
|
||
<Form {...form}> | ||
|
@@ -88,7 +102,7 @@ export default function ProfilePage() { | |
<FormItem> | ||
<FormLabel>Full Name</FormLabel> | ||
<FormControl> | ||
<Input placeholder="John Doe" {...field} /> | ||
<Input placeholder="Aayan" {...field} /> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
|
@@ -101,20 +115,22 @@ export default function ProfilePage() { | |
<FormItem> | ||
<FormLabel>Email</FormLabel> | ||
<FormControl> | ||
<Input placeholder="john@example.com" {...field} /> | ||
<Input placeholder="example@ml4e.com" {...field} /> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
<Button type="submit" disabled={isLoading}> | ||
{isLoading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />} | ||
Save Changes | ||
</Button> | ||
<div className="pt-4"> | ||
<Button type="submit" disabled={isLoading} className="w-full"> | ||
{isLoading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />} | ||
Save Changes | ||
</Button> | ||
</div> | ||
</form> | ||
</Form> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters