diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 0000000..663a1d9 Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/icon-192.png b/public/icon-192.png new file mode 100644 index 0000000..df14322 Binary files /dev/null and b/public/icon-192.png differ diff --git a/public/icon-512.png b/public/icon-512.png new file mode 100644 index 0000000..0a2c4e8 Binary files /dev/null and b/public/icon-512.png differ diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..127797d --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,39 @@ +{ + "name": "rNotes - Universal Knowledge Capture", + "short_name": "rNotes", + "description": "Capture notes, clips, bookmarks, code, audio, and files. Organize in notebooks, tag freely.", + "start_url": "/", + "scope": "/", + "id": "/", + "display": "standalone", + "background_color": "#0a0a0a", + "theme_color": "#0a0a0a", + "orientation": "portrait-primary", + "categories": ["productivity", "utilities"], + "icons": [ + { + "src": "/icon-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/icon-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, + { + "src": "/icon-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "/icon-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/public/sw.js b/public/sw.js new file mode 100644 index 0000000..3fbbb0d --- /dev/null +++ b/public/sw.js @@ -0,0 +1,43 @@ +const CACHE_NAME = 'rnotes-v1'; +const PRECACHE = [ + '/', + '/manifest.json', + '/icon-192.png', + '/icon-512.png', +]; + +self.addEventListener('install', (event) => { + event.waitUntil( + caches.open(CACHE_NAME).then((cache) => cache.addAll(PRECACHE)) + ); + self.skipWaiting(); +}); + +self.addEventListener('activate', (event) => { + event.waitUntil( + caches.keys().then((names) => + Promise.all(names.filter((n) => n !== CACHE_NAME).map((n) => caches.delete(n))) + ) + ); + self.clients.claim(); +}); + +self.addEventListener('fetch', (event) => { + const url = new URL(event.request.url); + + // Always go to network for API calls + if (url.pathname.startsWith('/api/')) return; + + // Network-first for pages, cache-first for static assets + event.respondWith( + fetch(event.request) + .then((response) => { + if (response.status === 200) { + const clone = response.clone(); + caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone)); + } + return response; + }) + .catch(() => caches.match(event.request)) + ); +}); diff --git a/src/app/layout.tsx b/src/app/layout.tsx index ecb2bdb..df465bc 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,7 +1,8 @@ -import type { Metadata } from 'next' +import type { Metadata, Viewport } from 'next' import { Inter } from 'next/font/google' import './globals.css' import { AuthProvider } from '@/components/AuthProvider' +import { PWAInstall } from '@/components/PWAInstall' const inter = Inter({ subsets: ['latin'], @@ -11,6 +12,12 @@ const inter = Inter({ export const metadata: Metadata = { title: 'rNotes - Universal Knowledge Capture', description: 'Capture notes, clips, bookmarks, code, and files. Organize in notebooks, tag freely, and collaborate on a visual canvas shared across r*Spaces.', + manifest: '/manifest.json', + appleWebApp: { + capable: true, + statusBarStyle: 'black-translucent', + title: 'rNotes', + }, openGraph: { title: 'rNotes - Universal Knowledge Capture', description: 'Capture notes, clips, bookmarks, code, and files with a collaborative canvas.', @@ -19,6 +26,10 @@ export const metadata: Metadata = { }, } +export const viewport: Viewport = { + themeColor: '#0a0a0a', +} + export default function RootLayout({ children, }: Readonly<{ @@ -26,9 +37,13 @@ export default function RootLayout({ }>) { return ( +
+ +Add to Home Screen
++ Tap{' '} + + ⎋ Share + {' '} + then{' '} + + Add to Home Screen + +
+Install rNotes
+
+ 1. Tap{' '}
+
+ ⋮
+ {' '}
+ (three dots) at top-right
+
+ 2. Tap{' '}
+
+ Add to Home screen
+
+
+ 3. Tap{' '}
+
+ Install
+
+
Install rNotes
+Add to your home screen for quick access
+