diff --git a/src/app/settings/profile/page.tsx b/src/app/settings/profile/page.tsx index ef9579f..82b0918 100644 --- a/src/app/settings/profile/page.tsx +++ b/src/app/settings/profile/page.tsx @@ -1,5 +1,7 @@ "use client"; + import { useEffect, useState } from "react"; +import { useRouter } from "next/navigation"; interface Profile { id: string; @@ -25,19 +27,18 @@ const CATEGORIES = ["general", "feeding", "sleep", "play", "clothing"] as const; const CATEGORY_EMOJI: Record = { feeding: "๐Ÿผ", sleep: "๐Ÿ’ค", play: "๐ŸŽฎ", clothing: "๐Ÿ‘—", general: "๐Ÿ›๏ธ" }; export default function ProfileSettingsPage() { + const router = useRouter(); const [profile, setProfile] = useState(null); const [products, setProducts] = useState([]); const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); const [saveMsg, setSaveMsg] = useState(""); - // form state const [slug, setSlug] = useState(""); const [displayName, setDisplayName] = useState(""); const [bio, setBio] = useState(""); const [isPublic, setIsPublic] = useState(false); - // product form const [showAddProduct, setShowAddProduct] = useState(false); const [editingProduct, setEditingProduct] = useState(null); const [pTitle, setPTitle] = useState(""); @@ -139,36 +140,47 @@ export default function ProfileSettingsPage() { const slugValid = /^[a-z0-9-]{3,40}$/.test(slug); const baseUrl = typeof window !== "undefined" ? window.location.origin : ""; + const inputClass = "w-full border border-gray-200 dark:border-gray-600 rounded-xl px-3 py-2.5 text-sm bg-white dark:bg-gray-700 dark:text-white focus:outline-none focus:ring-2 focus:ring-rose-300"; + if (loading) return ( -
-
+
+
+ {["๐Ÿผ", "๐Ÿ˜ด", "๐Ÿšผ", "๐Ÿ‘ถ"].map((e, i) => ( + {e} + ))} +
+

Loading profileโ€ฆ

); return ( -
-
-

My Profile Page

+
+ {/* Header */} +
+ +

My Profile Page

+
+
{/* Profile section */} -
+

Profile

- + setDisplayName(e.target.value)} - className="w-full border dark:border-gray-600 rounded-xl px-3 py-2 text-sm dark:bg-gray-700 dark:text-white mb-3" + className={`${inputClass} mb-3`} placeholder="Priya Sharma" /> - -
- {baseUrl}/m/ + +
+ {baseUrl}/m/ setSlug(e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, ""))} - className="flex-1 bg-transparent outline-none dark:text-white" + className="flex-1 bg-transparent outline-none dark:text-white text-sm" placeholder="priya-sharma" />
@@ -176,47 +188,49 @@ export default function ProfileSettingsPage() {

3โ€“40 chars, lowercase letters, numbers, hyphens only

)} - +