mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
* test(backend): replace better-sqlite3 test mock with node:sqlite Reimplement the bun:sqlite test mock on top of node:sqlite with an explicit BEGIN/COMMIT/ROLLBACK transaction wrapper. * feat(assistant): self-configuring assistant mode Add a self-editable assistant workspace and the APIs that support it: - POST /assistant/reload disposes and re-bootstraps the assistant instance (directory-scoped, rate-limited) so agent.md edits apply. - Internal settings API accepts non-secret TTS/STT patches via dedicated partial schemas. - Strip the generated agent persona from opencode.json on repair so user-customized agents are preserved across config recovery. - Cache the last assistant session id to avoid redundant session listing on launch. * style(repo): align worktree and workspace tabs with primary/orange theme
63 lines
2.7 KiB
TypeScript
63 lines
2.7 KiB
TypeScript
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
|
import { GitBranch, Layers, Plus } from 'lucide-react'
|
|
import type { RepoSibling } from '@/api/repos'
|
|
import type { WorktreeTabValue } from '@/hooks/useWorktreeTab'
|
|
|
|
interface WorktreeTabsProps {
|
|
workspaces: RepoSibling[]
|
|
value: WorktreeTabValue
|
|
onValueChange: (value: WorktreeTabValue) => void
|
|
baseLabel: string
|
|
activeWorkspaceLabel?: string
|
|
onCreateWorkspace?: () => void
|
|
onWorkspaceMenu?: () => void
|
|
}
|
|
|
|
export function WorktreeTabs({
|
|
workspaces,
|
|
value,
|
|
onValueChange,
|
|
baseLabel,
|
|
activeWorkspaceLabel,
|
|
onCreateWorkspace,
|
|
onWorkspaceMenu,
|
|
}: WorktreeTabsProps) {
|
|
const hasWorkspaces = workspaces.length > 0
|
|
const workspaceLabel = value === 'workspaces' && activeWorkspaceLabel ? activeWorkspaceLabel : 'Workspaces'
|
|
const tabClassName =
|
|
'group min-w-0 flex-1 gap-1.5 px-2 sm:flex-none sm:px-3 data-[state=active]:border data-[state=active]:border-primary/50 data-[state=active]:bg-primary/10 data-[state=inactive]:hover:bg-accent data-[state=inactive]:hover:text-foreground'
|
|
const activeLabelClassName = 'group-data-[state=active]:text-orange-600 dark:group-data-[state=active]:text-orange-400'
|
|
|
|
return (
|
|
<div className="px-4 pt-2 flex-shrink-0">
|
|
<Tabs value={value} onValueChange={(next) => onValueChange(next as WorktreeTabValue)} className="min-w-0">
|
|
<TabsList className="w-full justify-start gap-1 overflow-hidden">
|
|
<TabsTrigger value="repo" className={tabClassName}>
|
|
<GitBranch className="h-3 w-3 shrink-0" />
|
|
<span className={`min-w-0 truncate ${activeLabelClassName}`}>{baseLabel}</span>
|
|
</TabsTrigger>
|
|
{hasWorkspaces ? (
|
|
<>
|
|
<TabsTrigger value="workspaces" className={tabClassName} onClick={onWorkspaceMenu}>
|
|
<Layers className="h-3 w-3 shrink-0 text-primary" />
|
|
<span className={`min-w-0 truncate ${activeLabelClassName}`}>{workspaceLabel}</span>
|
|
<span className={`shrink-0 text-xs text-muted-foreground ${activeLabelClassName}`}>({workspaces.length})</span>
|
|
</TabsTrigger>
|
|
</>
|
|
) : (
|
|
<button
|
|
type="button"
|
|
onClick={onCreateWorkspace}
|
|
className="inline-flex h-8 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-md px-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground sm:flex-none sm:px-3"
|
|
>
|
|
<Layers className="h-3 w-3 shrink-0 text-primary" />
|
|
<span className="min-w-0 truncate">Workspace</span>
|
|
<Plus className="h-3.5 w-3.5 shrink-0" />
|
|
</button>
|
|
)}
|
|
</TabsList>
|
|
</Tabs>
|
|
</div>
|
|
)
|
|
}
|