localgreenchain/public/offline.html
Claude c2a1b05677
Implement Agent 10: Mobile Optimization with PWA capabilities
This implements the mobile optimization agent (P3 - Enhancement) with:

PWA Configuration:
- Add next-pwa integration with offline caching strategies
- Create web app manifest for installability
- Add service worker with background sync support
- Create offline fallback page

Mobile Components:
- BottomNav: Touch-friendly bottom navigation bar
- MobileHeader: Responsive header with back navigation
- InstallPrompt: Smart PWA install prompt (iOS & Android)
- SwipeableCard: Gesture-based swipeable cards
- PullToRefresh: Native-like pull to refresh
- QRScanner: Camera-based QR code scanning

Mobile Library:
- camera.ts: Camera access and photo capture utilities
- offline.ts: IndexedDB-based offline storage and sync
- gestures.ts: Touch gesture detection (swipe, pinch, tap)
- pwa.ts: PWA status, install prompts, service worker management

Mobile Pages:
- /m: Mobile dashboard with quick actions and stats
- /m/scan: QR code scanner for plant lookup
- /m/quick-add: Streamlined plant registration form
- /m/profile: User profile with offline status

Dependencies added: next-pwa, idb
2025-11-23 03:56:30 +00:00

149 lines
3.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Offline - LocalGreenChain</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.offline-container {
background: white;
border-radius: 16px;
padding: 40px;
max-width: 400px;
width: 100%;
text-align: center;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.offline-icon {
width: 80px;
height: 80px;
margin: 0 auto 24px;
background: #f3f4f6;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.offline-icon svg {
width: 40px;
height: 40px;
color: #6b7280;
}
h1 {
font-size: 24px;
font-weight: 700;
color: #111827;
margin-bottom: 12px;
}
p {
color: #6b7280;
font-size: 16px;
line-height: 1.5;
margin-bottom: 24px;
}
.retry-btn {
background: #16a34a;
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: background 0.2s;
}
.retry-btn:hover {
background: #15803d;
}
.retry-btn:active {
transform: scale(0.98);
}
.cached-pages {
margin-top: 32px;
padding-top: 24px;
border-top: 1px solid #e5e7eb;
}
.cached-pages h2 {
font-size: 14px;
font-weight: 600;
color: #374151;
margin-bottom: 12px;
}
.cached-pages ul {
list-style: none;
}
.cached-pages li {
margin: 8px 0;
}
.cached-pages a {
color: #16a34a;
text-decoration: none;
font-size: 14px;
}
.cached-pages a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="offline-container">
<div class="offline-icon">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 5.636a9 9 0 010 12.728m0 0l-2.829-2.829m2.829 2.829L21 21M15.536 8.464a5 5 0 010 7.072m0 0l-2.829-2.829m-4.243 2.829a4.978 4.978 0 01-1.414-2.83m-1.414 5.658a9 9 0 01-2.167-9.238m7.824 2.167a1 1 0 111.414 1.414m-1.414-1.414L3 3m8.293 8.293l1.414 1.414" />
</svg>
</div>
<h1>You're Offline</h1>
<p>It looks like you've lost your internet connection. Don't worry - some features are still available offline.</p>
<button class="retry-btn" onclick="window.location.reload()">
Try Again
</button>
<div class="cached-pages">
<h2>Available Offline</h2>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/m">Mobile Dashboard</a></li>
<li><a href="/plants/explore">Explore Plants</a></li>
</ul>
</div>
</div>
<script>
// Listen for online event to auto-reload
window.addEventListener('online', () => {
window.location.reload();
});
</script>
</body>
</html>