feat(i18n): add internationalization support with English and Spanish translations
feat(kiosk): implement kiosk report submission functionality with offline support test(outbox): add tests for outbox functionality including report submission and error handling feat(outbox): create outbox management for queued reports with IndexedDB persistence feat(uuid): add UUID generation utility for client IDs feat(qr): implement QR code generation for reporting links by site and area feat(kiosk): create Kiosk page for reporting incidents without an account
This commit is contained in:
1 parent
3f6dff5f24
commit
3e964d1176
64 files changed
+10056
-267
No files matched your search
+39
-1
@@ -3,12 +3,50 @@ import react from '@vitejs/plugin-react'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { defineConfig } from 'vite'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
const { version } = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')) as { version: string }
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss()],
|
||||
plugins: [
|
||||
react(),
|
||||
tailwindcss(),
|
||||
// Installable app + offline shell. Service workers need HTTPS (or localhost).
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
includeAssets: ['favicon.svg', 'icons/apple-touch-icon.png'],
|
||||
manifest: {
|
||||
name: 'Open SafetyLog EHS',
|
||||
short_name: 'SafetyLog',
|
||||
description: 'Report hazards, near misses and incidents, and follow them through to closure.',
|
||||
theme_color: '#163c37',
|
||||
background_color: '#f7f8f5',
|
||||
display: 'standalone',
|
||||
start_url: '/',
|
||||
scope: '/',
|
||||
icons: [
|
||||
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
|
||||
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
|
||||
{ src: '/icons/maskable-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' },
|
||||
],
|
||||
shortcuts: [{ name: 'Report an incident', url: '/report', icons: [{ src: '/icons/icon-192.png', sizes: '192x192' }] }],
|
||||
},
|
||||
workbox: {
|
||||
globPatterns: ['**/*.{js,css,html,svg,png,woff2}'],
|
||||
navigateFallback: '/index.html',
|
||||
navigateFallbackDenylist: [/^\/api\//],
|
||||
runtimeCaching: [
|
||||
{
|
||||
// Just enough to open the report form offline: who you are, and the list of sites/areas.
|
||||
urlPattern: ({ url }) => ['/api/auth/me', '/api/sites', '/api/kiosk/config'].includes(url.pathname),
|
||||
handler: 'NetworkFirst',
|
||||
options: { cacheName: 'api-essentials', networkTimeoutSeconds: 5, expiration: { maxEntries: 20, maxAgeSeconds: 7 * 24 * 60 * 60 } },
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
define: { __APP_VERSION__: JSON.stringify(version) },
|
||||
server: {
|
||||
proxy: { '/api': 'http://localhost:3000' },
|
||||
|
||||
Reference in new issue
Block a user