First template code generated from replit.com
This commit is contained in:
109
client/public/manifest.json
Normal file
109
client/public/manifest.json
Normal file
@@ -0,0 +1,109 @@
|
||||
{
|
||||
"name": "WarehouseTrack Pro",
|
||||
"short_name": "WarehouseTrack",
|
||||
"description": "Mobile warehouse inventory management system with document generation and barcode scanning",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"theme_color": "#2563eb",
|
||||
"background_color": "#ffffff",
|
||||
"orientation": "any",
|
||||
"scope": "/",
|
||||
"categories": ["business", "productivity", "utilities"],
|
||||
"lang": "en",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icons/icon-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-128x128.png",
|
||||
"sizes": "128x128",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-152x152.png",
|
||||
"sizes": "152x152",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
}
|
||||
],
|
||||
"shortcuts": [
|
||||
{
|
||||
"name": "Scan Product",
|
||||
"short_name": "Scan",
|
||||
"description": "Quick access to barcode scanner",
|
||||
"url": "/scanner",
|
||||
"icons": [{ "src": "/icons/icon-96x96.png", "sizes": "96x96" }]
|
||||
},
|
||||
{
|
||||
"name": "Inventory",
|
||||
"short_name": "Inventory",
|
||||
"description": "View and manage inventory",
|
||||
"url": "/inventory",
|
||||
"icons": [{ "src": "/icons/icon-96x96.png", "sizes": "96x96" }]
|
||||
},
|
||||
{
|
||||
"name": "Documents",
|
||||
"short_name": "Documents",
|
||||
"description": "Create transportation documents",
|
||||
"url": "/documents",
|
||||
"icons": [{ "src": "/icons/icon-96x96.png", "sizes": "96x96" }]
|
||||
}
|
||||
],
|
||||
"screenshots": [
|
||||
{
|
||||
"src": "/screenshots/mobile-dashboard.png",
|
||||
"sizes": "390x844",
|
||||
"type": "image/png",
|
||||
"form_factor": "narrow",
|
||||
"label": "Mobile Dashboard - Inventory Overview"
|
||||
},
|
||||
{
|
||||
"src": "/screenshots/tablet-dashboard.png",
|
||||
"sizes": "768x1024",
|
||||
"type": "image/png",
|
||||
"form_factor": "wide",
|
||||
"label": "Tablet Dashboard - Enhanced Layout"
|
||||
},
|
||||
{
|
||||
"src": "/screenshots/tablet-landscape.png",
|
||||
"sizes": "1024x768",
|
||||
"type": "image/png",
|
||||
"form_factor": "wide",
|
||||
"label": "Tablet Landscape - Sidebar Navigation"
|
||||
}
|
||||
]
|
||||
}
|
||||
95
client/public/sw.js
Normal file
95
client/public/sw.js
Normal file
@@ -0,0 +1,95 @@
|
||||
// Service Worker for WarehouseTrack Pro PWA
|
||||
const CACHE_NAME = 'warehousetrack-v1';
|
||||
const urlsToCache = [
|
||||
'/',
|
||||
'/manifest.json',
|
||||
'/src/index.css',
|
||||
'/src/main.tsx',
|
||||
'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap'
|
||||
];
|
||||
|
||||
// Install event
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME)
|
||||
.then((cache) => cache.addAll(urlsToCache))
|
||||
.then(() => self.skipWaiting())
|
||||
);
|
||||
});
|
||||
|
||||
// Activate event
|
||||
self.addEventListener('activate', (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys().then((cacheNames) => {
|
||||
return Promise.all(
|
||||
cacheNames.map((cacheName) => {
|
||||
if (cacheName !== CACHE_NAME) {
|
||||
return caches.delete(cacheName);
|
||||
}
|
||||
})
|
||||
);
|
||||
}).then(() => self.clients.claim())
|
||||
);
|
||||
});
|
||||
|
||||
// Fetch event - Network First Strategy for API calls, Cache First for static assets
|
||||
self.addEventListener('fetch', (event) => {
|
||||
const { request } = event;
|
||||
|
||||
// Handle API requests with network-first strategy
|
||||
if (request.url.includes('/api/')) {
|
||||
event.respondWith(
|
||||
fetch(request)
|
||||
.then((response) => {
|
||||
// Don't cache POST/PUT/DELETE requests
|
||||
if (request.method === 'GET' && response.status === 200) {
|
||||
const responseClone = response.clone();
|
||||
caches.open(CACHE_NAME)
|
||||
.then((cache) => cache.put(request, responseClone));
|
||||
}
|
||||
return response;
|
||||
})
|
||||
.catch(() => {
|
||||
// Fall back to cache if network fails
|
||||
return caches.match(request);
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle static assets with cache-first strategy
|
||||
event.respondWith(
|
||||
caches.match(request)
|
||||
.then((response) => {
|
||||
// Return cached version or fetch from network
|
||||
return response || fetch(request)
|
||||
.then((response) => {
|
||||
// Don't cache non-successful responses
|
||||
if (!response || response.status !== 200 || response.type !== 'basic') {
|
||||
return response;
|
||||
}
|
||||
|
||||
const responseToCache = response.clone();
|
||||
caches.open(CACHE_NAME)
|
||||
.then((cache) => cache.put(request, responseToCache));
|
||||
|
||||
return response;
|
||||
});
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// Handle background sync for offline actions
|
||||
self.addEventListener('sync', (event) => {
|
||||
if (event.tag === 'stock-update') {
|
||||
event.waitUntil(
|
||||
// Handle offline stock updates when back online
|
||||
handleOfflineStockUpdates()
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Placeholder function for handling offline updates
|
||||
function handleOfflineStockUpdates() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
Reference in New Issue
Block a user