import "@/styles/Profile.css"; import type { UserProfile, UserType } from "@/types/nostrill"; import useLocalState from "@/state/state"; import Avatar from "../Avatar"; import ProfileEditor from "./Editor"; interface Props { user: UserType; userString: string; isMe: boolean; onSave?: () => void; } const Loader: React.FC = (props) => { const { profiles } = useLocalState((s) => ({ profiles: s.profiles, })); const profile = profiles.get(props.userString); console.log({ profiles }); if (props.isMe) return ; else return ; }; function Profile({ user, userString, profile, }: { user: UserType; userString: string; profile: UserProfile | undefined; }) { // Initialize state with existing profile or defaults // View-only mode for other users' profiles - no editing allowed const bannerImage = profile?.other?.banner || profile?.other?.Banner; const customFields = profile?.other ? Object.entries(profile.other) : []; return (
{bannerImage && (
Profile banner
)}

{profile?.name || userString}

{profile?.about &&

{profile.about}

} {customFields.length > 0 && (

Additional Info

{customFields.map(([key, value], index) => { if (key.toLocaleLowerCase() === "banner") return null; const isURL = URL.parse(value); return (
{key}: {isURL ? ( {value} ) : ( {value} )}
); })}
)}
); } export default Loader;