import { useCallback, useEffect } from "react"; import { Listbox, ListboxItem } from "@nextui-org/listbox"; import useContextMenuStore from "@/hooks/useContextMenuStore"; import { Component } from "@/typings/component"; const Menu: Component = () => { const shouldShow = useContextMenuStore((state) => state.show); const menu = useContextMenuStore((state) => state.items); const hide = useContextMenuStore((state) => state.hide); const location = useContextMenuStore((state) => state.location); const handleClick = useCallback(() => { if (shouldShow) hide(); }, [hide, shouldShow]); useEffect(() => { window.addEventListener("click", handleClick); return () => { window.removeEventListener("click", handleClick); }; }, [handleClick]); return (