feat: initialize project structure with core components and pages
- Added shared styles for UI components in `src/components/styles.ts`. - Created configuration constants in `src/lib/config.ts`. - Implemented date formatting and greeting functions in `src/lib/dates.ts` and corresponding tests in `src/lib/dates.test.ts`. - Developed incident management functions in `src/lib/incidents.ts` with tests in `src/lib/incidents.test.ts`. - Established navigation structure in `src/lib/navigation.ts`. - Seeded demo data for incidents and users in `src/lib/seed.ts`. - Defined tone classes for UI elements in `src/lib/tones.ts`. - Created type definitions for incidents and related entities in `src/lib/types.ts`. - Set up main application entry point in `src/main.tsx`. - Developed various pages including About, Analytics, Incidents, Locations, Overview, and Report Incident. - Configured testing setup in `src/test/setup.ts` and TypeScript configurations. - Integrated Vite for development and testing with appropriate plugins.
This commit is contained in:
1 parent
732d4d8931
commit
a382fa904a
53 files changed
+3523
-31
No files matched your search
@@ -1,16 +1,50 @@
|
||||
# React + Vite
|
||||
# Open SafetyLog EHS
|
||||
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
|
||||
Free, open-source accident and safety tracking for manufacturing: incident and near-miss reporting, investigations, corrective actions and (planned) OSHA record keeping.
|
||||
|
||||
Currently, two official plugins are available:
|
||||
> **Status: early prototype.** The UI runs on in-memory demo data; nothing is saved yet. See [docs/ROADMAP.md](docs/ROADMAP.md) for the plan and [docs/TODO.md](docs/TODO.md) for open items.
|
||||
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
|
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
||||
## Getting started
|
||||
|
||||
## React Compiler
|
||||
Requires Node.js 22.12 or later (see `.nvmrc`).
|
||||
|
||||
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).
|
||||
```sh
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Expanding the Oxlint configuration
|
||||
## Scripts
|
||||
|
||||
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and Oxlint's TypeScript related rules in your project.
|
||||
| Command | What it does |
|
||||
| --- | --- |
|
||||
| `npm run dev` | Start the dev server |
|
||||
| `npm run build` | Production build to `dist/` |
|
||||
| `npm run lint` | Lint with Oxlint (warnings fail) |
|
||||
| `npm run typecheck` | Type-check with TypeScript |
|
||||
| `npm test` | Unit and component tests (Vitest) |
|
||||
| `npm run test:e2e` | End-to-end tests (Playwright, desktop and mobile). Run `npx playwright install chromium` once first |
|
||||
| `npm run check` | Lint, typecheck, test and build in one go |
|
||||
|
||||
CI runs the same checks on every push and pull request (`.gitea/workflows/ci.yml`).
|
||||
|
||||
## Project layout
|
||||
|
||||
```
|
||||
src/
|
||||
pages/ One component per route
|
||||
components/ Shared UI (layout, tables, form pieces) and shared class strings in styles.ts
|
||||
lib/ Types, domain logic, demo data; no React components
|
||||
index.css Tailwind import and design tokens (@theme)
|
||||
e2e/ Playwright tests
|
||||
docs/ Roadmap and design notes
|
||||
```
|
||||
|
||||
Styling is Tailwind CSS v4. Colors, fonts and small text sizes are defined as theme tokens in `src/index.css`. Fonts are bundled through Fontsource, so the app makes no third-party requests and works on isolated plant networks.
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md). Everyone taking part follows our [Code of Conduct](CODE_OF_CONDUCT.md).
|
||||
|
||||
## License
|
||||
|
||||
[GNU Affero General Public License v3.0](LICENSE). If you run a modified version as a network service, you must offer its source code to its users. The app's About page links to the source; set `VITE_SOURCE_URL` at build time to point it at your fork.
|
||||
Reference in new issue
Block a user