feat: make the web app installable and rework the app shell
Add a Vite PWA (`vite-plugin-pwa`): manifest, icons and an `autoUpdate` service worker, plus an install prompt so the app can be added to the home screen. Rework the shell for mobile: mount the bottom navigation bar and the install prompt in the authenticated layout, hide the sidebar trigger below `md`, and add a sign-out card to Settings. Drop the placeholder Tasks page together with its unused shadcn table and the `@tanstack/react-table` dependency, and remove the in-app router/query dev tools.
This commit is contained in:
@@ -4,6 +4,7 @@ import tailwindcss from '@tailwindcss/vite'
|
||||
import { tanstackRouter } from '@tanstack/router-plugin/vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { defineConfig } from 'vite'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
const srcDir = path.resolve(import.meta.dirname, './src')
|
||||
|
||||
@@ -13,6 +14,46 @@ export default defineConfig({
|
||||
tanstackRouter({ target: 'react', autoCodeSplitting: true }),
|
||||
react(),
|
||||
tailwindcss(),
|
||||
VitePWA({
|
||||
// `autoUpdate` pre-caches the app shell and swaps in new releases on the
|
||||
// next navigation. Registration is injected into `index.html` at build
|
||||
// time, so no `virtual:pwa-register` import is needed in the app.
|
||||
registerType: 'autoUpdate',
|
||||
includeAssets: ['favicon.svg', 'apple-touch-icon.png'],
|
||||
manifest: {
|
||||
name: 'Superlist — Listas de compras compartidas',
|
||||
short_name: 'Superlist',
|
||||
description: 'Listas de compras compartidas con las personas de tu hogar.',
|
||||
lang: 'es',
|
||||
start_url: '/',
|
||||
scope: '/',
|
||||
display: 'standalone',
|
||||
orientation: 'portrait',
|
||||
theme_color: '#ffffff',
|
||||
background_color: '#ffffff',
|
||||
icons: [
|
||||
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
|
||||
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
|
||||
{
|
||||
src: 'maskable-512x512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
purpose: 'maskable',
|
||||
},
|
||||
],
|
||||
},
|
||||
workbox: {
|
||||
// Pre-cache the app shell (JS/CSS/HTML + self-hosted Geist fonts).
|
||||
globPatterns: ['**/*.{js,css,html,svg,png,ico,woff2}'],
|
||||
// SPA fallback so deep links work offline, but never swallow API calls.
|
||||
navigateFallback: 'index.html',
|
||||
navigateFallbackDenylist: [/^\/api\//],
|
||||
},
|
||||
devOptions: {
|
||||
// The service worker is only built for `vite build`; verify with `preview`.
|
||||
enabled: false,
|
||||
},
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user