feat(client): add UI kit, data layer, app shell, and Table component

- design token system (Atlantis, Kimberly, Powder Ash palette)
- Button, Badge, Input, Select, Card, SidePanel, Breadcrumbs components
- generic typed Table<T> component with loading/empty states
- API data layer: typed fetch client for environments, keys, sessions, scenarios
- Vite dev proxy targeting server on port 13000
- App shell with SidePanel nav and four entity pages (Environments, Keys, Sessions, Scenarios)
- Storybook config with dark/light theme toggle and a11y addon
This commit is contained in:
2026-04-09 00:11:55 +03:00
parent 5cc16725fb
commit 9916ef5aaf
47 changed files with 3910 additions and 10 deletions
+67
View File
@@ -0,0 +1,67 @@
import { useCallback, useEffect, useState } from 'react';
import { scenarios } from '../api';
import type { Scenario } from '../api';
import { Button, Table, type TableColumn } from '../ui';
import styles from './Page.module.css';
export function ScenariosPage() {
const [items, setItems] = useState<Scenario[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const load = useCallback(() => {
setLoading(true);
scenarios.list()
.then((res) => setItems(res.data))
.catch((err: Error) => setError(err.message))
.finally(() => setLoading(false));
}, []);
useEffect(load, [load]);
const handleRun = async (id: number) => {
await scenarios.run(id);
};
const handleDelete = async (id: number) => {
await scenarios.remove(id);
load();
};
const columns: TableColumn<Scenario>[] = [
{ key: 'id', header: 'ID', render: (s) => s.id, width: 60 },
{ key: 'name', header: 'Name', render: (s) => s.name },
{
key: 'updated',
header: 'Updated',
width: 120,
render: (s) => new Date(s.updatedAt).toLocaleDateString(),
},
{
key: 'actions',
header: '',
width: 140,
align: 'right',
render: (s) => (
<span style={{ display: 'inline-flex', gap: 6 }}>
<Button size="sm" onClick={() => handleRun(s.id)}>Run</Button>
<Button variant="secondary" size="sm" onClick={() => handleDelete(s.id)}>Delete</Button>
</span>
),
},
];
return (
<div>
<h1 className={styles.heading}>Scenarios</h1>
{error && <p className={styles.error}>{error}</p>}
<Table
columns={columns}
data={items}
rowKey={(s) => s.id}
loading={loading}
emptyMessage="No scenarios yet."
/>
</div>
);
}