diff --git a/app/(app)/_layout/Header.tsx b/app/(app)/_layout/Header.tsx index 83064fd..abda113 100644 --- a/app/(app)/_layout/Header.tsx +++ b/app/(app)/_layout/Header.tsx @@ -1,7 +1,10 @@ -import { Search } from "./components/Search"; import AuthActions from "./components/AuthActions"; import Logo from "@/assets/Logo"; +import dynamic from "next/dynamic"; +const Search = dynamic(() => import("./components/Search"), { + ssr: false, +}); export default function Header() { return (
diff --git a/app/(app)/_layout/Sidebar.tsx b/app/(app)/_layout/Sidebar.tsx index 6c010e2..80c5ad8 100644 --- a/app/(app)/_layout/Sidebar.tsx +++ b/app/(app)/_layout/Sidebar.tsx @@ -43,6 +43,19 @@ type NavigationElement = { current: boolean; active: boolean; } & (NavigationLink | NavigationButton); +const flockstrEvent = { + created_at: 1697736945, + content: + "Officially announcing Flockstr. Check it out at https://flockstr.com", + tags: [ + ["r", "https://flockstr.com"], + ["client", "flockstr"], + ], + kind: 1, + pubkey: "17717ad4d20e2a425cda0a2195624a0a4a73c4f6975f16b1593fc87fa46f2d58", + id: "a867ff28711eeab4767fb6bacbb33dfe17b2b5bbbff98f8e57f90a85ea684b0a", + sig: "37d8918e6da88d989467021a1f5809a3fbcab941ca1044d109ce261f29270d2d545aaa84297b7f224ae1ad7760263e50c317c24abc809034bcdb5c3260faf4b0", +}; export default function Sidebar() { const modal = useModal(); @@ -76,7 +89,7 @@ export default function Sidebar() { active: false, }, { - onClick: () => modal?.show(), + onClick: () => modal?.show(), name: "zap", label: "Zap Flockstr", icon: HiOutlineLightningBolt, diff --git a/app/(app)/_layout/components/CommandDialog.tsx b/app/(app)/_layout/components/CommandDialog.tsx new file mode 100644 index 0000000..9eb87bc --- /dev/null +++ b/app/(app)/_layout/components/CommandDialog.tsx @@ -0,0 +1,70 @@ +"use client"; + +import { useKeyboardShortcut } from "@/lib/hooks/useKeyboardShortcut"; +import { + CalendarIcon, + EnvelopeClosedIcon, + FaceIcon, + GearIcon, + PersonIcon, + RocketIcon, +} from "@radix-ui/react-icons"; +import { + CommandDialog, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, + CommandSeparator, + CommandShortcut, +} from "@/components/ui/command"; +import { atom, useAtom } from "jotai"; + +export const commandDialogAtom = atom(false); + +export default function CommandDialogComponent() { + const [open, setOpen] = useAtom(commandDialogAtom); + useKeyboardShortcut(["ctrl", "k"], () => setOpen((open) => !open)); + + return ( + + + + No results found. + + + + Calendar + + + + Search Emoji + + + + Launch + + + + + + + Profile + ⌘P + + + + Mail + ⌘B + + + + Settings + ⌘S + + + + + ); +} diff --git a/app/(app)/_layout/components/Search.tsx b/app/(app)/_layout/components/Search.tsx index 87b8c20..d106856 100644 --- a/app/(app)/_layout/components/Search.tsx +++ b/app/(app)/_layout/components/Search.tsx @@ -1,12 +1,17 @@ -import { Input } from "@/components/ui/input"; +"use client"; -export function Search() { +import { Input } from "@/components/ui/input"; +import { commandDialogAtom } from "./CommandDialog"; +import { useAtom } from "jotai"; +export default function Search() { + const [open, setOpen] = useAtom(commandDialogAtom); return (
setOpen(true)} />
); diff --git a/app/(app)/_layout/index.tsx b/app/(app)/_layout/index.tsx index 48ce7d4..fb75fa7 100644 --- a/app/(app)/_layout/index.tsx +++ b/app/(app)/_layout/index.tsx @@ -3,7 +3,11 @@ import Header from "./Header"; import Keystone from "./Keystone"; import MobileBanner from "./MobileBanner"; import Sidebar from "./Sidebar"; +import dynamic from "next/dynamic"; +const CommandDialog = dynamic(() => import("./components/CommandDialog"), { + ssr: false, +}); export default function AppLayout({ children }: { children: React.ReactNode }) { return (
@@ -23,6 +27,7 @@ export default function AppLayout({ children }: { children: React.ReactNode }) { {/* BottomNav */} +
); } diff --git a/bun.lockb b/bun.lockb index d0f3575..d56a77b 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/KindCard/1.tsx b/components/KindCard/1.tsx index 320e872..2e976eb 100644 --- a/components/KindCard/1.tsx +++ b/components/KindCard/1.tsx @@ -15,8 +15,6 @@ export default function Kind1(props: Event) { return ( ; } return ( - +
diff --git a/components/KindCard/components/Actions.tsx b/components/KindCard/components/Actions.tsx index 9cd3f22..275ab31 100644 --- a/components/KindCard/components/Actions.tsx +++ b/components/KindCard/components/Actions.tsx @@ -1,11 +1,21 @@ +"use client"; + import { Button } from "@/components/ui/button"; import { HiOutlineHandThumbUp, HiOutlineChatBubbleLeftEllipsis, } from "react-icons/hi2"; import { HiOutlineLightningBolt } from "react-icons/hi"; +import ZapPicker from "@/components/Modals/ZapPicker"; +import { useModal } from "@/app/_providers/modal/provider"; +import { NostrEvent } from "@nostr-dev-kit/ndk"; +import { stopPropagation } from "@/lib/utils"; -export default function Actions() { +type ActionProps = { + event: NostrEvent; +}; +export default function Actions({ event }: ActionProps) { + const modal = useModal(); return (
@@ -17,7 +27,15 @@ export default function Actions() {
- diff --git a/components/KindCard/components/Container.tsx b/components/KindCard/components/Container.tsx index 713896a..0e7fb48 100644 --- a/components/KindCard/components/Container.tsx +++ b/components/KindCard/components/Container.tsx @@ -7,10 +7,12 @@ import { formatDate } from "@/lib/utils/dates"; import { Button } from "@/components/ui/button"; import { ReactNode } from "react"; import ProfileHeader, { LoadingProfileHeader } from "./ProfileHeader"; +import { getTagValues, getTagsValues } from "@/lib/nostr/utils"; import Actions from "./Actions"; import Tags from "./Tags"; import DropDownMenu from "@/components/DropDownMenu"; - +import { NostrEvent } from "@nostr-dev-kit/ndk"; +import { removeDuplicates } from "@/lib/utils"; type OptionLink = { href: string; type: "link"; @@ -24,25 +26,54 @@ type Option = { } & (OptionLink | OptionButton); type CreatorCardProps = { - pubkey?: string; - contentTags?: string[]; - createdAt?: number; children: ReactNode; actionOptions?: Option[]; + event?: NostrEvent; }; export default function Container({ children, - createdAt, - contentTags, - pubkey, actionOptions = [], + event, }: CreatorCardProps) { + if (!event) { + return ( + + + +
+ + + +
+
+ + {children} +
+
+
+ ); + } + const { pubkey, tags, created_at: createdAt } = event; + const contentTags = removeDuplicates(getTagsValues("t", tags)).filter( + Boolean, + ); + return ( - + { + console.log("CLICK IN CONTAINER"); + }} + className="relative flex h-full w-full flex-col overflow-hidden @container" + > {pubkey ? : } -
{!!createdAt && formatDate(new Date(createdAt * 1000), "MMM Do, h:mm a")} @@ -68,7 +99,7 @@ export default function Container({
)}
- +
diff --git a/components/KindCard/default.tsx b/components/KindCard/default.tsx index 555b01b..c37d7a1 100644 --- a/components/KindCard/default.tsx +++ b/components/KindCard/default.tsx @@ -16,8 +16,7 @@ export default function KindDefault(props: Event) { return ( { @@ -48,6 +46,18 @@ export default function ZapPicker() { }); } + async function handleSendZap() { + try { + setIsLoading(true); + const result = await sendZap(ndk!, sats, event, note); + toast.success("Zap Sent!"); + } catch (err) { + console.log("error sending zap", err); + } finally { + setIsLoading(false); + } + } + return (