File size: 7,190 Bytes
fb43301
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Astra web app (frontend)

The browser app of Astra: React 18, TypeScript, Vite, Mantine 7 and Tailwind 4. The backend (`coworker/`, Python) serves
it at `/` and its API at `/api`. You need no Oracle pod and no secrets to work on the UI: the backend runs against the
practice pod (`mock-app/`) on your machine.

## Run it

```bash

# once

npm --prefix web ci

npm --prefix mock-app ci

python -m venv architecture/.venv && architecture/.venv/Scripts/pip install -r coworker/requirements.txt



# every time (three terminals)

node mock-app/server.js                                  # the practice pod, :3100

architecture/.venv/Scripts/python -m coworker api        # the API, :8800

npm --prefix web run dev                                 # this app, http://127.0.0.1:5173 (proxies /api to :8800)

```

Create a user once: `architecture/.venv/Scripts/python -m coworker create-user --username admin --role admin`. On Windows
`fpt.cmd setup` and `fpt.cmd up` do the same. Point the dev server at another API with `FPT_API_TARGET`.

## Where things are

```

web/

β”œβ”€β”€ index.html                 page shell: title, favicons

β”œβ”€β”€ public/                    static files: astra-logo.png (the CES logo), favicons

β”œβ”€β”€ e2e/                       Playwright end-to-end, accessibility and visual tests

β”œβ”€β”€ scripts/                   gen-api.mjs (typed API client), lighthouse.mjs

└── src/

    β”œβ”€β”€ main.tsx               entry: loads the global styles (in order), Mantine, React Query, the router

    β”œβ”€β”€ App.tsx                the route table: which URL shows which page

    β”œβ”€β”€ theme.ts               Mantine theme: the brand colour ramp (CES blue), sizes, component defaults

    β”œβ”€β”€ styles/                global CSS, numbered in load order (see "Styling")

    β”œβ”€β”€ pages/                 one folder per area of the app (see below)

    β”œβ”€β”€ components/            shared building blocks

    β”‚   β”œβ”€β”€ shell/             the frame around every page: top bar, sidebar, icon rail, side panel

    β”‚   β”œβ”€β”€ ui/                small animated controls (motion buttons, inputs, checkbox, alert)

    β”‚   β”œβ”€β”€ three/             3D scenes (three.js)

    β”‚   β”œβ”€β”€ wensity/           Wensity UI components on the app's tokens

    β”‚   └── icons.tsx          every icon the app uses (import from '@/components/icons')

    β”œβ”€β”€ api/                   the API client and React Query hooks; schema.d.ts and openapi.json are GENERATED

    β”œβ”€β”€ auth/                  sign-in state (AuthContext)

    β”œβ”€β”€ account/               account page parts (access tokens)

    β”œβ”€β”€ chat/                  the Ask assistant (chat cards, speakers)

    β”œβ”€β”€ notify/                notifications: bell, Telegram link, settings

    β”œβ”€β”€ domain/                the app's own knowledge in plain TypeScript: agents, coworkers, glossary, pod areas,

    β”‚                          run names, what is waiting for a person, desktop notifications

    β”œβ”€β”€ hooks/, lib/           small shared hooks and helpers

    └── test/                  test setup and helpers (render with providers, fake API responses)

```

### Pages

| Folder | Screens |
|---|---|
| `pages/auth/` | sign in, register, password reset; `AuthShell` is their shared frame, `login/` the brand mark and 3D scene |
| `pages/home/` | the home dashboard (`HomeBento`) and patch readiness |
| `pages/runs/` | the list of test runs, the new-run wizard, scheduled runs |
| `pages/run/` | everything inside one test run: `RunPage` β†’ `RunWorkspace` (tabs) β†’ `RunStages` (the four phases), scenarios (`ScenarioSplit`, `ScenarioReview`), failures (`FailureReview`, `FailedScreen`), the live browser (`LiveView`), report and sign-off (`RunReport`, `SignOffReport`), the agent team board |
| `pages/library/` | the scenario library and importing test cases |
| `pages/setup/` | test environments (`PodsPage`), Oracle AI Agent Studio, AI monitoring, integrations, settings, admin |
| `pages/insights/` | defects and queues, reports, the assistant, the agent team |
| `pages/account/` | your account |
| `pages/dev/` | fixtures for local development only |
| `pages/__tests__/` | tests that cover several pages at once |

A page's own CSS sits next to it (`pages/run/cockpit.css` is imported by the run page). Tests sit next to the code they
test (`TeamBoard.test.tsx` beside `TeamBoard.tsx`).

## Styling

1. **Colours, sizes and fonts come from tokens:** `styles/00-tokens.css` (CSS variables for light and dark) and
   `theme.ts` (Mantine). Change a colour there and it changes everywhere. The brand accent is the CES blue
   (`--accent`, `--ember`, `--accent-grad` for the gradient); status colours (green passed, red failed, amber waiting)
   mean a state and are never used as decoration.
2. **Global CSS loads in the order of its number** (`main.tsx`); a later file wins over an earlier one:

   | File | What it does |
   |---|---|
   | `00-tokens.css` | design tokens: light and dark |
   | `01-base.css` | base element styles |
   | `10-14 apple*.css` | the first design layer: components, screens, the run page, other pages |
   | `20-surfaces.css`, `21-type.css` | shared surfaces (cards, stat cards, pills, tables) and type |
   | `30-tailwind.css` | Tailwind 4 theme and utilities on the tokens; its `@source` lines list the files that use Tailwind classes |
   | `40-layout.css` | layout across screen sizes |
   | `50-run-polish.css` | the reviewed design of the test run page |
   | `90-theme.css` | the current look (Astra, CES blue): loaded last |

3. **Prefer Mantine components and the tokens.** Use Tailwind classes only in the files listed under `@source` in
   `30-tailwind.css`; add a file there before using Tailwind in it.
4. **Older names you will meet:** class prefixes `pw-`, `fpt-`, `trio-` and the colour names `ember` and `trio` come from
   earlier designs (the product was called Patchwise). They still work; new code can use plain names.

## Conventions

- **Imports:** `@/` means `src/` (`import { IconX } from '@/components/icons'`).
- **API types:** never edit `src/api/schema.d.ts` or `openapi.json`. After a backend change run `npm --prefix web run gen:api`.
- **Accessibility:** every control has a label, focus is visible, colour is never the only signal. `npm --prefix web run test:a11y`.
- **Light and dark:** check both (the moon or sun button in the top bar).
- **Screens never show secrets:** the live browser view masks sign-in pages; do not add passwords, tokens or keys to the UI.

## Checks before a pull request

| What | Command |
|---|---|
| Type check, lint, build | `npm --prefix web run build` and `npm --prefix web run lint` |
| Unit tests (Vitest) | `npm --prefix web test` |
| End-to-end (Playwright) | `npm --prefix web run e2e` |
| Visual snapshots | `npm --prefix web run test:visual` (update with `test:visual:update` when a change is intended) |

See also `docs/DESIGN_SYSTEM.md` (design rules), `docs/FRONTEND_AUDIT.md` and the root `README.md` (the whole product).