|
1 | | -# React + TypeScript + Vite |
| 1 | +# O-Analysis |
2 | 2 |
|
3 | | -This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules. |
| 3 | +A browser app for analysing orienteering maps. Import a map image, overlay GPX |
| 4 | +tracks (georeferenced by pinning points), draw routes, add numbered control |
| 5 | +annotations, and export an annotated PNG. |
4 | 6 |
|
5 | | -Currently, two official plugins are available: |
| 7 | +Everything runs in the browser. Projects autosave to IndexedDB, and you can |
| 8 | +save them as `.anal` files to move between devices or keep a copy. |
6 | 9 |
|
7 | | -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs) |
8 | | -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) |
| 10 | +## Getting started |
9 | 11 |
|
10 | | -## React Compiler |
| 12 | +Requires [Bun](https://bun.sh) 1.3 or newer. |
11 | 13 |
|
12 | | -The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). |
| 14 | +```bash |
| 15 | +bun install |
| 16 | +bun run dev # start the dev server |
| 17 | +``` |
13 | 18 |
|
14 | | -## Expanding the Oxlint configuration |
| 19 | +## Scripts |
15 | 20 |
|
16 | | -If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`: |
| 21 | +| Command | What it does | |
| 22 | +| --- | --- | |
| 23 | +| `bun run dev` | Vite dev server with hot reload | |
| 24 | +| `bun run test` | Unit tests (Vitest) | |
| 25 | +| `bun run lint` | Oxlint | |
| 26 | +| `bun run build` | Generate PWA icons, type-check, and build for production | |
| 27 | +| `bun run preview` | Serve the production build locally | |
17 | 28 |
|
18 | | -```json |
19 | | -{ |
20 | | - "$schema": "./node_modules/oxlint/configuration_schema.json", |
21 | | - "plugins": ["react", "typescript", "oxc"], |
22 | | - "options": { |
23 | | - "typeAware": true |
24 | | - }, |
25 | | - "rules": { |
26 | | - "react/rules-of-hooks": "error", |
27 | | - "react/only-export-components": ["warn", { "allowConstantExport": true }] |
28 | | - } |
29 | | -} |
30 | | -``` |
| 29 | +## Configuration |
| 30 | + |
| 31 | +Copy `.env.example` to `.env.local` and set `VITE_ANALYTICS_HOSTNAME` to the |
| 32 | +domain registered with One Dollar Stats. Without it, the build uses |
| 33 | +`oanalysis.com`. |
| 34 | + |
| 35 | +## Project layout |
| 36 | + |
| 37 | +- `src/store.ts`: Zustand store, undo/redo history, and the IndexedDB autosave |
| 38 | + layer (project JSON plus the map image as a separate Blob) |
| 39 | +- `src/utils/project.ts`: open, save, and the confirm-before-replacing flow |
| 40 | +- `src/utils/projectValidation.ts`: checks every entry of a `.anal` file before |
| 41 | + it is loaded |
| 42 | +- `src/utils/export.ts`, `src/utils/exportScale.ts`: PNG composition and the |
| 43 | + iOS canvas-size limit |
| 44 | +- `src/components/canvas/`: Konva layers for the map, GPX tracks and markers |
| 45 | +- `src/utils/gpx.ts`, `gpxMetrics.ts`: GPX parsing and per-point metrics |
| 46 | + |
| 47 | +## Project file format |
| 48 | + |
| 49 | +`.anal` files are JSON with `format: "map-analysis"` and `version: 1`. They hold |
| 50 | +the map image as a data URL, GPX tracks, drawings, annotations, and the canvas |
| 51 | +rotation. Older files that embed the map image load without changes. |
| 52 | + |
| 53 | +## Privacy |
31 | 54 |
|
32 | | -See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories. |
| 55 | +The app does not upload map, track or project data. Analytics records only |
| 56 | +anonymous usage events, such as that an export happened. See the Privacy Policy |
| 57 | +inside the app for details. |
0 commit comments