added manifest and icon
This commit is contained in:
parent
64da46717a
commit
3b12d78348
BIN
images/icon-512.png
Normal file
BIN
images/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
14
index.html
14
index.html
@ -9,6 +9,7 @@
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<style>
|
||||
body { font-family: 'Inter', sans-serif; }
|
||||
.hidden { display: none; }
|
||||
@ -289,5 +290,18 @@
|
||||
signOutBtn.addEventListener('click', () => handleSignOut());
|
||||
updateUI();
|
||||
</script>
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/sw.js')
|
||||
.then(registration => {
|
||||
console.log('Service Worker registered successfully:', registration);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('Service Worker registration failed:', error);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
17
manifest.json
Normal file
17
manifest.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "TimeTracker",
|
||||
"short_name": "TimeTrack",
|
||||
"description": "A simple time tracking application for employees and admins.",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#ffffff",
|
||||
"theme_color": "#2563EB",
|
||||
"orientation": "portrait-primary",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/images/icon-512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
]
|
||||
}
|
||||
34
sw.js
Normal file
34
sw.js
Normal file
@ -0,0 +1,34 @@
|
||||
const CACHE_NAME = 'timetracker-v1';
|
||||
// Add the paths to the files you want to cache
|
||||
const urlsToCache = [
|
||||
'/',
|
||||
'/index.html'
|
||||
// If you had separate CSS or JS files, you would add them here too.
|
||||
// e.g., '/style.css', '/app.js'
|
||||
];
|
||||
|
||||
// Install the service worker and cache the app shell
|
||||
self.addEventListener('install', event => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME)
|
||||
.then(cache => {
|
||||
console.log('Opened cache');
|
||||
return cache.addAll(urlsToCache);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// Intercept network requests and serve from cache if available
|
||||
self.addEventListener('fetch', event => {
|
||||
event.respondWith(
|
||||
caches.match(event.request)
|
||||
.then(response => {
|
||||
// Cache hit - return response
|
||||
if (response) {
|
||||
return response;
|
||||
}
|
||||
// Not in cache - fetch from network
|
||||
return fetch(event.request);
|
||||
})
|
||||
);
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user