Add Symfony payload mapping, fixtures, and QA tooling

This commit is contained in:
Bernard Ngandu
2025-10-10 08:48:27 +02:00
parent 16a8af3507
commit 49d93ffc63
48 changed files with 7456 additions and 208 deletions
+30 -62
View File
@@ -1,75 +1,43 @@
# React + TypeScript + Vite
# SignalMap client
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
A collaborative danger zone explorer built with React, Vite, and Leaflet. Crowd members can drop signals on an OpenStreetMap base layer; the UI highlights the hottest areas as a heatmap and keeps track of active contributors without any authentication.
Currently, two official plugins are available:
## Getting started
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
1. Install dependencies (Node.js 20+ recommended):
## React Compiler
```bash
npm install
```
The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.
2. Start the Vite dev server:
Note: This will impact Vite dev & build performances.
```bash
npm run dev
```
## Expanding the ESLint configuration
The app assumes the API is available at `http://localhost:8000/api.php`. You can override this by setting `VITE_API_BASE` in an `.env` file.
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
3. Start the lightweight PHP backend (from the repository root):
```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
```bash
php -S 0.0.0.0:8000 -t server/public
```
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
The backend stores data in `server/var/points.sqlite` (ignored by git). It identifies users by IP address and provides aggregated heatmap cells plus contributor statistics.
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
## Features
- Leaflet + OpenStreetMap map canvas with a live heat layer (via `leaflet.heat`).
- Click-to-report interaction that drops a signal at the clicked coordinates.
- Heatmap aggregation and "danger zone" overlays that spotlight the busiest cells.
- Live contributor feed showing the most recent pings and top spotters.
- Accessible, shadcn-inspired UI components without any authentication requirement.
## Production build
```bash
npm run build
```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
The output will be placed in `dist/`. Serve it with your favourite static host while keeping the PHP API reachable at `/api.php`.