feat: PWA support + mobile-responsive layout + QR code to open Atlas on phone
Made-with: Cursor
This commit is contained in:
26
public/manifest.json
Normal file
26
public/manifest.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "VIBN — Build with Atlas",
|
||||
"short_name": "VIBN",
|
||||
"description": "Chat with Atlas to define your product requirements — anywhere, anytime.",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#f6f4f0",
|
||||
"theme_color": "#1a1a1a",
|
||||
"orientation": "portrait-primary",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/vibn-logo-circle.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "/vibn-logo-circle.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
}
|
||||
],
|
||||
"categories": ["productivity", "business"],
|
||||
"lang": "en"
|
||||
}
|
||||
47
public/sw.js
Normal file
47
public/sw.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// VIBN Service Worker — enables PWA install + basic offline shell
|
||||
const CACHE = 'vibn-v1';
|
||||
|
||||
// Cache the app shell on install
|
||||
self.addEventListener('install', (e) => {
|
||||
e.waitUntil(
|
||||
caches.open(CACHE).then(cache =>
|
||||
cache.addAll(['/', '/manifest.json'])
|
||||
)
|
||||
);
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener('activate', () => self.clients.claim());
|
||||
|
||||
// Network-first for API calls, cache-first for static assets
|
||||
self.addEventListener('fetch', (e) => {
|
||||
const { request } = e;
|
||||
const url = new URL(request.url);
|
||||
|
||||
// Never cache API calls
|
||||
if (url.pathname.startsWith('/api/')) return;
|
||||
|
||||
// Cache-first for static assets
|
||||
if (
|
||||
request.destination === 'image' ||
|
||||
request.destination === 'font' ||
|
||||
url.pathname.startsWith('/_next/static/')
|
||||
) {
|
||||
e.respondWith(
|
||||
caches.match(request).then(cached => {
|
||||
if (cached) return cached;
|
||||
return fetch(request).then(res => {
|
||||
const clone = res.clone();
|
||||
caches.open(CACHE).then(c => c.put(request, clone));
|
||||
return res;
|
||||
});
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Network-first for everything else (HTML pages)
|
||||
e.respondWith(
|
||||
fetch(request).catch(() => caches.match(request))
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user