diff --git a/app/(app)/(profile)/[npub]/page.tsx b/app/(app)/(profile)/[npub]/page.tsx index 29f3a28..807d82f 100644 --- a/app/(app)/(profile)/[npub]/page.tsx +++ b/app/(app)/(profile)/[npub]/page.tsx @@ -18,7 +18,13 @@ export default function ProfilePage({ }; }) { const [activeTab, setActiveTab] = useState("feed"); - const pubkey = nip19.decode(npub).data.toString(); + console.log("calling with ", npub); + const { type, data } = nip19.decode(npub); + console.log("RES", data); + if (type !== "npub") { + throw new Error("Invalid list"); + } + const pubkey = data.toString(); const { profile } = useProfile(pubkey); const demo = [ diff --git a/app/(app)/(profile)/layout.tsx b/app/(app)/(profile)/layout.tsx new file mode 100644 index 0000000..9507d26 --- /dev/null +++ b/app/(app)/(profile)/layout.tsx @@ -0,0 +1,15 @@ +import { redirect } from "next/navigation"; +import { nip19 } from "nostr-tools"; + +export default function Layout(props: { + children: React.ReactNode; + params: { + npub?: string; + }; +}) { + const key = props.params.npub; + if (key === "service-worker.js") { + redirect("/"); + } + return props.children; +} diff --git a/app/(app)/_layout/Sidebar.tsx b/app/(app)/_layout/Sidebar.tsx index 2633a2d..d09c499 100644 --- a/app/(app)/_layout/Sidebar.tsx +++ b/app/(app)/_layout/Sidebar.tsx @@ -19,10 +19,15 @@ import { TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; -import ZapPicker from "@/components/Modals/ZapPicker"; +import dynamic from "next/dynamic"; import { useModal } from "@/app/_providers/modal/provider"; import { IconType } from "react-icons"; - +const ZapPickerModal = dynamic(() => import("@/components/Modals/ZapPicker"), { + ssr: false, +}); +const NewEventModal = dynamic(() => import("@/components/Modals/NewEvent"), { + ssr: false, +}); type NavigationLink = { type: "link"; href: string; @@ -71,7 +76,7 @@ export default function Sidebar() { active: false, }, { - onClick: () => modal?.show(), + onClick: () => modal?.show(), name: "zap", label: "Zap Flockstr", icon: HiOutlineLightningBolt, @@ -192,14 +197,14 @@ export default function Sidebar() { })}
+ +
+
+
+

+ {title} +

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

{profile.name}

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

{profile.nip05}

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

+ {description} +

+ )} +
+
+ +
+
+ {demo.map((e) => ( + + ))} +
+
+ setActiveTab(t.name)} + /> +
+
+ + ); +} diff --git a/app/_providers/modal/provider.tsx b/app/_providers/modal/provider.tsx index 07407bd..d5132ed 100644 --- a/app/_providers/modal/provider.tsx +++ b/app/_providers/modal/provider.tsx @@ -21,6 +21,7 @@ type ModalProps = ReactElement | Modals; type ModalContextProps = { show: (content: ModalProps) => void; + swap: (content: ModalProps) => void; hide: () => void; }; @@ -40,6 +41,13 @@ export function ModalProvider({ children }: { children: ReactNode }) { setShowModal(true); }; + const swap = (content: ModalProps) => { + hide(); + setTimeout(() => { + show(content); + }, 300); + }; + const hide = () => { setShowModal(false); setTimeout(() => { @@ -48,7 +56,7 @@ export function ModalProvider({ children }: { children: ReactNode }) { }; return ( - + {children} {showModal && ( diff --git a/components/Modals/NewEvent.tsx b/components/Modals/NewEvent.tsx new file mode 100644 index 0000000..ec59a45 --- /dev/null +++ b/components/Modals/NewEvent.tsx @@ -0,0 +1,47 @@ +"use client"; +import { useState, useRef, useEffect } from "react"; +import Link from "next/link"; +import Template from "./Template"; +import { Button } from "@/components/ui/button"; +import { useModal } from "@/app/_providers/modal/provider"; +import { nip19 } from "nostr-tools"; +// import { useKeys } from "@/app/_providers/keysProvider"; +import { useNDK } from "@/app/_providers/ndk"; +import useCurrentUser from "@/lib/hooks/useCurrentUser"; +import { + HiChatBubbleLeftEllipsis, + HiBookmarkSquare, + HiNewspaper, +} from "react-icons/hi2"; +import { RiSubtractFill, RiAddFill } from "react-icons/ri"; +import { formatCount } from "@/lib/utils"; +import LoginModal from "./Login"; + +export default function NewEventModal() { + const modal = useModal(); + return ( + + ); +}