diff --git a/src/renderer/src/components/settings/CliRegistrationDialog.tsx b/src/renderer/src/components/settings/CliRegistrationDialog.tsx new file mode 100644 index 00000000000..cf8c97563bb --- /dev/null +++ b/src/renderer/src/components/settings/CliRegistrationDialog.tsx @@ -0,0 +1,99 @@ +import { Button } from '../ui/button' +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle +} from '../ui/dialog' +import { translate } from '@/i18n/i18n' + +type CliRegistrationDialogProps = { + open: boolean + onOpenChange: (open: boolean) => void + isEnabled: boolean + isSupported: boolean + commandName: string + commandPath: string | null | undefined + busyAction: 'install' | 'remove' | null + onInstall: () => void + onRemove: () => void +} + +export function CliRegistrationDialog({ + open, + onOpenChange, + isEnabled, + isSupported, + commandName, + commandPath, + busyAction, + onInstall, + onRemove +}: CliRegistrationDialogProps): React.JSX.Element { + return ( + + + + + {isEnabled + ? translate( + 'auto.components.settings.CliSection.14444243ba', + 'Remove `{{value0}}` from PATH?', + { + value0: commandName + } + ) + : translate( + 'auto.components.settings.CliSection.fa87db3d6e', + 'Register `{{value0}}` in PATH?', + { + value0: commandName + } + )} + + + {isEnabled + ? translate( + 'auto.components.settings.CliSection.a030816e3e', + 'This removes the shell command symlink. Orca itself remains installed.' + ) + : translate( + 'auto.components.settings.CliSection.aa6536977e', + 'Orca will register {{value0}} so the command works from your terminal.', + { value0: commandPath ?? commandName } + )} + + + {commandPath ? ( +

+ {translate('auto.components.settings.CliSection.a4aafe46e3', 'Target path:')}{' '} + {commandPath} +

+ ) : null} + + + + +
+
+ ) +} diff --git a/src/renderer/src/components/settings/CliSection.tsx b/src/renderer/src/components/settings/CliSection.tsx index bbca6e0521c..c2b2ff46723 100644 --- a/src/renderer/src/components/settings/CliSection.tsx +++ b/src/renderer/src/components/settings/CliSection.tsx @@ -19,17 +19,10 @@ import { } from '@/hooks/useInstalledAgentSkills' import { useMountedRef } from '@/hooks/useMountedRef' import { Button } from '../ui/button' -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle -} from '../ui/dialog' import { Label } from '../ui/label' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip' import { AgentSkillSetupPanel } from './AgentSkillSetupPanel' +import { CliRegistrationDialog } from './CliRegistrationDialog' import { buildSkillInstallCommandForRuntime, CliSkillRuntimeControl, @@ -408,64 +401,17 @@ export function CliSection({ - - - - - {isEnabled - ? translate( - 'auto.components.settings.CliSection.14444243ba', - 'Remove `{{value0}}` from PATH?', - { value0: commandName } - ) - : translate( - 'auto.components.settings.CliSection.fa87db3d6e', - 'Register `{{value0}}` in PATH?', - { value0: commandName } - )} - - - {isEnabled - ? translate( - 'auto.components.settings.CliSection.a030816e3e', - 'This removes the shell command symlink. Orca itself remains installed.' - ) - : translate( - 'auto.components.settings.CliSection.aa6536977e', - 'Orca will register {{value0}} so the command works from your terminal.', - { value0: status?.commandPath ?? commandName } - )} - - - {status?.commandPath ? ( -

- {translate('auto.components.settings.CliSection.a4aafe46e3', 'Target path:')}{' '} - {status.commandPath} -

- ) : null} - - - - -
-
+ ) }