259 lines
5.0 KiB
Markdown
259 lines
5.0 KiB
Markdown
## Task 5: shadcn/ui-Inspired Visual System In CSS
|
|
|
|
**Files:**
|
|
- Modify: `apps/web/src/index.css`
|
|
- Test: `apps/web/src/features/workbench/ProjectWorkbench.test.ts`
|
|
|
|
**Interfaces:**
|
|
- Consumes: class names introduced in Tasks 1-4.
|
|
- Produces: stable desktop layout, responsive mobile layout, accessible focus states.
|
|
|
|
- [ ] **Step 1: Add a test assertion for active state semantics**
|
|
|
|
Extend `ProjectWorkbench.test.ts` with:
|
|
|
|
```ts
|
|
it('marks active channel with aria-pressed', async () => {
|
|
render(ProjectWorkbench, { props: { currentUser: { account: 'david@example.com' } } });
|
|
|
|
await fireEvent.click(screen.getByRole('button', { name: 'Work Plan 8' }));
|
|
|
|
expect(screen.getByRole('button', { name: 'Work Plan 8' })).toHaveAttribute('aria-pressed', 'true');
|
|
});
|
|
```
|
|
|
|
- [ ] **Step 2: Run test**
|
|
|
|
Run:
|
|
|
|
```powershell
|
|
Set-Location D:\work\senlinai\agent\apps\web
|
|
npm test -- --run src/features/workbench/ProjectWorkbench.test.ts
|
|
```
|
|
|
|
Expected: PASS before visual CSS work; this protects state semantics while styling changes.
|
|
|
|
- [ ] **Step 3: Replace `index.css` with workbench visual system**
|
|
|
|
Implement CSS tokens and component classes:
|
|
|
|
```css
|
|
:root {
|
|
color: #18181b;
|
|
background: #f4f4f5;
|
|
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
line-height: 1.5;
|
|
--background: #f4f4f5;
|
|
--panel: #ffffff;
|
|
--panel-muted: #fafafa;
|
|
--border: #d4d4d8;
|
|
--text: #18181b;
|
|
--muted: #71717a;
|
|
--primary: #0f7ae5;
|
|
--primary-strong: #0969c8;
|
|
--success: #15803d;
|
|
--danger: #b91c1c;
|
|
--radius: 8px;
|
|
}
|
|
|
|
* { box-sizing: border-box; }
|
|
body { margin: 0; min-width: 320px; min-height: 100vh; }
|
|
button, input, textarea, select { font: inherit; }
|
|
button { cursor: pointer; }
|
|
button:focus-visible, input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
|
|
|
|
.login-page {
|
|
min-height: 100vh;
|
|
display: grid;
|
|
place-items: center;
|
|
padding: 24px;
|
|
background: var(--background);
|
|
}
|
|
|
|
.login-panel {
|
|
width: min(420px, 100%);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
background: var(--panel);
|
|
padding: 24px;
|
|
}
|
|
|
|
.server-login,
|
|
.login-heading,
|
|
.channel-page,
|
|
.object-inspector,
|
|
.channel-sidebar {
|
|
display: grid;
|
|
gap: 12px;
|
|
}
|
|
|
|
.server-login input,
|
|
.search-box input {
|
|
width: 100%;
|
|
border: 1px solid var(--border);
|
|
border-radius: 6px;
|
|
padding: 9px 10px;
|
|
background: white;
|
|
}
|
|
|
|
.server-login button,
|
|
.primary-action {
|
|
border: 1px solid var(--primary);
|
|
border-radius: 6px;
|
|
background: var(--primary);
|
|
color: white;
|
|
padding: 9px 12px;
|
|
}
|
|
|
|
.workbench-shell {
|
|
min-height: 100vh;
|
|
display: grid;
|
|
grid-template-rows: 64px 1fr;
|
|
}
|
|
|
|
.workspace-topbar {
|
|
display: grid;
|
|
grid-template-columns: 160px minmax(240px, 1fr) auto;
|
|
align-items: center;
|
|
gap: 16px;
|
|
border-bottom: 1px solid var(--border);
|
|
background: var(--panel);
|
|
padding: 0 16px;
|
|
}
|
|
|
|
.workbench-body {
|
|
min-height: 0;
|
|
display: grid;
|
|
grid-template-columns: 76px 280px minmax(0, 1fr) 320px;
|
|
}
|
|
|
|
.project-rail,
|
|
.channel-sidebar,
|
|
.object-inspector {
|
|
border-right: 1px solid var(--border);
|
|
background: var(--panel);
|
|
}
|
|
|
|
.project-rail {
|
|
display: grid;
|
|
align-content: start;
|
|
gap: 10px;
|
|
padding: 12px;
|
|
}
|
|
|
|
.project-rail button {
|
|
min-width: 48px;
|
|
min-height: 48px;
|
|
border: 1px solid var(--border);
|
|
border-radius: 999px;
|
|
background: var(--panel-muted);
|
|
}
|
|
|
|
.project-rail button.active,
|
|
.channel-group button.active {
|
|
border-color: var(--primary);
|
|
color: var(--primary);
|
|
background: #eff6ff;
|
|
}
|
|
|
|
.channel-sidebar,
|
|
.object-inspector,
|
|
.channel-stage {
|
|
padding: 16px;
|
|
overflow: auto;
|
|
}
|
|
|
|
.channel-group,
|
|
.recent-sessions,
|
|
.task-list,
|
|
.record-list {
|
|
display: grid;
|
|
gap: 8px;
|
|
}
|
|
|
|
.channel-group button,
|
|
.recent-sessions button,
|
|
.task-card,
|
|
.record-row,
|
|
.cron-row {
|
|
width: 100%;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
background: var(--panel);
|
|
padding: 10px 12px;
|
|
}
|
|
|
|
.task-card,
|
|
.record-row,
|
|
.cron-row {
|
|
display: grid;
|
|
grid-template-columns: auto 1fr auto;
|
|
gap: 12px;
|
|
align-items: start;
|
|
}
|
|
|
|
.task-card.completed {
|
|
color: var(--muted);
|
|
background: var(--panel-muted);
|
|
}
|
|
|
|
.inspector-tabs {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 4px;
|
|
}
|
|
|
|
.inspector-tabs button[aria-selected='true'] {
|
|
border-color: var(--primary);
|
|
color: var(--primary);
|
|
}
|
|
|
|
@media (max-width: 920px) {
|
|
.workspace-topbar {
|
|
grid-template-columns: 1fr;
|
|
height: auto;
|
|
padding: 12px;
|
|
}
|
|
|
|
.workbench-shell {
|
|
grid-template-rows: auto 1fr;
|
|
}
|
|
|
|
.workbench-body {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.project-rail,
|
|
.channel-sidebar,
|
|
.object-inspector {
|
|
border-right: 0;
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
}
|
|
```
|
|
|
|
- [ ] **Step 4: Run component tests and build**
|
|
|
|
Run:
|
|
|
|
```powershell
|
|
Set-Location D:\work\senlinai\agent\apps\web
|
|
npm test -- --run
|
|
npm run build
|
|
```
|
|
|
|
Expected: both PASS.
|
|
|
|
- [ ] **Step 5: Commit**
|
|
|
|
Run:
|
|
|
|
```powershell
|
|
Set-Location D:\work\senlinai\agent
|
|
git add apps\web\src\index.css apps\web\src\features\workbench\ProjectWorkbench.test.ts
|
|
git commit -m "style: apply workbench visual system"
|
|
```
|
|
|
|
---
|
|
|