Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,74 @@ cleared once:
That flag is set by whatever downloaded the file. An update fetched by
the app itself never carries it, so this is a one-time step rather than
one per release.

## Product screenshots

The images in `docs/screenshots/` — used by the READMEs and, through
`docs/screenshots/web/`, by the website — are generated by a script
rather than captured by hand, so they can be regenerated whenever the
interface changes:

```bash
pnpm shots # every scene, both languages, light and dark
pnpm shots --only overview,keys # just these scenes
pnpm shots --langs en --themes dark
```

This runs on macOS only, because the images show the macOS app: the
pages are rendered by the system WKWebView, as in the app, and framed as
a macOS window. It needs the Xcode command line tools (`swiftc`) and
`src-tauri/resources/twcore`, which `bash src-tauri/scripts/fetch-core.sh`
downloads, since the menu bar images are drawn by the app's own code.

How it works, in the order `scripts/shots/shots.sh` runs it:

- **The real interface on mocked IPC.** `scripts/shots/` is a separate
Vite entry that mounts `src/main.tsx` with every Tauri command and
control-plane endpoint answered from fixed data. It is never part of
the app build, and `src/index.css` keeps `scripts/` out of Tailwind's
source scan, so the app bundle is byte-for-byte the same with or
without it.
- **Deterministic.** The clock is fixed at Friday 2026-09-25 16:42:07
local time and the traffic is generated from a fixed seed, so two runs
produce the same pages. The menu bar images use the same clock: the
page hands its fixed time to `menubar_shots` as `--now`.
- **Core's own answers.** The configuration views (upstreams, keys,
routes, security rules, prices, dry runs) are what the pinned core
returns for `scripts/shots/core/config.{en,zh}.yaml`, stored as JSON in
`scripts/shots/core/{en,zh}/`. After changing those files or the core
tag in `src-tauri/Cargo.toml`, regenerate them with
`bash scripts/shots/core/oracle.sh <path to a ThinkWatch-Core checkout>`.
Sentences that core or the Rust side produce carry their real message
codes and English text, so the Chinese interface translates them
through `src/i18n/core.zh.json` exactly as it does in the app.
- **The mock is type-checked with the app.** `pnpm typecheck`, and so
CI, also checks `scripts/shots/`. Every Tauri command and control-plane
endpoint handler returns the type the interface reads (from
`src/generated/` or the page's own API module), and the stored core
answers are checked against the core types, so a protocol change fails
the check rather than producing pages with missing data. When a newer
core tag changes those types, run `oracle.sh` again. At capture time, a
command the mock does not answer, or one called without the arguments it
expects, stops the run.
- **Scenes** are listed in `scripts/shots/scenes.ts`: which page, local or
remote core, and what to open before the picture is taken.
`scripts/shots/capture.swift` loads each one in an off-screen WKWebView,
waits until the page reports it is ready with no console errors and two
snapshots in a row are identical, and frames it. A scene with a table
that does not fit the window stops the run instead of being captured
with its last columns cut off; such a scene can collapse the sidebar, as
the MCP scene does. The sidebar is shown in its solid color: the translucent
material the app uses on macOS is drawn by the window server and cannot
be captured off-screen.
`src-tauri/examples/menubar_shots.rs` draws the menu bar.
`scripts/shots/finish.mjs` writes the results.

What it writes:

| Files | What they are |
|---|---|
| `docs/screenshots/{zh,en}/<scene>-{light,dark}.png` | The window, 1100×690 points at 2×, in a macOS frame: 2360×1540 pixels, 256 colors |
| `docs/screenshots/menubar-{light,dark}.png` | The menu bar item: the mark and today's tokens and cost |
| `docs/screenshots/{zh,en}/menubar-menu-{light,dark}.png` | The menu it opens (standard items are drawn approximately) |
| `docs/screenshots/web/` | What the website uses: the dark variant as WebP at quality 85, `-en` for the English interface |
Binary file added docs/screenshots/en/clients-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/clients-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/dry-run-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/dry-run-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/keys-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/keys-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/mcp-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/mcp-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/menubar-menu-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/menubar-menu-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/overview-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/overview-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/remote-add-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/remote-add-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/remote-clients-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/remote-clients-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/remote-switcher-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/remote-switcher-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/routing-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/routing-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/security-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/security-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/settings-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/settings-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/traffic-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/en/traffic-light.png
Binary file added docs/screenshots/en/upstreams-dark.png
Binary file added docs/screenshots/en/upstreams-light.png
Binary file added docs/screenshots/menubar-dark.png
Binary file added docs/screenshots/menubar-light.png
Binary file added docs/screenshots/web/clients-en.webp
Binary file added docs/screenshots/web/clients.webp
Binary file added docs/screenshots/web/dry-run-en.webp
Binary file added docs/screenshots/web/dry-run.webp
Binary file added docs/screenshots/web/keys-en.webp
Binary file added docs/screenshots/web/keys.webp
Binary file added docs/screenshots/web/mcp-en.webp
Binary file added docs/screenshots/web/mcp.webp
Binary file added docs/screenshots/web/menubar-menu-en.webp
Binary file added docs/screenshots/web/menubar-menu.webp
Binary file added docs/screenshots/web/menubar.png
Binary file added docs/screenshots/web/overview-en.webp
Binary file added docs/screenshots/web/overview.webp
Binary file added docs/screenshots/web/remote-add-en.webp
Binary file added docs/screenshots/web/remote-add.webp
Binary file added docs/screenshots/web/remote-clients-en.webp
Binary file added docs/screenshots/web/remote-clients.webp
Binary file added docs/screenshots/web/remote-switcher-en.webp
Binary file added docs/screenshots/web/remote-switcher.webp
Binary file added docs/screenshots/web/routing-en.webp
Binary file added docs/screenshots/web/routing.webp
Binary file added docs/screenshots/web/security-en.webp
Binary file added docs/screenshots/web/security.webp
Binary file added docs/screenshots/web/settings-en.webp
Binary file added docs/screenshots/web/settings.webp
Binary file added docs/screenshots/web/traffic-en.webp
Binary file added docs/screenshots/web/traffic.webp
Binary file added docs/screenshots/web/upstreams-en.webp
Binary file added docs/screenshots/web/upstreams.webp
Binary file added docs/screenshots/zh/clients-dark.png
Binary file added docs/screenshots/zh/clients-light.png
Binary file added docs/screenshots/zh/dry-run-dark.png
Binary file added docs/screenshots/zh/dry-run-light.png
Binary file added docs/screenshots/zh/keys-dark.png
Binary file added docs/screenshots/zh/keys-light.png
Binary file added docs/screenshots/zh/mcp-dark.png
Binary file added docs/screenshots/zh/mcp-light.png
Binary file added docs/screenshots/zh/menubar-menu-dark.png
Binary file added docs/screenshots/zh/menubar-menu-light.png
Binary file added docs/screenshots/zh/overview-dark.png
Binary file added docs/screenshots/zh/overview-light.png
Binary file added docs/screenshots/zh/remote-add-dark.png
Binary file added docs/screenshots/zh/remote-add-light.png
Binary file added docs/screenshots/zh/remote-clients-dark.png
Binary file added docs/screenshots/zh/remote-clients-light.png
Binary file added docs/screenshots/zh/remote-switcher-dark.png
Binary file added docs/screenshots/zh/remote-switcher-light.png
Binary file added docs/screenshots/zh/routing-dark.png
Binary file added docs/screenshots/zh/routing-light.png
Binary file added docs/screenshots/zh/security-dark.png
Binary file added docs/screenshots/zh/security-light.png
Binary file added docs/screenshots/zh/settings-dark.png
Binary file added docs/screenshots/zh/settings-light.png
Binary file added docs/screenshots/zh/traffic-dark.png
Binary file added docs/screenshots/zh/traffic-light.png
Binary file added docs/screenshots/zh/upstreams-dark.png
Binary file added docs/screenshots/zh/upstreams-light.png
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"scripts": {
"dev": "vite",
"build": "tsc --noEmit && vite build",
"typecheck": "tsc --noEmit",
"typecheck": "tsc --noEmit && tsc --noEmit -p scripts/shots",
"tauri": "tauri",
"test": "vitest run"
"test": "vitest run",
"shots": "bash scripts/shots/shots.sh"
},
"dependencies": {
"@base-ui/react": "^1.8.0",
Expand Down Expand Up @@ -42,6 +43,7 @@
"@types/react": "^19.2.0",
"@types/react-dom": "^19.2.0",
"@vitejs/plugin-react": "^5.1.0",
"sharp": "0.34.5",
"tailwindcss": "^4.1.0",
"typescript": "^5.9.0",
"vite": "^7.1.0",
Expand Down
Loading
Loading