import { useId, useRef, useState } from "react"; import { MoreIcon } from "@/components/icons"; import { blueskyPostUrl, sitePostUrl } from "@/lib/bluesky/urls"; import { usePopoverMenu } from "@/lib/popover-menu"; export default function PostLinkMenu({ uri }: { uri: string }) { const [notice, setNotice] = useState(""); const trigger = useRef(null); const panel = useRef(null); const id = useId(); const open = usePopoverMenu(trigger, panel); async function copy(url: string) { try { await navigator.clipboard.writeText(url); setNotice("Link copied."); panel.current?.hidePopover(); trigger.current?.focus(); } catch { setNotice("Could not copy the link. Use the post link below."); } } return (
Open this post
{notice}
); }