"use client"; import { useState } from "react"; import Image from "next/image"; import { Button } from "@/components/ui/button"; import SubscriptionCard from "@/components/SubscriptionCard"; import { HiCheckBadge } from "react-icons/hi2"; import Tabs from "@/components/Tabs"; import useProfile from "@/lib/hooks/useProfile"; import { getTwoLetters, truncateText } from "@/lib/utils"; import ProfileFeed from "./_components/Feed"; import Subscriptions from "./_components/Subscriptions"; import { nip19 } from "nostr-tools"; import useLists from "@/lib/hooks/useLists"; export default function ProfilePage({ params: { npub }, }: { params: { npub: string; }; }) { const [activeTab, setActiveTab] = useState("feed"); if (npub === "service-worker.js") { throw new Error("Invalid list"); } const { type, data } = nip19.decode(npub); if (type !== "npub") { throw new Error("Invalid list"); } const pubkey = data.toString(); const { profile } = useProfile(pubkey); const { init, lists } = useLists(); return (
{!!profile?.banner && ( banner )}
{profile?.image ? ( profile picture ) : (
{getTwoLetters({ npub, profile, })}
)}

{profile?.displayName ?? profile?.name ?? truncateText(npub)}

{!!profile?.nip05 && ( )}
{!!profile?.name &&

{profile.name}

} {!!profile?.name && !!profile.nip05 && ( <>
ยท

{profile.nip05}

)}
{!!profile?.about && (

{profile.about}

)}
{/* {[].map((e) => ( ))} */}
setActiveTab(t.name)} />
{activeTab === "feed" ? : ""} {activeTab === "subscriptions" ? : ""}
); }