diff --git a/client/package-lock.json b/client/package-lock.json index cc2f065..bf2e852 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -36,6 +36,9 @@ "typescript-eslint": "^8.59.2", "vite": "^8.0.12", "vite-plugin-pwa": "^1.3.0" + }, + "optionalDependencies": { + "@rolldown/binding-linux-x64-gnu": "^1.0.2" } }, "node_modules/@apideck/better-ajv-errors": { @@ -2096,7 +2099,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ diff --git a/client/package.json b/client/package.json index c1c80d7..ed5cce8 100644 --- a/client/package.json +++ b/client/package.json @@ -38,5 +38,8 @@ "typescript-eslint": "^8.59.2", "vite": "^8.0.12", "vite-plugin-pwa": "^1.3.0" + }, + "optionalDependencies": { + "@rolldown/binding-linux-x64-gnu": "^1.0.2" } } diff --git a/client/src/App.tsx b/client/src/App.tsx index df142f2..590b247 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -23,6 +23,7 @@ import { } from './services/appearance.js' import { startBackgroundSync, stopBackgroundSync, syncAllLogbooks, subscribeToSyncState } from './services/sync.js' import ReadOnlyViewer from './components/ReadOnlyViewer.tsx' +import DemoViewer from './components/DemoViewer.tsx' import PwaInstallPrompt from './components/PwaInstallPrompt.tsx' import PwaUpdatePrompt from './components/PwaUpdatePrompt.tsx' import AppFooter from './components/AppFooter.tsx' @@ -57,6 +58,9 @@ function App() { const [shareToken, setShareToken] = useState('') const [shareKey, setShareKey] = useState('') + // Public demo mode (no account required) + const [isDemoMode, setIsDemoMode] = useState(false) + const syncQueueCount = useLiveQuery( () => activeLogbookId ? db.syncQueue.where({ logbookId: activeLogbookId }).count() : db.syncQueue.count(), [activeLogbookId] @@ -138,6 +142,11 @@ function App() { const params = new URLSearchParams(window.location.search) const hashParams = new URLSearchParams(window.location.hash.substring(1)) + if (window.location.pathname === '/demo') { + setIsDemoMode(true) + return + } + if (window.location.pathname === '/share' && params.has('token') && hashParams.has('key')) { setShareToken(params.get('token') || '') setShareKey(hashParams.get('key') || '') @@ -234,6 +243,19 @@ function App() { i18n.changeLanguage(nextLang) } + const handleExitDemo = () => { + window.history.replaceState({}, document.title, '/') + setIsDemoMode(false) + } + + if (isDemoMode) { + return ( +