Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ logs/
# Local scratch / testing artifacts
/1.mp4
/frames-focus/

# Runtime uploads (served from /uploads)
/uploads/

# Local capture artifacts
/drag ghosting.mp4

Large diffs are not rendered by default.

769 changes: 0 additions & 769 deletions client-dist/assets/index-CIHictPt.js

This file was deleted.

769 changes: 769 additions & 0 deletions client-dist/assets/index-DwDMtocl.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions client-dist/assets/manifest-D-CrtgCD.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "FreemanNotes",
"short_name": "Freeman",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#121212",
"theme_color": "#121212",
"icons": [
{ "src": "/icons/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any maskable" },
{ "src": "/icons/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" }
]
}
12 changes: 0 additions & 12 deletions client-dist/assets/manifest-DdfYsMAL.webmanifest

This file was deleted.

Binary file added client-dist/icons/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client-dist/icons/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions client-dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>FreemanNotes — Phase 1</title>
<link rel="icon" href="/icons/darkicon.png" type="image/png" />
<link rel="manifest" href="/assets/manifest-DdfYsMAL.webmanifest" />
<script type="module" crossorigin src="/assets/index-CIHictPt.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-zH6tZKqf.css">
<link rel="manifest" href="/assets/manifest-D-CrtgCD.webmanifest" />
<script type="module" crossorigin src="/assets/index-DwDMtocl.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-8QhtjFsl.css">
</head>
<body>
<div id="root"></div>
Expand Down
16 changes: 16 additions & 0 deletions client-dist/sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Minimal service worker to satisfy PWA installability criteria.
// Intentionally no offline caching yet; fetch is pass-through.

self.addEventListener('install', (event) => {
try { self.skipWaiting(); } catch {}
});

self.addEventListener('activate', (event) => {
event.waitUntil((async () => {
try { await self.clients.claim(); } catch {}
})());
});

self.addEventListener('fetch', (event) => {
// No-op: allow browser to handle requests normally.
});
5 changes: 3 additions & 2 deletions client/manifest.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"name": "FreemanNotes",
"short_name": "Freeman",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#121212",
"theme_color": "#121212",
"icons": [
{ "src": "/icons/darkicon.png", "sizes": "any", "type": "image/png", "purpose": "any maskable" },
{ "src": "/icons/freemannotes-dark.svg", "sizes": "512x512", "type": "image/svg+xml", "purpose": "any maskable" }
{ "src": "/icons/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any maskable" },
{ "src": "/icons/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" }
]
}
Binary file added client/public/icons/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/icons/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions client/public/sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Minimal service worker to satisfy PWA installability criteria.
// Intentionally no offline caching yet; fetch is pass-through.

self.addEventListener('install', (event) => {
try { self.skipWaiting(); } catch {}
});

self.addEventListener('activate', (event) => {
event.waitUntil((async () => {
try { await self.clients.claim(); } catch {}
})());
});

self.addEventListener('fetch', (event) => {
// No-op: allow browser to handle requests normally.
});
35 changes: 35 additions & 0 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import React from "react";
import Header from "./components/Header";
import Sidebar from "./components/Sidebar";
import AuthGate from "./components/AuthGate";
import PwaInstallModal from "./components/PwaInstallModal";
import { AuthProvider, useAuth } from "./authContext";
import { ThemeProvider } from "./themeContext";
import { DEFAULT_SORT_CONFIG, SortConfig } from './sortTypes';
import { usePwaInstall } from './lib/pwaInstall';

/**
* Phase 1 app shell.
Expand All @@ -22,6 +24,9 @@ export default function App(): JSX.Element {

function AppShell(): JSX.Element {
const { user, token } = useAuth();
const { canInstall, isInstalled } = usePwaInstall();
const [showPwaInstall, setShowPwaInstall] = React.useState(false);
const lastPwaNudgeAtRef = React.useRef<number>(0);
const [selectedLabelIds, setSelectedLabelIds] = React.useState<number[]>([]);
const [selectedCollaboratorId, setSelectedCollaboratorId] = React.useState<number | null>(null);
const [collectionStack, setCollectionStack] = React.useState<Array<{ id: number; name: string }>>([]);
Expand Down Expand Up @@ -101,6 +106,26 @@ function AppShell(): JSX.Element {
};
}, []);

React.useEffect(() => {
// We can’t show the native browser install prompt without a user gesture.
// Instead, show our own modal nudge when install becomes available.
if (!user) return;
if (isInstalled) return;
if (!canInstall) return;
try {
const now = Date.now();
const dismissedAt = Number(localStorage.getItem('pwa.installNudge.dismissedAt') || '0') || 0;
const coolDownMs = 7 * 24 * 60 * 60 * 1000;
if (dismissedAt && (now - dismissedAt) < coolDownMs) return;
if (lastPwaNudgeAtRef.current && (now - lastPwaNudgeAtRef.current) < 30_000) return;
lastPwaNudgeAtRef.current = now;
const t = window.setTimeout(() => {
try { setShowPwaInstall(true); } catch {}
}, 900);
return () => { try { window.clearTimeout(t); } catch {} };
} catch {}
}, [user, canInstall, isInstalled]);

React.useEffect(() => {
if (!isPhone) return;
if (backRootArmedRef.current) return;
Expand Down Expand Up @@ -475,6 +500,16 @@ function AppShell(): JSX.Element {
</div>
</>
)}

{showPwaInstall && (
<PwaInstallModal
isPhone={isPhone}
onClose={() => {
try { localStorage.setItem('pwa.installNudge.dismissedAt', String(Date.now())); } catch {}
setShowPwaInstall(false);
}}
/>
)}
</div>
);
}
Loading