diff --git a/src/app/hack/[slug]/actions.ts b/src/app/hack/[slug]/actions.ts index 05786b1..44e6503 100644 --- a/src/app/hack/[slug]/actions.ts +++ b/src/app/hack/[slug]/actions.ts @@ -43,6 +43,7 @@ export interface HackMetadata { username: string | null; avatar_url: string | null; verified: boolean; + email: string | null; } | null; otherHacks: { slug: string; @@ -104,10 +105,17 @@ export async function getHackMetadata(slug: string): Promise )} + {isAdmin && profile?.email && ( + + + Contact creator + + )} diff --git a/src/components/Hack/HackOptionsMenu.tsx b/src/components/Hack/HackOptionsMenu.tsx index 98efdc7..042fac1 100644 --- a/src/components/Hack/HackOptionsMenu.tsx +++ b/src/components/Hack/HackOptionsMenu.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { useState } from "react"; +import React, { useMemo, useState } from "react"; import { FiMoreVertical, FiEdit2, FiBarChart2 } from "react-icons/fi"; import { TbVersions } from "react-icons/tb"; import { Menu, MenuButton, MenuItem, MenuItems, MenuSeparator } from "@headlessui/react"; @@ -21,6 +21,10 @@ export default function HackOptionsMenu({ }: HackOptionsMenuProps) { const [showReportModal, setShowReportModal] = useState(false); + const hasRenderableChildren = useMemo(() => { + return React.Children.toArray(children).some(Boolean); + }, [children]); + return ( <> @@ -91,7 +95,7 @@ export default function HackOptionsMenu({ Manage versions )} - {children && <> + {hasRenderableChildren && <> {children} }