From c1cbd5f79403eab82862a9b8d9b4c50175d5a608 Mon Sep 17 00:00:00 2001 From: zmeyer44 Date: Tue, 17 Oct 2023 10:41:32 -0400 Subject: [PATCH] working on list page --- app/(app)/(profile)/[npub]/page.tsx | 2 +- app/(app)/_layout/index.tsx | 2 +- app/(app)/app/page.tsx | 2 +- .../list/[naddr]/_components/ProfileInfo.tsx | 44 +++++++ app/(app)/list/[naddr]/page.tsx | 117 ++++++------------ .../KindCard/components/ProfileHeader.tsx | 2 +- 6 files changed, 86 insertions(+), 83 deletions(-) create mode 100644 app/(app)/list/[naddr]/_components/ProfileInfo.tsx diff --git a/app/(app)/(profile)/[npub]/page.tsx b/app/(app)/(profile)/[npub]/page.tsx index 807d82f..cced53c 100644 --- a/app/(app)/(profile)/[npub]/page.tsx +++ b/app/(app)/(profile)/[npub]/page.tsx @@ -40,7 +40,7 @@ export default function ProfilePage({ ]; return (
-
+
diff --git a/app/(app)/_layout/index.tsx b/app/(app)/_layout/index.tsx index d9905df..48ce7d4 100644 --- a/app/(app)/_layout/index.tsx +++ b/app/(app)/_layout/index.tsx @@ -16,7 +16,7 @@ export default function AppLayout({ children }: { children: React.ReactNode }) { {/* Sidebar */}
-
{children}
+
{children}
{/* Mobile Banner */} diff --git a/app/(app)/app/page.tsx b/app/(app)/app/page.tsx index e06ab49..1a7330e 100644 --- a/app/(app)/app/page.tsx +++ b/app/(app)/app/page.tsx @@ -19,7 +19,7 @@ const FeaturedListsSection = dynamic( ); export default function Page() { return ( -
+
diff --git a/app/(app)/list/[naddr]/_components/ProfileInfo.tsx b/app/(app)/list/[naddr]/_components/ProfileInfo.tsx new file mode 100644 index 0000000..8595e7d --- /dev/null +++ b/app/(app)/list/[naddr]/_components/ProfileInfo.tsx @@ -0,0 +1,44 @@ +import Link from "next/link"; +import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar"; +import useProfile from "@/lib/hooks/useProfile"; +import { nip19 } from "nostr-tools"; +import { getTwoLetters, getNameToShow } from "@/lib/utils"; +import { Skeleton } from "@/components/ui/skeleton"; +import { HiMiniChevronRight, HiCheckBadge } from "react-icons/hi2"; + +type ProfileInfoProps = { + pubkey: string; +}; +export default function ProfileInfo({ pubkey }: ProfileInfoProps) { + const { profile } = useProfile(pubkey); + const npub = nip19.npubEncode(pubkey); + return ( + + + + + {getTwoLetters({ npub, profile })} + + +
+ {getNameToShow({ npub, profile })} + {!!profile?.nip05 && } +
+ + + ); +} + +export function LoadingProfileInfo() { + return ( +
+ +
+ +
+
+ ); +} diff --git a/app/(app)/list/[naddr]/page.tsx b/app/(app)/list/[naddr]/page.tsx index 57a4503..95bb3a4 100644 --- a/app/(app)/list/[naddr]/page.tsx +++ b/app/(app)/list/[naddr]/page.tsx @@ -10,7 +10,9 @@ import { getTwoLetters, truncateText } from "@/lib/utils"; import { nip19 } from "nostr-tools"; import useEvents from "@/lib/hooks/useEvents"; import Spinner from "@/components/spinner"; -import { getTagValues } from "@/lib/nostr/utils"; +import { getTagValues, getTagsValues } from "@/lib/nostr/utils"; +import ProfileInfo from "./_components/ProfileInfo"; +import Feed from "@/containers/Feed"; const demo = [ { @@ -51,11 +53,13 @@ export default function ListPage({ if (!event) { return ( -
+
); } + const noteIds = getTagsValues("e", event.tags).filter(Boolean); + const title = getTagValues("title", event.tags) ?? getTagValues("name", event.tags) ?? @@ -63,100 +67,55 @@ export default function ListPage({ const image = getTagValues("image", event.tags) ?? getTagValues("picture", event.tags) ?? - getTagValues("benner", event.tags); + getTagValues("banner", event.tags) ?? + profile?.banner; const description = getTagValues("description", event.tags); return ( -
-
-
-
-
-
- {!!profile?.banner && ( - banner - )} -
-
-
-
-
- {profile?.image ? ( +
+
+
+
+ {!!image && ( banner - ) : ( -
)}
- -
-
-
-

- {title} -

- {!!profile?.nip05 && ( - - )} +
+
+
+

+ {title} +

+
+ +
+
+
-
- {!!profile?.name &&

{profile.name}

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

{profile.nip05}

- - )} -
-
+ +
{!!description && ( -

+

{description}

)}
-
-
- {demo.map((e) => ( - - ))} -
-
- setActiveTab(t.name)} +
+
+
diff --git a/components/KindCard/components/ProfileHeader.tsx b/components/KindCard/components/ProfileHeader.tsx index eccbb17..20f016a 100644 --- a/components/KindCard/components/ProfileHeader.tsx +++ b/components/KindCard/components/ProfileHeader.tsx @@ -1,4 +1,4 @@ -import { Avatar, AvatarImage, AvatarFallback } from "@radix-ui/react-avatar"; +import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar"; import { HiCheckBadge } from "react-icons/hi2"; import Link from "next/link"; import useProfile from "@/lib/hooks/useProfile";