diff --git a/src/pages/Account.tsx b/src/pages/Account.tsx new file mode 100644 index 0000000..4c6db9f --- /dev/null +++ b/src/pages/Account.tsx @@ -0,0 +1,252 @@ +import { useState } from "react"; +import { Link } from "react-router-dom"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Input } from "@/components/ui/input"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { Avatar, AvatarFallback } from "@/components/ui/avatar"; +import { Separator } from "@/components/ui/separator"; +import { + Table, TableBody, TableCell, TableHead, TableHeader, TableRow +} from "@/components/ui/table"; +import { + Package, User, MapPin, Heart, Star, Eye, Trash2, ShoppingBag, Edit +} from "lucide-react"; +import { toast } from "sonner"; +import Header from "@/components/Header"; +import Footer from "@/components/Footer"; +import { useAuth } from "@/hooks/use-tygarun"; +import { Label } from "@/components/ui/label"; + +const orders = [ + { id: "ORD-2024-1847", date: "Mar 15, 2024", status: "Delivered", statusColor: "bg-green-100 text-green-700", total: 423.00, items: 3 }, + { id: "ORD-2024-1692", date: "Feb 28, 2024", status: "Shipped", statusColor: "bg-blue-100 text-blue-700", total: 189.00, items: 1 }, + { id: "ORD-2024-1534", date: "Feb 10, 2024", status: "Processing", statusColor: "bg-amber-100 text-amber-700", total: 567.00, items: 4 }, +]; + +const wishlistItems = [ + { id: 1, name: "Silk Evening Dress", price: 245, gradient: "from-amber-100 to-orange-200", rating: 5 }, + { id: 2, name: "Italian Leather Handbag", price: 320, gradient: "from-stone-200 to-rose-100", rating: 5 }, + { id: 3, name: "Tailored Wool Coat", price: 385, gradient: "from-stone-200 to-stone-400", rating: 5 }, + { id: 4, name: "Pearl Drop Earrings", price: 68, gradient: "from-amber-100 to-rose-100", rating: 4 }, +]; + +function AccountSignIn() { + const { signin, loading, error } = useAuth(); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + + const handleSignin = async (e: React.FormEvent) => { + e.preventDefault(); + try { await signin(email, password); } catch { toast.error("Sign in failed."); } + }; + + return ( +
+
+
+

Sign in to your account

+
+
+ + setEmail(e.target.value)} placeholder="you@example.com" /> +
+
+ + setPassword(e.target.value)} placeholder="••••••••" /> +
+ {error &&

{error}

} + +
+
+
+ ); +} + +export default function AccountPage() { + const { user, isSignedIn, connected, signout } = useAuth(); + const [profile, setProfile] = useState({ + firstName: "Alexandra", + lastName: "Chen", + email: "alex.chen@email.com", + phone: "+1 (555) 234-5678", + }); + + // When tyga.run is connected, require sign-in. In demo mode the account + // preview stays walkable with seed data. + if (connected && !isSignedIn) return ; + + const displayFirst = user?.firstName || profile.firstName; + const displayEmail = user?.email || profile.email; + + const renderStars = (count: number) => + Array.from({ length: 5 }, (_, i) => ( + + )); + + return ( +
+
+ +
+ {/* Profile Header */} +
+ + AC + +
+

Welcome back, {displayFirst}

+

{displayEmail}

+
+ {isSignedIn && ( + + )} +
+ + + + Orders + Profile + Addresses + Wishlist + + + {/* Orders Tab */} + + + + + + + Order + Date + Status + Total + Action + + + + {orders.map((order) => ( + + {order.id} + {order.date} + + {order.status} + + \${order.total.toFixed(2)} + + + + + ))} + +
+
+
+
+ + {/* Profile Tab */} + + + +

Personal Information

+
+
+ + setProfile({ ...profile, firstName: e.target.value })} /> +
+
+ + setProfile({ ...profile, lastName: e.target.value })} /> +
+
+ + setProfile({ ...profile, email: e.target.value })} /> +
+
+ + setProfile({ ...profile, phone: e.target.value })} /> +
+
+ +
+
+
+ + {/* Addresses Tab */} + +
+ + +
+ Default + +
+

Home

+

+ Alexandra Chen
+ 456 Park Avenue, Apt 12B
+ New York, NY 10022 +

+
+
+ + +
+ Office + +
+

Office

+

+ Alexandra Chen
+ 789 Madison Ave, Floor 15
+ New York, NY 10065 +

+
+
+
+ +
+ + {/* Wishlist Tab */} + +
+ {wishlistItems.map((item) => ( + +
+
+
+ Image +
+ +

{item.name}

+
{renderStars(item.rating)}
+

\${item.price}

+
+ + +
+
+ + ))} +
+ + +
+ +
+ ); +}