maintenance/frontend/vite.config.ts
jtricerolph 43809b7460 Add Web Push notifications for task assignment
When a task is created or reassigned to a staff member, a push notification
is sent to any devices they have subscribed on. Keys are auto-generated on
first boot and stored in the config table (no manual VAPID setup needed).

- Backend: web-push dep, push_subscriptions table, lib/push.js (VAPID +
  send), routes/push.js (vapid-key / subscribe / unsubscribe endpoints),
  push notify wired into task-core createTask and tasks PATCH reassignment
- Frontend: switched vite-plugin-pwa to injectManifest strategy, custom
  sw.js handles precache + push event + notificationclick, usePushSubscription
  hook requests permission and registers subscription on login

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 22:59:16 +00:00

32 lines
902 B
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({
base: '/maintenance/',
plugins: [
react(),
VitePWA({
strategies: 'injectManifest',
srcDir: 'src',
filename: 'sw.js',
registerType: 'autoUpdate',
manifest: {
name: 'Maintenance',
short_name: 'Maint.',
start_url: '/maintenance/',
scope: '/maintenance/',
display: 'standalone',
theme_color: '#b45309',
background_color: '#b45309',
icons: [
{ src: '/maintenance/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
{ src: '/maintenance/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
],
},
injectManifest: {
globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
},
}),
],
})