aboutsummaryrefslogtreecommitdiffstats
path: root/ui/src/components
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@atuin.sh>2024-07-26 19:08:49 +0100
committerGitHub <noreply@github.com>2024-07-26 19:08:49 +0100
commit0b01d9308316d73b5683c319099860611c7a6559 (patch)
tree6614442616d3dad20d387bd808e0eefa886629cb /ui/src/components
parentfeat(gui): folder select dialogue for directory block (#2315) (diff)
downloadatuin-0b01d9308316d73b5683c319099860611c7a6559.zip
fix(gui): random ts errors (#2316)
Diffstat (limited to 'ui/src/components')
-rw-r--r--ui/src/components/runbooks/editor/blocks/Directory/index.tsx8
-rw-r--r--ui/src/components/runbooks/editor/blocks/Run/index.tsx12
2 files changed, 13 insertions, 7 deletions
diff --git a/ui/src/components/runbooks/editor/blocks/Directory/index.tsx b/ui/src/components/runbooks/editor/blocks/Directory/index.tsx
index a1eccd92..3e4f93d9 100644
--- a/ui/src/components/runbooks/editor/blocks/Directory/index.tsx
+++ b/ui/src/components/runbooks/editor/blocks/Directory/index.tsx
@@ -1,6 +1,6 @@
import { useState } from "react";
import { Input, Tooltip, Button } from "@nextui-org/react";
-import { FolderInputIcon, HelpCircleIcon } from "lucide-react";
+import { FolderInputIcon } from "lucide-react";
// @ts-ignore
import { createReactBlockSpec } from "@blocknote/react";
@@ -9,7 +9,7 @@ import { open } from "@tauri-apps/plugin-dialog";
interface DirectoryProps {
path: string;
- onInputChange: (string) => void;
+ onInputChange: (val: string) => void;
}
const Directory = ({ path, onInputChange }: DirectoryProps) => {
@@ -21,8 +21,8 @@ const Directory = ({ path, onInputChange }: DirectoryProps) => {
directory: true,
});
- setValue(path);
- onInputChange(path);
+ setValue(path || "");
+ onInputChange(path || "");
};
return (
diff --git a/ui/src/components/runbooks/editor/blocks/Run/index.tsx b/ui/src/components/runbooks/editor/blocks/Run/index.tsx
index e0989f47..bef083ba 100644
--- a/ui/src/components/runbooks/editor/blocks/Run/index.tsx
+++ b/ui/src/components/runbooks/editor/blocks/Run/index.tsx
@@ -87,9 +87,15 @@ const RunBlock = ({
}
if (!isRunning) {
- const cwd = findFirstParentOfType(editor, id, "directory");
- console.log(cwd.props.path);
- let pty = await invoke<string>("pty_open", { cwd: cwd.props.path });
+ let cwd = findFirstParentOfType(editor, id, "directory");
+
+ if (cwd) {
+ cwd = cwd.props.path;
+ } else {
+ cwd = "~";
+ }
+
+ let pty = await invoke<string>("pty_open", { cwd });
if (onRun) onRun(pty);
if (currentRunbook) incRunbookPty(currentRunbook);