Files
commitea/docs/design/ui_kits/app/BoardScreen.js.txt
Christian LeDoux 7a5cacc54c Scaffold CommiTea: yarn workspaces, Electron shell, core label schema, design system
- apps/desktop: electron-vite + React + Tailwind mapped onto design tokens
  (preflight off; tokens/base.css owns the reset); boots to a Reginald
  placeholder proving fonts/tokens/core wiring
- packages/core: pure TS; gitea label schema (est/*, p/*, deadline/hard)
  with pessimistic conflict resolution + 15 unit tests
- docs/design: full design handoff (tokens, 16 component contracts,
  interactive 14-screen prototype, Reginald voice rules)
- docs/PLAN.md: product plan (purity rule, pm-state repo, deterministic
  scheduler + Monte Carlo, directive log)
- Deliberate deviation from novelpad stack: no ElectricSQL/PGlite — local
  store is a rebuildable cache over gitea REST/webhooks (better-sqlite3
  in main process, arriving in P1)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 20:42:46 -04:00

81 lines
4.6 KiB
Plaintext

// Board — kanban over inferred lifecycle, with Gantt/Dependencies stubs
function BoardScreen({ onOpenIssue }) {
const DS = window.CommiTeaDesignSystem_20e63b;
const { Card, Tag, Badge, Tabs, IconButton, Input, Icon } = DS;
const d = window.CT_DATA;
const [tab, setTab] = React.useState('board');
const [query, setQuery] = React.useState('');
const q = query.trim().toLowerCase();
const filtered = d.columns.map((c) => ({ ...c, issues: q ? c.issues.filter((i) => (i.title + ' #' + i.id).toLowerCase().includes(q)) : c.issues }));
const anyMatch = filtered.some((c) => c.issues.length > 0);
const openCount = d.columns.reduce((n, c) => n + (c.id === 'done' ? 0 : c.issues.length), 0);
const IssueCard = ({ issue }) => (
<div
onClick={() => onOpenIssue(issue)}
style={{
background: 'var(--surface-card)', border: '1px solid var(--line-1)',
borderRadius: 'var(--radius-2)', padding: '10px 12px', cursor: 'pointer',
boxShadow: 'var(--shadow-1)', display: 'flex', flexDirection: 'column', gap: 8,
}}
onMouseEnter={(e) => { e.currentTarget.style.borderColor = 'var(--line-2)'; }}
onMouseLeave={(e) => { e.currentTarget.style.borderColor = 'var(--line-1)'; }}
>
<div style={{ font: 'var(--text-small)', fontWeight: 500, color: 'var(--ink-1)' }}>{issue.title}</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' }}>
<span style={{ font: '400 11.5px var(--font-mono)', color: 'var(--ink-3)' }}>#{issue.id}</span>
{issue.labels.map((l) => <Tag key={l} label={l} style={{ transform: 'scale(0.95)', transformOrigin: 'left center' }} />)}
{issue.days ? <span style={{ font: '400 11px var(--font-mono)', color: 'var(--warn)' }}>{issue.days}</span> : null}
{issue.pr ? <span style={{ display: 'inline-flex', alignItems: 'center', gap: 3, font: '400 11px var(--font-mono)', color: 'var(--info)' }}><Icon name="git-pull-request" size={12} />{issue.pr}</span> : null}
<span style={{
marginLeft: 'auto', width: 20, height: 20, borderRadius: '50%',
background: 'var(--spruce-2)', color: 'var(--accent-text)',
font: '600 9px/20px var(--font-sans)', textAlign: 'center', flexShrink: 0,
}}>{issue.who}</span>
</div>
</div>
);
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 14, height: '100%', minHeight: 0 }}>
<header style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }}>
<h1 style={{ font: 'var(--text-display)', color: 'var(--ink-1)', margin: 0, whiteSpace: 'nowrap' }}>The pot</h1>
<div style={{ width: 240 }}><Input icon="search" placeholder="Search the pot…" value={query} onChange={(e) => setQuery(e.target.value)} /></div>
</header>
<Tabs
items={[
{ id: 'board', label: 'Board', icon: 'square-kanban', count: openCount },
{ id: 'gantt', label: 'Gantt', icon: 'chart-no-axes-gantt' },
{ id: 'deps', label: 'Dependencies', icon: 'network' },
]}
active={tab} onChange={setTab}
/>
{tab === 'board' ? (
anyMatch ? (
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', gap: 12, alignItems: 'start', flex: 1, minHeight: 0, overflow: 'auto' }}>
{filtered.map((col) => (
<div key={col.id} style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 6, padding: '2px 2px 4px', borderBottom: '1px solid var(--line-1)', whiteSpace: 'nowrap' }}>
<span style={{ font: 'var(--text-overline)', letterSpacing: 'var(--letter-spacing-wide)', textTransform: 'uppercase', color: 'var(--ink-2)' }}>{col.label}</span>
<span style={{ font: '400 11px var(--font-mono)', color: 'var(--ink-3)' }}>{col.issues.length}</span>
</div>
{col.issues.map((i) => <IssueCard key={i.id} issue={i} />)}
</div>
))}
</div>
) : (
<div style={{ flex: 1, border: '1px dashed var(--line-2)', borderRadius: 'var(--radius-3)' }}>
<window.EmptyState icon="search" title="Nothing by that name"
line={`The pot holds ${d.columns.reduce((n, c) => n + c.issues.length, 0)} issues; none of them answer to “${query.trim()}”.`} />
</div>
)
) : tab === 'deps' ? (
<window.DepsGraph onOpenIssue={onOpenIssue} />
) : (
<window.GanttView onOpenIssue={onOpenIssue} />
)}
</div>
);
}
Object.assign(window, { BoardScreen });