diff --git a/app/feed/page.tsx b/app/feed/page.tsx index 3bb6fcc..decd5ef 100644 --- a/app/feed/page.tsx +++ b/app/feed/page.tsx @@ -1,15 +1,9 @@ 'use client'; import Head from "next/head"; -import ProfileInfoCard from "@/components/ProfileInfoCard"; -import ProfileFeed from "@/components/ProfileFeed"; -import { useParams } from 'next/navigation' -import { nip19 } from "nostr-tools"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { SectionIcon, GridIcon } from '@radix-ui/react-icons' -import TagFeed from "@/components/TagFeed"; import FollowerFeed from "@/components/FollowerFeed"; -import ProfileQuickViewFeed from "@/components/ProfileQuickViewFeed"; import FollowerQuickViewFeed from "@/components/FollowerQuickViewFeed"; import { useEffect } from "react"; @@ -44,12 +38,12 @@ export default function FeedPage() { - + - + diff --git a/app/tag/[tag]/page.tsx b/app/tag/[tag]/page.tsx index 9407cb9..c2a8358 100644 --- a/app/tag/[tag]/page.tsx +++ b/app/tag/[tag]/page.tsx @@ -1,19 +1,17 @@ 'use client'; import Head from "next/head"; -import ProfileInfoCard from "@/components/ProfileInfoCard"; -import ProfileFeed from "@/components/ProfileFeed"; import { useParams } from 'next/navigation' -import { nip19 } from "nostr-tools"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { SectionIcon, GridIcon } from '@radix-ui/react-icons' import TagFeed from "@/components/TagFeed"; import { useEffect } from "react"; +import TagQuickViewFeed from "@/components/TagQuickViewFeed"; export default function Home() { const params = useParams() - let tag = params.tag + let tag = Array.isArray(params.tag) ? params.tag[0] : params.tag; useEffect(() => { document.title = `#${tag} | LUMINA`; @@ -35,8 +33,19 @@ export default function Home() { -
- +
+ + + + + + + + + + + +
); diff --git a/components/FollowerQuickViewFeed.tsx b/components/FollowerQuickViewFeed.tsx index 63ec9db..b9dba82 100644 --- a/components/FollowerQuickViewFeed.tsx +++ b/components/FollowerQuickViewFeed.tsx @@ -1,8 +1,7 @@ import { useRef, useState } from "react"; -import { useNostrEvents, dateToUnix } from "nostr-react"; +import { useNostrEvents } from "nostr-react"; import { Skeleton } from "@/components/ui/skeleton"; import { Button } from "@/components/ui/button"; -import QuickViewNoteCard from "./QuickViewNoteCard"; import QuickViewKind20NoteCard from "./QuickViewKind20NoteCard"; import { getImageUrl } from "@/utils/utils"; diff --git a/components/TagFeed.tsx b/components/TagFeed.tsx index 1b6744c..7e7297f 100644 --- a/components/TagFeed.tsx +++ b/components/TagFeed.tsx @@ -1,6 +1,5 @@ import { useRef } from "react"; -import { useNostrEvents, dateToUnix } from "nostr-react"; -import NoteCard from './NoteCard'; +import { useNostrEvents } from "nostr-react"; import KIND20Card from "./KIND20Card"; import { getImageUrl } from "@/utils/utils"; @@ -8,14 +7,14 @@ interface TagFeedProps { tag: string; } -const TagFeed: React.FC = ({tag}) => { +const TagFeed: React.FC = ({ tag }) => { const now = useRef(new Date()); // Make sure current time isn't re-rendered const { events } = useNostrEvents({ filter: { // since: dateToUnix(now.current), // all new events from now // since: 0, - // limit: 100, + limit: 20, kinds: [20], "#t": [tag], }, @@ -23,13 +22,14 @@ const TagFeed: React.FC = ({tag}) => { return ( <> -

Tag Feed for {tag}

- {events.map((event) => ( - //

{event.pubkey} posted: {event.content}

-
- -
- ))} +
+ {events.map((event) => ( + //

{event.pubkey} posted: {event.content}

+
+ +
+ ))} +
); } diff --git a/components/TagQuickViewFeed.tsx b/components/TagQuickViewFeed.tsx new file mode 100644 index 0000000..10bb8ce --- /dev/null +++ b/components/TagQuickViewFeed.tsx @@ -0,0 +1,37 @@ +import { useRef } from "react"; +import { useNostrEvents } from "nostr-react"; +import { getImageUrl } from "@/utils/utils"; +import QuickViewKind20NoteCard from "./QuickViewKind20NoteCard"; + +interface TagQuickViewFeedProps { + tag: string; +} + +const TagQuickViewFeed: React.FC = ({ tag }) => { + const now = useRef(new Date()); // Make sure current time isn't re-rendered + + const { events } = useNostrEvents({ + filter: { + // since: dateToUnix(now.current), // all new events from now + // since: 0, + limit: 20, + kinds: [20], + "#t": [tag], + }, + }); + + return ( + <> +
+ {events.map((event) => ( + //

{event.pubkey} posted: {event.content}

+
+ +
+ ))} +
+ + ); +} + +export default TagQuickViewFeed; \ No newline at end of file