diff --git a/app/(app)/app/_components/NewEventButton.tsx b/app/(app)/app/_components/NewEventButton.tsx new file mode 100644 index 0000000..ceab513 --- /dev/null +++ b/app/(app)/app/_components/NewEventButton.tsx @@ -0,0 +1,17 @@ +import { useModal } from "@/app/_providers/modal/provider"; +import NewEventModal from "@/components/Modals/NewEvent"; +import { RiAddFill } from "react-icons/ri"; +import { Button } from "@/components/ui/button"; + +export default function NewEventButton() { + const modal = useModal(); + return ( + + ); +} diff --git a/app/(app)/app/page.tsx b/app/(app)/app/page.tsx index 1a7330e..c19d0d8 100644 --- a/app/(app)/app/page.tsx +++ b/app/(app)/app/page.tsx @@ -1,10 +1,8 @@ import dynamic from "next/dynamic"; -import Link from "next/link"; import ExploreCreators from "./_sections/ExploreCreators"; import LongFormContentSection from "./_sections/LongFormContent"; import BecomeACreator from "./_sections/BecomeACreator"; -import { RiAddFill } from "react-icons/ri"; -import { Button } from "@/components/ui/button"; + const LiveStreamingSection = dynamic( () => import("./_sections/LiveStreaming"), { @@ -17,6 +15,10 @@ const FeaturedListsSection = dynamic( ssr: false, }, ); +const NewEventButton = dynamic(() => import("./_components/NewEventButton"), { + ssr: false, +}); + export default function Page() { return (
@@ -26,11 +28,7 @@ export default function Page() {
- - - +
); diff --git a/app/(app)/list/[naddr]/_components/Header.tsx b/app/(app)/list/[naddr]/_components/Header.tsx index 345f76d..44cea46 100644 --- a/app/(app)/list/[naddr]/_components/Header.tsx +++ b/app/(app)/list/[naddr]/_components/Header.tsx @@ -18,6 +18,7 @@ import { updateListUsersFromZaps, } from "@/lib/actions/zap"; import { useModal } from "@/app/_providers/modal/provider"; +import { type NDKEvent } from "@nostr-dev-kit/ndk"; const EditListModal = dynamic(() => import("@/components/Modals/EditList"), { ssr: false, @@ -26,7 +27,7 @@ const CreateEventModal = dynamic(() => import("@/components/Modals/NewEvent"), { ssr: false, }); -export default function Header({ naddr }: { naddr: string }) { +export default function Header({ event }: { event: NDKEvent }) { const { currentUser } = useCurrentUser(); const modal = useModal(); const { ndk } = useNDK(); @@ -34,30 +35,9 @@ export default function Header({ naddr }: { naddr: string }) { const [checkingPayment, setCheckingPayment] = useState(false); const [hasValidPayment, setHasValidPayment] = useState(false); const [syncingUsers, setSyncingUsers] = useState(false); - const { type, data } = nip19.decode(naddr); - console.log("PASSED", naddr, data); - if (type !== "naddr") { - throw new Error("Invalid list"); - } - const { identifier, kind, pubkey } = data; + const pubkey = event.pubkey; const { profile } = useProfile(pubkey); - const { events } = useEvents({ - filter: { - authors: [pubkey], - kinds: [kind], - ["#d"]: [identifier], - limit: 1, - }, - }); - const event = events[0]; - if (!event) { - return ( -
- -
- ); - } const noteIds = getTagsValues("e", event.tags).filter(Boolean); console.log("notes", event.tags); const title = @@ -86,14 +66,14 @@ export default function Header({ naddr }: { naddr: string }) { }, [isMember, currentUser]); async function handleCheckPayment() { - if (!event) return; + if (!event || !currentUser) return; setCheckingPayment(true); console.log("Checking payment"); try { const result = await checkPayment( ndk!, event.tagId(), - currentUser!.hexpubkey, + currentUser.pubkey, rawEvent, ); console.log("Payment result", result); @@ -119,6 +99,13 @@ export default function Header({ naddr }: { naddr: string }) { setSyncingUsers(false); } } + if (!event) { + return ( +
+ +
+ ); + } return (
diff --git a/app/(app)/list/[naddr]/page.tsx b/app/(app)/list/[naddr]/page.tsx index 29c2945..5817127 100644 --- a/app/(app)/list/[naddr]/page.tsx +++ b/app/(app)/list/[naddr]/page.tsx @@ -50,7 +50,7 @@ export default function ListPage({ return (
-
+