Restructure project to root layout

This commit is contained in:
beatz174-bit
2025-11-21 16:10:41 +10:00
parent e0e26a34ab
commit 3ffe9bbf99
51 changed files with 16 additions and 12 deletions
+15
View File
@@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" role="img" aria-label="StockFill logo">
<defs>
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#0d6efd" />
<stop offset="100%" stop-color="#0abf9e" />
</linearGradient>
</defs>
<rect width="200" height="200" rx="24" fill="url(#grad)" />
<g fill="#ffffff">
<rect x="44" y="54" width="112" height="18" rx="9" opacity="0.9" />
<rect x="44" y="91" width="112" height="18" rx="9" opacity="0.9" />
<rect x="44" y="128" width="92" height="18" rx="9" opacity="0.9" />
<circle cx="144" cy="137" r="16" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 661 B

+16
View File
@@ -0,0 +1,16 @@
{
"name": "StockFill",
"short_name": "StockFill",
"start_url": "/",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#0d6efd",
"icons": [
{
"src": "/icons/icon.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "any"
}
]
}
+48
View File
@@ -0,0 +1,48 @@
const CACHE_NAME = 'stockfill-cache-v1';
const OFFLINE_URLS = ['/', '/index.html'];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return cache.addAll(OFFLINE_URLS);
}),
);
});
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((keys) =>
Promise.all(
keys.map((key) => {
if (key !== CACHE_NAME) {
return caches.delete(key);
}
return undefined;
}),
),
),
);
});
self.addEventListener('fetch', (event) => {
const { request } = event;
if (request.method !== 'GET') return;
event.respondWith(
fetch(request)
.then((response) => {
const copy = response.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(request, copy));
return response;
})
.catch(async () => {
const cached = await caches.match(request);
if (cached) return cached;
if (request.mode === 'navigate') {
const fallback = await caches.match('/index.html');
if (fallback) return fallback;
}
throw new Error('Network error');
}),
);
});