Skip to content

Commit 3e5a40e

Browse files
authored
Merge pull request #1 from pythonicode/fix/audit-bugs-and-code-health
Fix project-review bugs, autosave and export issues, and code health
2 parents b23df5e + b2b367d commit 3e5a40e

30 files changed

Lines changed: 1726 additions & 7761 deletions

‎.github/workflows/ci.yml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: oven-sh/setup-bun@v2
14+
with:
15+
bun-version: 1.3.11
16+
- run: bun install --frozen-lockfile
17+
- run: bun run lint
18+
- run: bun run test
19+
- run: bun run build

‎README.md‎

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,57 @@
1-
# React + TypeScript + Vite
1+
# O-Analysis
22

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.
46

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.
69

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
911

10-
## React Compiler
12+
Requires [Bun](https://bun.sh) 1.3 or newer.
1113

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+
```
1318

14-
## Expanding the Oxlint configuration
19+
## Scripts
1520

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 |
1728

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
3154

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.

‎bun.lock‎

Lines changed: 821 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<script
1515
defer
1616
src="https://assets.onedollarstats.com/stonks.js"
17-
data-hostname="oanalysis.com"
17+
data-hostname="__ODS_HOSTNAME__"
1818
></script>
1919
</head>
2020
<body>

0 commit comments

Comments
 (0)