6e85917f73
Kids math practice (SL/EN) in a Vite React app, wrapped with Capacitor for Android (net.bit76.matematika). Includes session refactor, i18n, and text-free difficulty icons with translated overlays.
85 lines
2.5 KiB
Markdown
85 lines
2.5 KiB
Markdown
# Zabavna Matematika
|
||
|
||
Kids math practice game in Slovene. Players pick `+`, `−`, `×`, and/or `÷`, then play a short session. Difficulty changes **how** they answer, not which operations are allowed.
|
||
|
||
| Difficulty | Label | How you answer |
|
||
|---|---|---|
|
||
| Easy | Lahko | 4 large choice buttons |
|
||
| Medium | Srednje | 6 choice buttons |
|
||
| Hard | Težko | On-screen keypad + OK |
|
||
|
||
One game codebase: **web** in the browser, **Android** as a Capacitor shell around the same build. There is no backend. Settings, audio, and language (`sl` / `en`) stay in `localStorage`. The UI follows a saved language, otherwise the device (`sl*` → Slovene, everything else → English). Switch it in Settings (gear).
|
||
|
||
## Play (browser)
|
||
|
||
From the repo root:
|
||
|
||
```bash
|
||
cd web
|
||
npm install
|
||
npm run dev
|
||
```
|
||
|
||
Or from the root: `npm run dev` (forwards into `web/`).
|
||
|
||
Open the URL Vite prints (usually `http://localhost:5173`).
|
||
|
||
1. Wait for **Nadaljuj** after assets load.
|
||
2. Tap which operations to practice and a difficulty.
|
||
3. **IGRAJ** → confirm question count / ranges → play.
|
||
|
||
`npm run build` writes a static site to `web/dist/`.
|
||
`npm run preview` serves that build.
|
||
|
||
The app uses relative asset paths (`base: './'`), so `dist/` can go in a subfolder on any static host.
|
||
|
||
## Android
|
||
|
||
Same game, wrapped for phones and tablets. Details: [docs/ANDROID.md](docs/ANDROID.md).
|
||
|
||
```bash
|
||
cd web
|
||
npm install
|
||
npm run android
|
||
```
|
||
|
||
That builds the web app, syncs it into `web/android/`, and opens Android Studio. You need Android Studio + an SDK / emulator (or a device).
|
||
|
||
## Project layout
|
||
|
||
```
|
||
ZabavnaMatematika/
|
||
README.md
|
||
LEVELS.md
|
||
docs/
|
||
package.json root shortcuts (dev, build, test, android)
|
||
web/ Vite + React game (the product)
|
||
src/
|
||
public/
|
||
capacitor.config.json
|
||
android/ Capacitor Android project (after first sync)
|
||
```
|
||
|
||
## Docs
|
||
|
||
- [LEVELS.md](LEVELS.md) — what each difficulty does
|
||
- [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) — architecture, session loop, tests
|
||
- [docs/ANDROID.md](docs/ANDROID.md) — Play Store / Capacitor workflow
|
||
- [web/public/privacy.html](web/public/privacy.html) — privacy policy (Slovene)
|
||
|
||
## Tests
|
||
|
||
```bash
|
||
npm test # from repo root, or: cd web && npm test
|
||
npm run smoke # needs Playwright; start preview first
|
||
```
|
||
|
||
```bash
|
||
npm run preview -- --host 127.0.0.1 --port 4175
|
||
# other terminal
|
||
set SMOKE_URL=http://127.0.0.1:4175/
|
||
npm run smoke
|
||
```
|
||
|
||
Playwright is not a project dependency. Install it locally if you want the smoke script (`npm install --no-save playwright` inside `web/`).
|