Your favorite shift management application!
feat: Adds PWA support and related build/assets (#84)
panteL83efd21d6268
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.mdindex af57c9c..6d41e40 100644--- a/.github/copilot-instructions.md+++ b/.github/copilot-instructions.md@@ -311,7 +311,6 @@ const {setShowConfirmDialog,handleConfirmClose,} = useDirtyState({- open,onClose: onOpenChange,hasChanges: () => name !== initialName,onConfirm: () => resetForm(), // Optional cleanupdiff --git a/.gitignore b/.gitignoreindex 3f6f1e6..3c88dc8 100644--- a/.gitignore+++ b/.gitignore@@ -69,5 +69,11 @@ Thumbs.db# version info (generated at build time)public/version.json+# PWA files (auto-generated by next-pwa)+public/sw.js+public/sw.js.map+public/workbox-*.js+public/workbox-*.js.map+# scripts (local testing scripts)test-changelog.sh\ No newline at end of filediff --git a/Dockerfile b/Dockerfileindex 36eb9e6..8080ae9 100644--- a/Dockerfile+++ b/Dockerfile@@ -38,6 +38,7 @@ ENV NEXT_TELEMETRY_DISABLED=1# Copy necessary files from builderCOPY --from=builder /app/.next/standalone ./COPY --from=builder /app/.next/static ./.next/static+COPY --from=builder /app/public ./publicCOPY --from=builder /app/drizzle ./drizzleCOPY --from=builder /app/lib ./libCOPY --from=builder /app/package.json ./package.jsondiff --git a/README.md b/README.mdindex 0200118..013b810 100644--- a/README.md+++ b/README.md@@ -1,3 +1,7 @@+<div align="center">+ <img src="public/android/android-launchericon-512-512.png" alt="BetterShift Logo" width="300" height="300" />+</div>+<h1 align="center" id="title">BetterShift</h1><div align="center">@@ -64,6 +68,7 @@- **Auto Update Checks** — Detects new releases with visual notifications- **Integrated Changelog** — View release notes directly in the app+- **PWA Support** — Installable as a Progressive Web App- **Next.js 16 + React 19** — Latest App Router architecture- **SQLite + Drizzle ORM** — Type-safe database with file-based storage- **Docker Ready** — Two-command deployment with Docker Composediff --git a/app/layout.tsx b/app/layout.tsxindex d058cde..8c0ca95 100644--- a/app/layout.tsx+++ b/app/layout.tsx@@ -19,6 +19,32 @@ const geistMono = Geist_Mono({export const metadata: Metadata = {title: "BetterShift - Shift Schedule Manager",description: "Manage your work shifts with ease",+ applicationName: "BetterShift",+ manifest: "/manifest.json",+ appleWebApp: {+ capable: true,+ statusBarStyle: "black-translucent",+ title: "BetterShift",+ },+ formatDetection: {+ telephone: false,+ },+ icons: {+ icon: [+ { url: "/ios/32.png", sizes: "32x32", type: "image/png" },+ {+ url: "/android/android-launchericon-192-192.png",+ sizes: "192x192",+ type: "image/png",+ },+ {+ url: "/android/android-launchericon-512-512.png",+ sizes: "512x512",+ type: "image/png",+ },+ ],+ apple: [{ url: "/ios/180.png", sizes: "180x180", type: "image/png" }],+ },};export const viewport: Viewport = {diff --git a/components/app-header.tsx b/components/app-header.tsxindex 9afaee0..9f4ab26 100644--- a/components/app-header.tsx+++ b/components/app-header.tsx@@ -94,8 +94,8 @@ export function AppHeader({transition={{ duration: 0.3 }}><div className="relative shrink-0">- <div className="w-12 h-12 rounded-2xl bg-gradient-to-br from-primary via-primary/90 to-primary/70 flex items-center justify-center shadow-xl shadow-primary/30 ring-2 ring-primary/20">- <CalendarIcon className="h-6 w-6 text-primary-foreground" />+ <div className="w-12 h-12 rounded-2xl bg-gradient-to-br from-slate-900 via-slate-800 to-slate-700 dark:from-slate-800 dark:via-slate-700 dark:to-slate-600 flex items-center justify-center shadow-xl shadow-slate-900/50 dark:shadow-slate-950/70 ring-2 ring-slate-700/50 dark:ring-slate-600/50">+ <CalendarIcon className="h-6 w-6 text-white" /></div>{/* Connection Status Indicator */}<divdiff --git a/components/calendar-settings-sheet.tsx b/components/calendar-settings-sheet.tsxindex 29da2a1..3a6627a 100644--- a/components/calendar-settings-sheet.tsx+++ b/components/calendar-settings-sheet.tsx@@ -134,7 +134,6 @@ export function CalendarSettingsSheet({setShowConfirmDialog,handleConfirmClose,} = useDirtyState({- open,onClose: onOpenChange,hasChanges,});diff --git a/components/external-sync-manage-sheet.tsx b/components/external-sync-manage-sheet.tsxindex 18fea74..7577ae3 100644--- a/components/external-sync-manage-sheet.tsx+++ b/components/external-sync-manage-sheet.tsx@@ -603,7 +603,6 @@ export function ExternalSyncManageSheet({setShowConfirmDialog,handleConfirmClose,} = useDirtyState({- open,onClose: onOpenChange,hasChanges: hasFormChanges,onConfirm: () => {@@ -1241,7 +1240,6 @@ export function ExternalSyncManageSheet({open={showDeleteConfirm}onOpenChange={setShowDeleteConfirm}onConfirm={confirmDelete}- title={t("common.confirmDelete")}description={t("externalSync.deleteConfirm")}/></>diff --git a/components/preset-manage-sheet.tsx b/components/preset-manage-sheet.tsxindex ba7c510..1407bac 100644--- a/components/preset-manage-sheet.tsx+++ b/components/preset-manage-sheet.tsx@@ -517,7 +517,6 @@ export function PresetManageSheet({setShowConfirmDialog,handleConfirmClose,} = useDirtyState({- open,onClose: onOpenChange,hasChanges: () => (editingPreset || showAddForm) && hasChanges(),onConfirm: resetForm,@@ -555,6 +554,13 @@ export function PresetManageSheet({</SheetHeader><div className="flex-1 overflow-y-auto px-6 py-6 space-y-3">+ {/* Empty state when no presets exist */}+ {presets.length === 0 && !showAddForm && !editingPreset && (+ <p className="text-center text-muted-foreground py-8">+ {t("preset.noPresets")}+ </p>+ )}+{/* Primary Presets List */}{orderedPrimaryPresets.length > 0 &&!showAddForm &&diff --git a/components/ui/base-sheet.tsx b/components/ui/base-sheet.tsxindex 205c3de..648cb6f 100644--- a/components/ui/base-sheet.tsx+++ b/components/ui/base-sheet.tsx@@ -60,7 +60,6 @@ export function BaseSheet({setShowConfirmDialog,handleConfirmClose,} = useDirtyState({- open,onClose: onOpenChange,hasChanges: () => hasUnsavedChanges,});@@ -72,7 +71,7 @@ export function BaseSheet({};const handleCancelClick = () => {- handleClose(false);+ handleClose();};return (diff --git a/hooks/useDirtyState.ts b/hooks/useDirtyState.tsindex 814bd5e..b406925 100644--- a/hooks/useDirtyState.ts+++ b/hooks/useDirtyState.ts@@ -1,7 +1,6 @@import { useState } from "react";interface UseDirtyStateOptions {- open: boolean;onClose: (open: boolean) => void;hasChanges: () => boolean;onConfirm?: () => void;@@ -14,7 +13,6 @@ interface UseDirtyStateOptions {* ```tsx* const { handleClose, showConfirmDialog, setShowConfirmDialog, handleConfirmClose } =* useDirtyState({- * open,* onClose,* hasChanges: () => name !== initialName,* onConfirm: () => resetForm()@@ -35,27 +33,18 @@ interface UseDirtyStateOptions {* ```*/export function useDirtyState({- open,onClose,hasChanges,onConfirm,}: UseDirtyStateOptions) {const [showConfirmDialog, setShowConfirmDialog] = useState(false);- const handleClose = (open: boolean) => {- // If opening, just open it- if (open) {- onClose(open);- return;- }-- // If closing with unsaved changes, show confirmation+ const handleClose = () => {if (hasChanges()) {setShowConfirmDialog(true);return;}- // Otherwise close normallyonClose(false);};diff --git a/next-pwa.d.ts b/next-pwa.d.tsnew file mode 100644index 0000000..a73a2f1--- /dev/null+++ b/next-pwa.d.ts@@ -0,0 +1,32 @@+declare module "next-pwa" {+ import { NextConfig } from "next";++ interface PWAConfig {+ dest?: string;+ register?: boolean;+ skipWaiting?: boolean;+ disable?: boolean;+ sw?: string;+ runtimeCaching?: Array<{+ urlPattern: RegExp;+ handler:+ | "CacheFirst"+ | "NetworkFirst"+ | "StaleWhileRevalidate"+ | "NetworkOnly"+ | "CacheOnly";+ options?: {+ cacheName?: string;+ expiration?: {+ maxEntries?: number;+ maxAgeSeconds?: number;+ };+ networkTimeoutSeconds?: number;+ };+ }>;+ }++ export default function withPWA(+ config: PWAConfig+ ): (nextConfig: NextConfig) => NextConfig;+}diff --git a/next.config.ts b/next.config.tsindex 6e5068c..bd9ad2d 100644--- a/next.config.ts+++ b/next.config.ts@@ -6,6 +6,27 @@ const withNextIntl = createNextIntlPlugin("./lib/i18n.ts");const nextConfig: NextConfig = {/* config options here */output: "standalone",+ async headers() {+ return [+ {+ source: "/(.*)",+ headers: [+ {+ key: "X-Content-Type-Options",+ value: "nosniff",+ },+ {+ key: "X-Frame-Options",+ value: "DENY",+ },+ {+ key: "Referrer-Policy",+ value: "strict-origin-when-cross-origin",+ },+ ],+ },+ ];+ },};export default withNextIntl(nextConfig);diff --git a/public/android/android-launchericon-192-192.png b/public/android/android-launchericon-192-192.pngnew file mode 100644index 0000000..8097b74Binary files /dev/null and b/public/android/android-launchericon-192-192.png differdiff --git a/public/android/android-launchericon-512-512.png b/public/android/android-launchericon-512-512.pngnew file mode 100644index 0000000..f358785Binary files /dev/null and b/public/android/android-launchericon-512-512.png differdiff --git a/public/favicon.ico b/public/favicon.iconew file mode 100644index 0000000..853fd8fBinary files /dev/null and b/public/favicon.ico differdiff --git a/public/ios/180.png b/public/ios/180.pngnew file mode 100644index 0000000..be145fdBinary files /dev/null and b/public/ios/180.png differdiff --git a/public/ios/32.png b/public/ios/32.pngnew file mode 100644index 0000000..853fd8fBinary files /dev/null and b/public/ios/32.png differdiff --git a/public/manifest.json b/public/manifest.jsonnew file mode 100644index 0000000..6fd0a38--- /dev/null+++ b/public/manifest.json@@ -0,0 +1,39 @@+{+ "name": "BetterShift - Shift Schedule Manager",+ "short_name": "BetterShift",+ "description": "Manage your work shifts with ease using BetterShift",+ "start_url": "/",+ "display": "standalone",+ "background_color": "#0a0a0a",+ "theme_color": "#0a0a0a",+ "orientation": "portrait-primary",+ "icons": [+ {+ "src": "/android/android-launchericon-192-192.png",+ "sizes": "192x192",+ "type": "image/png",+ "purpose": "any maskable"+ },+ {+ "src": "/android/android-launchericon-512-512.png",+ "sizes": "512x512",+ "type": "image/png",+ "purpose": "any maskable"+ }+ ],+ "categories": ["productivity", "utilities"],+ "shortcuts": [+ {+ "name": "Today's Shifts",+ "short_name": "Today",+ "description": "View today's shift schedule",+ "url": "/",+ "icons": [+ {+ "src": "/android/android-launchericon-192-192.png",+ "sizes": "192x192"+ }+ ]+ }+ ]+}