From a34efd6c6bb6199da59b096196a97495b32d0c1f Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Fri, 26 Jul 2024 12:51:15 +0100 Subject: feat(gui): folder select dialogue for directory block (#2315) --- .../runbooks/editor/blocks/Directory/index.tsx | 56 +++++++++++++++------- 1 file changed, 40 insertions(+), 16 deletions(-) (limited to 'ui/src/components/runbooks') diff --git a/ui/src/components/runbooks/editor/blocks/Directory/index.tsx b/ui/src/components/runbooks/editor/blocks/Directory/index.tsx index 38e974ff..a1eccd92 100644 --- a/ui/src/components/runbooks/editor/blocks/Directory/index.tsx +++ b/ui/src/components/runbooks/editor/blocks/Directory/index.tsx @@ -1,10 +1,12 @@ import { useState } from "react"; -import { Input, Tooltip } from "@nextui-org/react"; +import { Input, Tooltip, Button } from "@nextui-org/react"; import { FolderInputIcon, HelpCircleIcon } from "lucide-react"; // @ts-ignore import { createReactBlockSpec } from "@blocknote/react"; +import { open } from "@tauri-apps/plugin-dialog"; + interface DirectoryProps { path: string; onInputChange: (string) => void; @@ -13,27 +15,49 @@ interface DirectoryProps { const Directory = ({ path, onInputChange }: DirectoryProps) => { const [value, setValue] = useState(path); + const selectFolder = async () => { + const path = await open({ + multiple: false, + directory: true, + }); + + setValue(path); + onInputChange(path); + }; + return (
- { - setValue(val); - onInputChange(val); - }} - startContent={} - /> +
+
+ +
+ +
+ { + setValue(val); + onInputChange(val); + }} + /> +
+
); -- cgit v1.3.1