diff --git a/ui-electrobun/src/mainview/App.svelte b/ui-electrobun/src/mainview/App.svelte index a1a6c6f..4147e94 100644 --- a/ui-electrobun/src/mainview/App.svelte +++ b/ui-electrobun/src/mainview/App.svelte @@ -9,6 +9,7 @@ import SearchOverlay from "./SearchOverlay.svelte"; import SplashScreen from "./SplashScreen.svelte"; import ProjectWizard from "./ProjectWizard.svelte"; + import GroupStatusDots from "./GroupStatusDots.svelte"; import { themeStore } from "./theme-store.svelte.ts"; import { fontStore } from "./font-store.svelte.ts"; import { keybindingStore } from "./keybinding-store.svelte.ts"; @@ -381,10 +382,11 @@ aria-label="{group.name} (Ctrl+{i + 1})" title="{group.name} (Ctrl+{i + 1})" > - - {#if group.hasNew} - - {/if} + {/each} diff --git a/ui-electrobun/src/mainview/GroupStatusDots.svelte b/ui-electrobun/src/mainview/GroupStatusDots.svelte new file mode 100644 index 0000000..cdc1d9d --- /dev/null +++ b/ui-electrobun/src/mainview/GroupStatusDots.svelte @@ -0,0 +1,62 @@ + + + + + + + + {groupNumber} + + + {#each projects as project, i} + {@const angle = (i / projects.length) * Math.PI * 2 - Math.PI / 2} + {@const cx = 16 + 12 * Math.cos(angle)} + {@const cy = 16 + 12 * Math.sin(angle)} + + {/each} + + + diff --git a/ui-electrobun/src/mainview/project-status.ts b/ui-electrobun/src/mainview/project-status.ts new file mode 100644 index 0000000..76d4da8 --- /dev/null +++ b/ui-electrobun/src/mainview/project-status.ts @@ -0,0 +1,24 @@ +/** + * Reads agent status for a project from the global agent store. + * Returns a ProjectStatus suitable for status dot coloring. + * + * Reading getSession() touches the _v version counter inside agent-store, + * so Svelte 5 will re-evaluate any reactive context that calls this function + * when sessions change. + */ + +import { getSession } from './agent-store.svelte'; +import type { ProjectStatus } from './status-colors'; + +export function getProjectAgentStatus(projectId: string): ProjectStatus { + const session = getSession(projectId); + if (!session) return 'inactive'; + + switch (session.status) { + case 'running': return 'running'; + case 'done': return 'done'; + case 'error': return 'error'; + case 'idle': return 'inactive'; + default: return 'inactive'; + } +} diff --git a/ui-electrobun/src/mainview/status-colors.ts b/ui-electrobun/src/mainview/status-colors.ts new file mode 100644 index 0000000..062e833 --- /dev/null +++ b/ui-electrobun/src/mainview/status-colors.ts @@ -0,0 +1,14 @@ +/** + * Pure function mapping project status to a CSS custom property color. + */ + +export type ProjectStatus = 'inactive' | 'running' | 'done' | 'error'; + +export function statusToColor(status: ProjectStatus): string { + switch (status) { + case 'running': return 'var(--ctp-green)'; + case 'done': return 'var(--ctp-peach)'; + case 'error': return 'var(--ctp-red)'; + default: return 'var(--ctp-overlay0)'; + } +}