From b84845eade8083d25fcb94b05164d1b8b71ed9ae Mon Sep 17 00:00:00 2001 From: zmeyer44 Date: Wed, 25 Oct 2023 15:15:56 -0400 Subject: [PATCH] event page upgrades --- .../_components/AnnouncementsContainer.tsx | 43 +++++- .../_components/DiscussionContainer.tsx | 48 +++++++ app/(app)/event/[naddr]/page.tsx | 11 +- app/globals.css | 3 + components/KindCard/components/Container.tsx | 6 +- .../KindCard/components/ProfileHeader.tsx | 6 +- components/Modals/BareTemplate.tsx | 32 +++++ components/Modals/CreateCalendarEvent.tsx | 2 +- components/Modals/FormModal.tsx | 2 +- components/Modals/Kind1.tsx | 129 ++++++++++++++++++ lib/hooks/useImageUpload.tsx | 39 ++++++ 11 files changed, 306 insertions(+), 15 deletions(-) create mode 100644 app/(app)/event/[naddr]/_components/DiscussionContainer.tsx create mode 100644 components/Modals/BareTemplate.tsx create mode 100644 components/Modals/Kind1.tsx diff --git a/app/(app)/event/[naddr]/_components/AnnouncementsContainer.tsx b/app/(app)/event/[naddr]/_components/AnnouncementsContainer.tsx index 603adce..d4449a6 100644 --- a/app/(app)/event/[naddr]/_components/AnnouncementsContainer.tsx +++ b/app/(app)/event/[naddr]/_components/AnnouncementsContainer.tsx @@ -1,26 +1,59 @@ +"use client"; import { HiSignal } from "react-icons/hi2"; +import { RiAddFill } from "react-icons/ri"; +import { Button } from "@/components/ui/button"; import Feed from "@/containers/Feed"; +import CreateKind1Modal from "@/components/Modals/Kind1"; + +import useCurrentUser from "@/lib/hooks/useCurrentUser"; +import { useModal } from "@/app/_providers/modal/provider"; type AnnouncementsContainerProps = { eventReference: string; + hosts: string[]; }; export default function AnnouncementsContainer({ eventReference, + hosts, }: AnnouncementsContainerProps) { + const modal = useModal(); + + const { currentUser } = useCurrentUser(); return (
-
- -

Announcements

+
+
+ +

Announcements

+
+ {currentUser && hosts.includes(currentUser.pubkey) && ( + + )}
( -
+

No Announcements yet

)} diff --git a/app/(app)/event/[naddr]/_components/DiscussionContainer.tsx b/app/(app)/event/[naddr]/_components/DiscussionContainer.tsx new file mode 100644 index 0000000..b53eb3c --- /dev/null +++ b/app/(app)/event/[naddr]/_components/DiscussionContainer.tsx @@ -0,0 +1,48 @@ +"use client"; +import { HiOutlineChatBubbleLeftRight } from "react-icons/hi2"; +import { RiAddFill } from "react-icons/ri"; +import { Button } from "@/components/ui/button"; +import Feed from "@/containers/Feed"; +import CreateKind1Modal from "@/components/Modals/Kind1"; +import { useModal } from "@/app/_providers/modal/provider"; + +type DiscussionContainerProps = { + eventReference: string; +}; +export default function DiscussionContainer({ + eventReference, +}: DiscussionContainerProps) { + const modal = useModal(); + return ( +
+
+
+ +

Discussion

+
+ +
+
+ ( +
+

No Notes yet

+
+ )} + /> +
+
+ ); +} diff --git a/app/(app)/event/[naddr]/page.tsx b/app/(app)/event/[naddr]/page.tsx index b14ec45..c2d7364 100644 --- a/app/(app)/event/[naddr]/page.tsx +++ b/app/(app)/event/[naddr]/page.tsx @@ -17,6 +17,7 @@ import LocationPreview from "@/components/LocationPreview"; import HostsContainer from "./_components/HostsContainer"; import LocationContainer from "./_components/LocationContainer"; import AnnouncementsContainer from "./_components/AnnouncementsContainer"; +import DiscussionContainer from "./_components/DiscussionContainer"; import AttendeesContainer from "./_components/AttendeesContainer"; export default function EventPage({ @@ -50,7 +51,7 @@ export default function EventPage({ } const { tags } = event; const eventReference = event.encode(); - const noteIds = getTagsValues("e", tags).filter(Boolean); + const location = getTagAllValues("location", tags)[0] ? getTagAllValues("location", tags) : getTagAllValues("address", tags); @@ -77,8 +78,12 @@ export default function EventPage({
-
- +
+ +
diff --git a/app/globals.css b/app/globals.css index ee75d34..b2d3d42 100644 --- a/app/globals.css +++ b/app/globals.css @@ -122,6 +122,9 @@ .center { @apply flex items-center justify-center; } + .invisible-input { + @apply resize-none break-words !rounded-none !border-0 !bg-transparent !p-0 text-foreground !shadow-none !outline-none placeholder:text-muted/20 focus-visible:!ring-0; + } } input[type="time"]::-webkit-calendar-picker-indicator { background: none; diff --git a/components/KindCard/components/Container.tsx b/components/KindCard/components/Container.tsx index f58ef92..ae100a2 100644 --- a/components/KindCard/components/Container.tsx +++ b/components/KindCard/components/Container.tsx @@ -75,8 +75,10 @@ export default function Container({ )}
- {!!createdAt && - formatDate(new Date(createdAt * 1000), "MMM Do, h:mm a")} + + {!!createdAt && + formatDate(new Date(createdAt * 1000), "MMM Do, h:mm a")} + + {children} +
+ ); +} diff --git a/components/Modals/CreateCalendarEvent.tsx b/components/Modals/CreateCalendarEvent.tsx index 182d1fe..745b607 100644 --- a/components/Modals/CreateCalendarEvent.tsx +++ b/components/Modals/CreateCalendarEvent.tsx @@ -176,7 +176,7 @@ export default function CreateCalendarEventModal() { onChange={(e) => setTitle(e.target.value)} placeholder="Event Name" className={cn( - "resize-none break-words border-0 bg-transparent p-0 !text-3xl font-bold text-foreground shadow-none outline-none placeholder:text-muted-foreground/50 placeholder:hover:text-muted-foreground/80 focus-visible:ring-0", + "invisible-input !text-3xl font-bold text-foreground outline-none placeholder:text-muted-foreground/50 placeholder:hover:text-muted-foreground/80", title === "" && "max-h-[60px]", )} /> diff --git a/components/Modals/FormModal.tsx b/components/Modals/FormModal.tsx index f08ac52..5452d2b 100644 --- a/components/Modals/FormModal.tsx +++ b/components/Modals/FormModal.tsx @@ -131,7 +131,7 @@ export default function FormModal({ }); const { watch, setValue } = form; return ( -