Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.
TypeScript agent-teamagentic-aiai-agentsai-assistantclaude-codecodexcursorelectrongrokgrok-bot-alternativelinuxlocal-firstmacosmcpmulti-agentopenclaw-alternativeopencodewindows
Fold the sidebar's sections (#62)
Brisa8cebc6763e65
diff --git a/src/renderer/src/components/Fold.tsx b/src/renderer/src/components/Fold.tsxnew file mode 100644index 0000000..a2fcd8d--- /dev/null+++ b/src/renderer/src/components/Fold.tsx@@ -0,0 +1,19 @@+import type { ReactNode } from 'react'+import { updateSettings, useStore } from '../store'+import { Icon } from './ui'++// Anything that folds keeps its id in one list in settings, so it stays folded after a restart.+export function useFold(id: string): { open: boolean; toggle: () => void } {+ const folded = useStore((s) => s.settings.folded) ?? []+ const open = !folded.includes(id)+ return { open, toggle: () => updateSettings({ folded: open ? [...folded, id] : folded.filter((f) => f !== id) }) }+}++export function FoldToggle({ open, onToggle, children }: { open: boolean; onToggle: () => void; children: ReactNode }): ReactNode {+ return (+ <button className="fold-toggle" aria-expanded={open} onClick={onToggle}>+ <Icon name="chevron" size={12} />+ <span>{children}</span>+ </button>+ )+}diff --git a/src/renderer/src/components/Sidebar.tsx b/src/renderer/src/components/Sidebar.tsxindex 94bb4a4..f6b06e9 100644--- a/src/renderer/src/components/Sidebar.tsx+++ b/src/renderer/src/components/Sidebar.tsx@@ -18,6 +18,7 @@ import {type View} from '../store'import { ContextMenu, type MenuItem, type MenuState } from './Dialogs'+import { FoldToggle, useFold } from './Fold'import { GettingStarted } from './Onboarding'import { UpdateNote } from './Update'import { AgentAvatar, Icon, TucaMark, type IconName } from './ui'@@ -46,6 +47,25 @@ function TucaItem(): ReactNode {)}+function Section({ id, label, unread = 0, action, children }: { id: string; label: string; unread?: number; action?: ReactNode; children: ReactNode }): ReactNode {+ const { open, toggle } = useFold(`section:${id}`)+ return (+ <div className={`section ${open ? '' : 'is-folded'}`}>+ <div className="section__head">+ <FoldToggle open={open} onToggle={toggle}>+ {label}+ </FoldToggle>+ {/* A closed section still says when something in it is waiting. */}+ {!open && unread > 0 && <span className="badge badge--soft">{unread}</span>}+ {action}+ </div>+ {children}+ </div>+ )+}++const unreadIn = (conversations: { unread?: number }[]): number => conversations.reduce((sum, c) => sum + (c.unread ?? 0), 0)+export function Sidebar(): ReactNode {const s = useStore((s) => s)const channels = s.conversations.filter((c) => c.kind === 'channel')@@ -139,25 +159,25 @@ export function Sidebar(): ReactNode {<NavItem view={{ kind: 'skills' }} icon="layers" label="Skills" badge={proposals} /><NavItem view={{ kind: 'report' }} icon="report" label={L('Boletim', 'Report')} />- <div className="section">- <div className="section__head">- <span>{L('Canais', 'Channels')}</span>+ <Section+ id="channels"+ label={L('Canais', 'Channels')}+ unread={unreadIn(channels)}+ action={<button className="icon-btn icon-btn--sm" title={L(`Novo canal (${shortcut(s.platform, 'N')})`, `New channel (${shortcut(s.platform, 'N')})`)} onClick={() => openDialog({ kind: 'new-channel' })}><Icon name="plus" size={14} /></button>- </div>+ }+ >{channels.map((c) => (<div key={c.id} onContextMenu={(e) => open(e, channelMenu(c))}><ChannelItem id={c.id} name={c.name} unread={c.unread} /></div>))}- </div>+ </Section>{dms.length > 0 && (- <div className="section">- <div className="section__head">- <span>{L('Mensagens diretas', 'Direct messages')}</span>- </div>+ <Section id="dms" label={L('Mensagens diretas', 'Direct messages')} unread={unreadIn(dms)}>{dms.map((c) => {const agent = agentById(s, c.name)if (!agent) return null@@ -167,16 +187,18 @@ export function Sidebar(): ReactNode {</div>)})}- </div>+ </Section>)}- <div className="section">- <div className="section__head">- <span>{L('Agentes', 'Agents')}</span>+ <Section+ id="agents"+ label={L('Agentes', 'Agents')}+ action={<button className="icon-btn icon-btn--sm" title={L('Novo agente: abre o Tuca', 'New agent: opens Tuca')} onClick={openTuca}><Icon name="plus" size={14} /></button>- </div>+ }+ >{s.agents.filter(isTeam).map((a) => (@@ -191,7 +213,7 @@ export function Sidebar(): ReactNode {<span className="nav-item__meta">{s.agents.filter((a) => a.archived).length}</span></button>)}- </div>+ </Section></nav>{s.settings.onboarding?.done && !s.settings.onboarding.checklistHidden && <GettingStarted />}diff --git a/src/renderer/src/styles.css b/src/renderer/src/styles.cssindex 4745b47..52b93f5 100644--- a/src/renderer/src/styles.css+++ b/src/renderer/src/styles.css@@ -324,6 +324,35 @@ h3 {text-transform: uppercase;letter-spacing: 0.04em;}+.section__head .badge {+ margin-right: 4px;+}+.fold-toggle {+ flex: 1;+ min-width: 0;+ display: flex;+ align-items: center;+ gap: 4px;+ font: inherit;+ letter-spacing: inherit;+ text-transform: inherit;+ color: inherit;+ text-align: left;+}+.fold-toggle:hover {+ color: var(--text-2);+}+.fold-toggle svg {+ flex-shrink: 0;+ transition: transform 0.15s var(--ease);+}+.fold-toggle[aria-expanded='true'] svg {+ transform: rotate(90deg);+}+/* What's folded goes, except where you are: the row you're in never disappears from under you. */+.is-folded .nav-item:not(.is-active) {+ display: none;+}.nav-item {width: 100%;display: flex;@@ -6271,6 +6300,9 @@ kbd {display: none;}@media (max-width: 760px) {+ .fold-toggle {+ min-height: 36px;+ }.app {grid-template-columns: minmax(0, 1fr);height: 100dvh;diff --git a/src/shared/types.ts b/src/shared/types.tsindex feab400..e5d6c17 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -207,6 +207,7 @@ export interface Settings {harnesses?: EngineId[]// The first-run introduction: unset on an existing install (no intro), done:false to show it (a new install, or "Rever a introdução")onboarding?: { done: boolean; checklistHidden?: boolean }+ folded?: string[] // the ids of what I folded in the sidebar}// What the main process does in an agent's browser for the core, and what it answers (spec §24).