|
1 | | -# sv |
| 1 | +# MoBI-View Frontend |
2 | 2 |
|
3 | | -Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). |
| 3 | +SvelteKit frontend for the MoBI-View browser UI. |
4 | 4 |
|
5 | | -## Creating a project |
| 5 | +The app is built as static HTML, JavaScript, and CSS with `@sveltejs/adapter-static`. |
| 6 | +Production assets are emitted directly to `../src/MoBI_View/web/static`, which is |
| 7 | +the directory served by the Python WebSocket/HTTP server. |
6 | 8 |
|
7 | | -If you're seeing this, you've probably already done this step. Congrats! |
| 9 | +## Commands |
8 | 10 |
|
9 | 11 | ```sh |
10 | | -# create a new project |
11 | | -npx sv create my-app |
| 12 | +npm run dev |
| 13 | +npm run check |
| 14 | +npm run format:check |
| 15 | +npm run test:unit -- --run |
| 16 | +npm run test:e2e |
| 17 | +npm run build |
12 | 18 | ``` |
13 | 19 |
|
14 | | -To recreate this project with the same configuration: |
| 20 | +## Backend Contract |
15 | 21 |
|
16 | | -```sh |
17 | | -# recreate this project |
18 | | -npx sv@0.15.2 create --template minimal --types ts --install npm frontend |
19 | | -``` |
| 22 | +During local development, the frontend expects the Python server to be available at |
| 23 | +`ws://localhost:8765`. |
20 | 24 |
|
21 | | -## Developing |
| 25 | +The current backend message contract is: |
22 | 26 |
|
23 | | -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: |
| 27 | +- Send discovery command: `{"command":"discover"}` |
| 28 | +- Receive discovery response: `{"type":"discover_result","streams":[...]}` |
| 29 | +- Receive broadcast frame: `{"streams":[{"stream_name":"...","data":[...],"channel_labels":[...]}]}` |
24 | 30 |
|
25 | | -```sh |
26 | | -npm run dev |
27 | | - |
28 | | -# or start the server and open the app in a new browser tab |
29 | | -npm run dev -- --open |
30 | | -``` |
31 | | - |
32 | | -## Building |
33 | | - |
34 | | -To create a production version of your app: |
| 31 | +## Static Build |
35 | 32 |
|
36 | 33 | ```sh |
37 | 34 | npm run build |
38 | 35 | ``` |
39 | 36 |
|
40 | | -You can preview the production build with `npm run preview`. |
41 | | - |
42 | | -> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. |
| 37 | +After building, run `uv run mobi-view` from the repository root and open |
| 38 | +`http://localhost:8765` to view the static frontend served by Python. |
0 commit comments