Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 21 additions & 50 deletions src/commands/add-dir/add-dir.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 = <Text dimColor={true}>{figures.pointer} /add-dir {args}</Text>;
$[3] = args;
$[4] = t3;
} else {
t3 = $[4];
}
let t4;
if ($[5] !== message) {
t4 = <MessageResponse><Text>{message}</Text></MessageResponse>;
$[5] = message;
$[6] = t4;
} else {
t4 = $[6];
}
let t5;
if ($[7] !== t3 || $[8] !== t4) {
t5 = <Box flexDirection="column">{t3}{t4}</Box>;
$[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 (
<Box flexDirection="column">
<Text dimColor={true}>{figures.pointer} /add-dir {args}</Text>
<MessageResponse>
<Text>{message}</Text>
</MessageResponse>
</Box>
);
}
export async function call(onDone: LocalJSXCommandOnDone, context: LocalJSXCommandContext, args?: string): Promise<React.ReactNode> {
const directoryPath = (args ?? '').trim();
Expand Down
2 changes: 1 addition & 1 deletion src/components/permissions/rules/AddWorkspaceDirectory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export function AddWorkspaceDirectory(t0) {
directoryPath
} = t0;
const [directoryInput, setDirectoryInput] = useState("");
const [error, setError] = useState(null);
const [error, setError] = useState<string | null>(null);
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t1 = [];
Expand Down