Skip to content

Commit 0e5fc95

Browse files
authored
Merge pull request #11 from agentdesktop-dev/peterj/uistorybook-comps
add storybook and break up UI into smaller components
2 parents 2b218ae + 47de93e commit 0e5fc95

59 files changed

Lines changed: 6539 additions & 2325 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ jobs:
3939
corepack enable
4040
pnpm install --frozen-lockfile
4141
42+
- name: Install Storybook test browser
43+
working-directory: frontend
44+
run: pnpm --filter @agentdesktop/desktop-web exec playwright install --with-deps chromium
45+
4246
- name: Install Linux desktop dependencies
4347
run: |
4448
sudo apt-get update

‎Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,6 @@ docker:
5252
clean:
5353
cargo clean
5454
rm -rf frontend/controller/dist
55+
rm -rf frontend/controller/storybook-static
5556
rm -rf frontend/desktop/dist
57+
rm -rf frontend/desktop/storybook-static

‎frontend/.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules/
22
*/node_modules/
33
*/dist/
4+
*/storybook-static/
45
*.log
56
*.tsbuildinfo

‎frontend/biome.json‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
22
"$schema": "https://biomejs.dev/schemas/2.5.8/schema.json",
33
"files": {
4-
"includes": ["controller/**", "desktop/**", "ui/**", "!**/dist", "!**/node_modules"]
4+
"includes": [
5+
"controller/**",
6+
"desktop/**",
7+
"ui/**",
8+
"!**/dist",
9+
"!**/node_modules",
10+
"!**/storybook-static"
11+
]
512
},
613
"formatter": {
714
"enabled": true,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { StorybookConfig } from "@storybook/react-vite";
2+
3+
const config = {
4+
stories: ["../src/**/*.stories.@(ts|tsx)"],
5+
addons: ["@storybook/addon-a11y", "@storybook/addon-vitest"],
6+
framework: {
7+
name: "@storybook/react-vite",
8+
options: {},
9+
},
10+
viteFinal: async (viteConfig) => {
11+
viteConfig.build = { ...viteConfig.build, target: "es2022" };
12+
return viteConfig;
13+
},
14+
} satisfies StorybookConfig;
15+
16+
export default config;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { Preview } from "@storybook/react-vite";
2+
3+
import "../src/styles.css";
4+
import "@agentdesktop/ui/styles.css";
5+
6+
const controllerViewports = {
7+
desktop: {
8+
name: "Controller desktop (1280 × 800)",
9+
styles: { width: "1280px", height: "800px" },
10+
type: "desktop" as const,
11+
},
12+
compact: {
13+
name: "Compact window (760 × 720)",
14+
styles: { width: "760px", height: "720px" },
15+
type: "tablet" as const,
16+
},
17+
mobile: {
18+
name: "Mobile reflow (320 × 640)",
19+
styles: { width: "320px", height: "640px" },
20+
type: "mobile" as const,
21+
},
22+
};
23+
24+
const preview = {
25+
parameters: {
26+
layout: "fullscreen",
27+
a11y: { test: "error" },
28+
viewport: { options: controllerViewports },
29+
},
30+
initialGlobals: {
31+
viewport: { value: "desktop", isRotated: false },
32+
},
33+
} satisfies Preview;
34+
35+
export default preview;

‎frontend/controller/README.md‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Agent Desktop Controller UI
2+
3+
React and Vite administration interface for controller fleet status, device
4+
inventory, managed configuration, and runtime settings.
5+
6+
## Development
7+
8+
From the repository root:
9+
10+
```sh
11+
cd frontend
12+
pnpm install
13+
pnpm dev:controller
14+
```
15+
16+
API requests under `/api` are proxied to `http://127.0.0.1:8080` during local
17+
development.
18+
19+
## Storybook
20+
21+
The controller views have deterministic Storybook states for development,
22+
interaction tests, responsive checks, and automated accessibility checks. The
23+
browser install is required once per Playwright version:
24+
25+
```sh
26+
cd frontend
27+
pnpm --filter @agentdesktop/controller-web exec playwright install chromium
28+
pnpm storybook:controller
29+
```
30+
31+
The controller Storybook runs at `http://localhost:6007/`. Run both UI suites or
32+
build both static Storybooks with:
33+
34+
```sh
35+
pnpm test:storybook
36+
pnpm build:storybook
37+
```

‎frontend/controller/package.json‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"build": "tsc -b && vite build",
99
"typecheck": "tsc -b --pretty false",
1010
"check": "biome check . && pnpm typecheck",
11-
"format": "biome format --write ."
11+
"format": "biome format --write .",
12+
"storybook": "storybook dev -p 6007",
13+
"build-storybook": "storybook build",
14+
"test-storybook": "vitest run --project=storybook"
1215
},
1316
"dependencies": {
1417
"@agentdesktop/ui": "workspace:*",
@@ -18,10 +21,18 @@
1821
},
1922
"devDependencies": {
2023
"@biomejs/biome": "^2.5.8",
24+
"@storybook/addon-a11y": "^10.5.9",
25+
"@storybook/addon-vitest": "^10.5.9",
26+
"@storybook/react-vite": "^10.5.9",
27+
"@types/node": "^26.2.0",
2128
"@types/react": "^19.2.18",
2229
"@types/react-dom": "^19.2.4",
2330
"@vitejs/plugin-react": "^6.0.5",
31+
"@vitest/browser-playwright": "^4.1.11",
32+
"playwright": "^1.62.1",
33+
"storybook": "^10.5.9",
2434
"typescript": "^7.0.2",
25-
"vite": "^8.2.1"
35+
"vite": "^8.2.1",
36+
"vitest": "^4.1.11"
2637
}
2738
}

0 commit comments

Comments
 (0)