diff --git a/src/commands/add-dir/add-dir.tsx b/src/commands/add-dir/add-dir.tsx index 2813907c9e..7969aae6eb 100644 --- a/src/commands/add-dir/add-dir.tsx +++ b/src/commands/add-dir/add-dir.tsx @@ -1,4 +1,3 @@ -import { c as _c } from "react-compiler-runtime"; import chalk from 'chalk'; import figures from 'figures'; import React, { useEffect } from 'react'; @@ -12,55 +11,27 @@ import { applyPermissionUpdate, persistPermissionUpdate } from '../../utils/perm import type { PermissionUpdateDestination } from '../../utils/permissions/PermissionUpdateSchema.js'; import { SandboxManager } from '../../utils/sandbox/sandbox-adapter.js'; import { addDirHelpMessage, validateDirectoryForWorkspace } from './validation.js'; -function AddDirError(t0) { - const $ = _c(10); - const { - message, - args, - onDone - } = t0; - let t1; - let t2; - if ($[0] !== onDone) { - t1 = () => { - const timer = setTimeout(onDone, 0); - return () => clearTimeout(timer); - }; - t2 = [onDone]; - $[0] = onDone; - $[1] = t1; - $[2] = t2; - } else { - t1 = $[1]; - t2 = $[2]; - } - useEffect(t1, t2); - let t3; - if ($[3] !== args) { - t3 = {figures.pointer} /add-dir {args}; - $[3] = args; - $[4] = t3; - } else { - t3 = $[4]; - } - let t4; - if ($[5] !== message) { - t4 = {message}; - $[5] = message; - $[6] = t4; - } else { - t4 = $[6]; - } - let t5; - if ($[7] !== t3 || $[8] !== t4) { - t5 = {t3}{t4}; - $[7] = t3; - $[8] = t4; - $[9] = t5; - } else { - t5 = $[9]; - } - return t5; + +type AddDirErrorProps = { + message: string; + args: string; + onDone: () => void; +}; + +function AddDirError({ message, args, onDone }: AddDirErrorProps): React.ReactNode { + useEffect(() => { + const timer = setTimeout(onDone, 0); + return () => clearTimeout(timer); + }, [onDone]); + + return ( + + {figures.pointer} /add-dir {args} + + {message} + + + ); } export async function call(onDone: LocalJSXCommandOnDone, context: LocalJSXCommandContext, args?: string): Promise { const directoryPath = (args ?? '').trim(); diff --git a/src/components/permissions/rules/AddWorkspaceDirectory.tsx b/src/components/permissions/rules/AddWorkspaceDirectory.tsx index 09656d21b6..85eb0bcbc0 100644 --- a/src/components/permissions/rules/AddWorkspaceDirectory.tsx +++ b/src/components/permissions/rules/AddWorkspaceDirectory.tsx @@ -144,7 +144,7 @@ export function AddWorkspaceDirectory(t0) { directoryPath } = t0; const [directoryInput, setDirectoryInput] = useState(""); - const [error, setError] = useState(null); + const [error, setError] = useState(null); let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { t1 = [];