diff --git a/app/(app)/(profile)/[npub]/page.tsx b/app/(app)/(profile)/[npub]/page.tsx index 2849b23..29f3a28 100644 --- a/app/(app)/(profile)/[npub]/page.tsx +++ b/app/(app)/(profile)/[npub]/page.tsx @@ -42,9 +42,7 @@ export default function ProfilePage({ {!!profile?.banner && ( banner {profile?.image ? ( profile picture - {events.map((e) => { - const event = e.rawEvent() as Event; - return ( - - - - ); - })} + {events?.length ? ( + events.map((e) => { + const event = e.rawEvent() as Event; + return ( + + + + ); + }) + ) : ( + <> + + + + + + )} ); diff --git a/app/(app)/article/[eventId]/page.tsx b/app/(app)/article/[eventId]/page.tsx deleted file mode 100644 index 398f4e3..0000000 --- a/app/(app)/article/[eventId]/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -"use client"; -import Article from "@/containers/Article"; - -export default function ArticlePage({ - params: { eventId }, -}: { - params: { - eventId: string; - }; -}) { - return
; -} diff --git a/app/(app)/article/[eventId]/layout.tsx b/app/(app)/article/[naddr]/layout.tsx similarity index 100% rename from app/(app)/article/[eventId]/layout.tsx rename to app/(app)/article/[naddr]/layout.tsx diff --git a/app/(app)/article/[naddr]/page.tsx b/app/(app)/article/[naddr]/page.tsx new file mode 100644 index 0000000..7c5d463 --- /dev/null +++ b/app/(app)/article/[naddr]/page.tsx @@ -0,0 +1,39 @@ +"use client"; +import { useEffect } from "react"; +import Article from "@/containers/Article"; +import { useNDK } from "@nostr-dev-kit/ndk-react"; +import { nip19 } from "nostr-tools"; +import Spinner from "@/components/spinner"; +import useEvents from "@/lib/hooks/useEvents"; +export default function ArticlePage({ + params: { naddr }, +}: { + params: { + naddr: string; + }; +}) { + const { ndk } = useNDK(); + const { data, type } = nip19.decode(naddr); + const { events } = useEvents({ + filter: + type === "naddr" + ? { + kinds: [data.kind], + authors: [data.pubkey], + ["#d"]: [data.identifier], + limit: 1, + } + : {}, + }); + + if (events?.[0]) { + return
; + } + + return ( +
+ + {events.length} +
+ ); +} diff --git a/components/CreatorCard/index.tsx b/components/CreatorCard/index.tsx index d0c83c4..4e0ecdb 100644 --- a/components/CreatorCard/index.tsx +++ b/components/CreatorCard/index.tsx @@ -19,6 +19,7 @@ type CreatorCardProps = { id: string; title: string; summary: string; + href: string; }[]; }; @@ -39,7 +40,11 @@ export default function CreatorCard({
- {getNameToShow({ profile, npub })} + + + {getNameToShow({ profile, npub })} + + {profile?.about} @@ -65,7 +70,7 @@ export default function CreatorCard({ {recentWork.map((item) => (
  • diff --git a/components/KindCard/30023.tsx b/components/KindCard/30023.tsx index 7b839c2..f4e7ea0 100644 --- a/components/KindCard/30023.tsx +++ b/components/KindCard/30023.tsx @@ -14,7 +14,7 @@ export default function Kind30023({ content, pubkey, tags }: Event) { return ( - + {title} diff --git a/components/KindCard/components/Container.tsx b/components/KindCard/components/Container.tsx index 3d48f26..ec35ade 100644 --- a/components/KindCard/components/Container.tsx +++ b/components/KindCard/components/Container.tsx @@ -37,7 +37,7 @@ export default function Container({ actionOptions = [], }: CreatorCardProps) { return ( - +
    @@ -53,14 +53,16 @@ export default function Container({
    - + {children} - {!!contentTags?.length && ( -
    - -
    - )} - +
    + {!!contentTags?.length && ( +
    + +
    + )} + +
    ); diff --git a/components/KindCard/components/ProfileHeader.tsx b/components/KindCard/components/ProfileHeader.tsx index bcfcfe4..2c2413f 100644 --- a/components/KindCard/components/ProfileHeader.tsx +++ b/components/KindCard/components/ProfileHeader.tsx @@ -19,12 +19,34 @@ export default function ProfileHeader({ pubkey }: ProfileHeaderProps) { {getTwoLetters({ npub, profile })} -
    - - {getNameToShow({ npub, profile })} - - {!!profile?.nip05 && } -
    + {profile?.displayName || profile?.name ? ( +
    +
    + + {getNameToShow({ npub, profile })} + + {!!profile?.nip05 && ( + + )} +
    +
    + {!!profile.nip05 && ( + + {profile.nip05} + + )} +
    +
    + ) : ( +
    + + {getNameToShow({ npub, profile })} + + {!!profile?.nip05 && ( + + )} +
    + )} ); } diff --git a/components/KindCard/loading.tsx b/components/KindCard/loading.tsx new file mode 100644 index 0000000..872ed78 --- /dev/null +++ b/components/KindCard/loading.tsx @@ -0,0 +1,21 @@ +import Container from "./components/Container"; +import { CardTitle, CardDescription } from "@/components/ui/card"; +import { type Event } from "nostr-tools"; +import { Skeleton } from "@/components/ui/skeleton"; + +export default function KindLoading() { + return ( + +
    + + + + +
    +
    + ); +} diff --git a/components/LongForm/index.tsx b/components/LongForm/index.tsx index c083ecf..7862f1d 100644 --- a/components/LongForm/index.tsx +++ b/components/LongForm/index.tsx @@ -12,7 +12,6 @@ type MarkdoneProps = { }; export default function Markdown({ content }: MarkdoneProps) { const { resolvedTheme } = useTheme(); - // const [blocks, setBlocks] = useState(); const [loading, setLoading] = useState(true); const editor: BlockNoteEditor = useBlockNote({ @@ -22,12 +21,10 @@ export default function Markdown({ content }: MarkdoneProps) { useEffect(() => { if (editor) { if (content) { - console.log("initial md", content); // Whenever the current Markdown content changes, converts it to an array // of Block objects and replaces the editor's content with them. const getBlocks = async () => { const blocks: Block[] = await editor.markdownToBlocks(content); - console.log("Blocks", blocks); editor.replaceBlocks(editor.topLevelBlocks, blocks); setLoading(false); }; @@ -41,7 +38,7 @@ export default function Markdown({ content }: MarkdoneProps) { if (loading) { return ( -
    +
    ); diff --git a/constants/app.ts b/constants/app.ts index ea88e26..f34c42d 100644 --- a/constants/app.ts +++ b/constants/app.ts @@ -1,11 +1,11 @@ export const EXPLORE_CREATORS = [ "npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s", + "npub1l2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqutajft", "npub1u6qhg5ucu3xza4nlz94q90y720tr6l09avnq8y3yfp5qrv9v8sus3tnd7t", "npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m", "npub19mduaf5569jx9xz555jcx3v06mvktvtpu0zgk47n4lcpjsz43zzqhj6vzk", "npub1dc9p7jzjhj86g2uqgltq4qvnpkyfqn9r72kdlddcgyat3j05gnjsgjc8rz", "npub1qny3tkh0acurzla8x3zy4nhrjz5zd8l9sy9jys09umwng00manysew95gx", - "npub1l2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqutajft", ]; export const BANNER = diff --git a/constants/relays.ts b/constants/relays.ts index e13c501..2bb123b 100644 --- a/constants/relays.ts +++ b/constants/relays.ts @@ -1,7 +1,7 @@ export const RELAYS = [ - "wss://nostr.pub.wellorder.net", - "wss://nostr.drss.io", - "wss://nostr.swiss-enigma.ch", - "wss://relay.damus.io", + "wss://nostr.mom", + "wss://nos.lol", "wss://nostr.wine", + "wss://relay.damus.io", + "wss://nostr.swiss-enigma.ch", ]; diff --git a/containers/Article/index.tsx b/containers/Article/index.tsx index 000b7b1..609731d 100644 --- a/containers/Article/index.tsx +++ b/containers/Article/index.tsx @@ -7,56 +7,46 @@ import { Avatar, AvatarImage, AvatarFallback } from "@radix-ui/react-avatar"; import { useRouter } from "next/navigation"; import { formatDate } from "@/lib/utils/dates"; import Actions from "./Actions"; -import Logo from "@/assets/Logo"; +import { NDKEvent } from "@nostr-dev-kit/ndk"; +import { getTagAllValues, getTagValues } from "@/lib/nostr/utils"; +import useProfile from "@/lib/hooks/useProfile"; +import { nip19 } from "nostr-tools"; +import { getNameToShow, getTwoLetters } from "@/lib/utils"; -export default function ArticlePage() { +type ArticleProps = { + event: NDKEvent; +}; + +export default function ArticlePage({ event }: ArticleProps) { const Viewer = useMemo( () => dynamic(() => import("@/components/LongForm"), { ssr: false }), [], ); + console.log(event); const router = useRouter(); - const markdown = `Do you have any thoughts of YakiHonne? Share it and earn SATs! - - Comment2Earn | Earn SATs by sharing your comments on YakiHonne - - Earn SATs by sharing your comments on YakiHonne. - - ⏰2nd - 15th Oct - - ### Follow Us - - - Nostr: npub1yzvxlwp7wawed5vgefwfmugvumtp8c8t0etk3g8sky4n0ndvyxesnxrf8q - - Twitter: https://twitter.com/YakiHonne - - Facebook Profile: https://www.facebook.com/profi…1715056704 - - Facebook Page: https://www.facebook.com/profi…2076811240 - - Facebook Group: https://www.facebook.com/group…4539860115 - - Youtube: https://www.youtube.com/channe…f4EyFJ7BlA - - ### How to Get SATs: - 1. Post your thoughts about YakiHonne on at least one of the above social media, and be sure to @ YakiHonne. - 2. Follow YakiHonne on at least one of the social media above. - 3. Back to this article, leave your social account which followed YakiHonne in the Comments. - 4. Be zapped with SATs. - - ### What You Will Get: - 1. 500 SATs, if you finished all steps. - 2. 1000 SATs, if you finished all steps and`; + const markdown = event.content; + const pubkey = event.pubkey; + const createdAt = getTagValues("published_at", event.tags) + ? parseInt(getTagValues("published_at", event.tags) as string) + : event.created_at; + const { profile } = useProfile(pubkey); + const npub = nip19.npubEncode(pubkey); + const title = getTagValues("title", event.tags); + const summary = getTagValues("summary", event.tags); + const tags = getTagAllValues("t", event.tags); return (
    - - SC + + + {getTwoLetters({ profile, npub })} + - Derek Seivers + {getNameToShow({ profile, npub })}
    + {tags.map((t) => ( + + ))} +
    - - {formatDate(new Date("10-2-22"), "MMMM Do, YYYY")} - + {!!createdAt && ( + + {formatDate(new Date(createdAt * 1000), "MMMM Do, YYYY")} + + )}
    -

    - This is the large title for the article. It's time to take over. -

    +

    {title}

    -

    - Here is a short summary for the article that you are about to - start reading. Get ready to really enojy your self. -

    +

    {summary}