MCPcopy
hub / github.com/tone-row/flowchart-fun / Actions

Function Actions

app/src/components/Actions.tsx:15–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13import { globalZ } from "../lib/globalZ";
14
15export function Actions() {
16 const hasProAccess = useHasProAccess();
17 const isSandbox = useLocation().pathname === "/";
18 const [open, setOpen] = useState(false);
19 useEffect(() => {
20 // when open, bind a listener to the window that catches clicks which bubble up from the editor-options dropdown
21 if (!open) return;
22 const listener = (e: MouseEvent) => {
23 const target = e.target as HTMLElement;
24 if (target.closest("#editor-options")) {
25 // debugger;
26 // setOpen(false);
27 }
28 };
29
30 window.addEventListener("click", listener);
31
32 return () => {
33 window.removeEventListener("click", listener);
34 };
35 }, [setOpen, open]);
36 return (
37 <>
38 <div className="hidden md:flex justify-start w-full gap-x-2 items-center whitespace-nowrap flex-wrap py-2">
39 <LoadTemplateDialog />
40 <LearnSyntaxDialog />
41 {isSandbox ? <LoadFileButton /> : null}
42 {hasProAccess ? (
43 <ImportDataDialog />
44 ) : (
45 <ImportDataUnauthenticatedDialog />
46 )}
47 </div>
48 <DropdownMenu.Root open={open} onOpenChange={setOpen}>
49 <DropdownMenu.Trigger asChild>
50 <button className="md:hidden mr-1 rounded flex self-center items-center justify-center w-8 h-8 bg-neutral-300 hover:bg-neutral-400 focus:outline-none">
51 <Sliders size={24} />
52 </button>
53 </DropdownMenu.Trigger>
54 <DropdownMenu.Content
55 align="end"
56 className={classNames(
57 "min-w-[220px] bg-white rounded-md shadow-xl select-none p-2",
58 globalZ.actionDropdownMobile
59 )}
60 id="editor-options"
61 >
62 <LoadTemplateDialog />
63 <LearnSyntaxDialog />
64 {isSandbox ? <LoadFileButton /> : null}
65 {hasProAccess ? (
66 <ImportDataDialog />
67 ) : (
68 <ImportDataUnauthenticatedDialog />
69 )}
70 </DropdownMenu.Content>
71 </DropdownMenu.Root>
72 </>

Callers

nothing calls this directly

Calls 1

useHasProAccessFunction · 0.90

Tested by

no test coverage detected