fix(ui): add install button to copilot page sidebar

- show Install copilot-api button when not installed

- display version in status when installed
This commit is contained in:
kaitranntt
2025-12-18 02:38:58 -05:00
parent f813ad06f6
commit 3865747154
+31 -1
View File
@@ -19,6 +19,8 @@ import {
Key,
Server,
Cpu,
Download,
Loader2,
} from 'lucide-react';
import { useCopilot } from '@/hooks/use-copilot';
import { CopilotConfigForm } from '@/components/copilot/copilot-config-form';
@@ -108,6 +110,8 @@ export function CopilotPage() {
isStartingDaemon,
stopDaemon,
isStoppingDaemon,
install,
isInstalling,
} = useCopilot();
return (
@@ -160,8 +164,34 @@ export function CopilotPage() {
icon={Server}
label="copilot-api"
status={status?.installed ?? false}
statusText={status?.installed ? 'Installed' : 'Missing'}
statusText={
status?.installed
? status.version
? `v${status.version}`
: 'Installed'
: 'Missing'
}
/>
{!status?.installed && (
<Button
size="sm"
className="w-full mt-2"
onClick={() => install(undefined)}
disabled={isInstalling}
>
{isInstalling ? (
<>
<Loader2 className="w-3.5 h-3.5 mr-1.5 animate-spin" />
Installing...
</>
) : (
<>
<Download className="w-3.5 h-3.5 mr-1.5" />
Install copilot-api
</>
)}
</Button>
)}
</StatusSection>
{/* Authentication */}