"use client" import { useAccount } from "@/lib/providers/jazz-provider" import { useState, useRef, useCallback } from "react" import { useParams } from "next/navigation" import { Input } from "@/components/ui/input" import { Button } from "@/components/ui/button" import Link from "next/link" import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar" interface ProfileStatsProps { number: number label: string } const ProfileStats: React.FC = ({ number, label }) => { return (

{number}

{label}

) } export const ProfileWrapper = () => { const account = useAccount() const params = useParams() const username = params.username as string const avatarInputRef = useRef(null) const [isEditing, setIsEditing] = useState(false) const [newName, setNewName] = useState(account.me?.profile?.name || "") const [error, setError] = useState("") const editProfileClicked = () => { setIsEditing(true) setError("") } const changeName = (e: React.ChangeEvent) => { setNewName(e.target.value) setError("") } const validateName = useCallback((name: string) => { if (name.trim().length < 2) { return "Name must be at least 2 characters long" } if (name.trim().length > 40) { return "Name must not exceed 40 characters" } return "" }, []) const saveProfile = () => { const validationError = validateName(newName) if (validationError) { setError(validationError) return } if (account.me && account.me.profile) { account.me.profile.name = newName.trim() console.log("Updating name to:", newName.trim()) } setIsEditing(false) } const cancelEditing = () => { setNewName(account.me?.profile?.name || "") setIsEditing(false) setError("") } const editAvatar = (event: React.ChangeEvent) => { const file = event.target.files?.[0] if (file) { console.log("File selected:", file) } } if (!account.me || !account.me.profile) { return (

Oops! This account doesn't exist.

Try searching for another.

The link you followed may be broken, or the page may have been removed. Go back to homepage .

) } return (

Profile

{username}

avatarInputRef.current?.click()} className="cursor-pointer"> {account.me?.profile?.name?.charAt(0)}
{isEditing ? ( <> {error &&

{error}

} ) : (

{account.me?.profile?.name}

)}
{isEditing ? (
) : ( )}

Public profiles are coming soon

) } { // interface ProfileLinksProps { // linklabel?: string // link?: string // topic?: string // } // interface ProfilePagesProps { // topic?: string // } // const ProfileLinks: React.FC = ({ linklabel, link, topic }) => { // return ( //
//
//

{linklabel || "Untitled"}

//
// //

{link || "#"}

//
//
//
{topic || "Uncategorized"}
//
// ) // } // const ProfilePages: React.FC = ({ topic }) => { // return ( //
//
{topic || "Uncategorized"}
//
// ) // } /*

{account.me.root?.website}

*/ /* */ }