Implement comprehensive PWA with offline Bible reading capabilities
- Add Web App Manifest with app metadata, icons, and installation support - Create Service Worker with intelligent caching strategies for Bible content, static assets, and dynamic content - Implement IndexedDB-based offline storage system for Bible versions, books, chapters, and verses - Add offline download manager component for browsing and downloading Bible versions - Create offline Bible reader component for seamless offline reading experience - Integrate PWA install prompt with platform-specific instructions - Add offline reading interface to existing Bible reader with download buttons - Create dedicated offline page with tabbed interface for reading and downloading - Add PWA and offline-related translations for English and Romanian locales - Implement background sync for Bible downloads and cache management - Add storage usage monitoring and management utilities - Ensure SSR-safe implementation with dynamic imports for client-side components 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
152
public/offline.html
Normal file
152
public/offline.html
Normal file
@@ -0,0 +1,152 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Offline - Biblical Guide</title>
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
background: linear-gradient(135deg, #009688 0%, #00796B 100%);
|
||||
color: white;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
max-width: 400px;
|
||||
padding: 2rem;
|
||||
}
|
||||
.icon {
|
||||
font-size: 4rem;
|
||||
margin-bottom: 1rem;
|
||||
opacity: 0.8;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
font-weight: 300;
|
||||
}
|
||||
p {
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 2rem;
|
||||
opacity: 0.9;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
button {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||
color: white;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
button:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
border-color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
.status {
|
||||
margin-top: 1rem;
|
||||
font-size: 0.9rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
.offline-content {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem;
|
||||
margin-top: 2rem;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
.verse {
|
||||
font-style: italic;
|
||||
font-size: 1.1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.reference {
|
||||
font-size: 0.9rem;
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="icon">📖</div>
|
||||
<h1>You're Offline</h1>
|
||||
<p>No internet connection detected. You can still access your downloaded Bible versions and continue reading.</p>
|
||||
|
||||
<div class="actions">
|
||||
<button onclick="checkConnection()">Check Connection</button>
|
||||
<button onclick="goToHomePage()">Continue Offline</button>
|
||||
<button onclick="viewDownloads()">View Downloads</button>
|
||||
</div>
|
||||
|
||||
<div class="offline-content">
|
||||
<div class="verse">
|
||||
"For the word of God is alive and active. Sharper than any double-edged sword..."
|
||||
</div>
|
||||
<div class="reference">Hebrews 4:12</div>
|
||||
</div>
|
||||
|
||||
<div class="status" id="status">
|
||||
Offline mode - Limited functionality available
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Check if we're online
|
||||
function updateStatus() {
|
||||
const status = document.getElementById('status');
|
||||
if (navigator.onLine) {
|
||||
status.textContent = 'Connection restored! You can refresh the page.';
|
||||
status.style.color = '#4CAF50';
|
||||
} else {
|
||||
status.textContent = 'Offline mode - Limited functionality available';
|
||||
status.style.color = 'rgba(255, 255, 255, 0.7)';
|
||||
}
|
||||
}
|
||||
|
||||
function checkConnection() {
|
||||
updateStatus();
|
||||
if (navigator.onLine) {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function goToHomePage() {
|
||||
window.location.href = '/';
|
||||
}
|
||||
|
||||
function viewDownloads() {
|
||||
window.location.href = '/bible?offline=true';
|
||||
}
|
||||
|
||||
// Listen for online/offline events
|
||||
window.addEventListener('online', updateStatus);
|
||||
window.addEventListener('offline', updateStatus);
|
||||
|
||||
// Initial status check
|
||||
updateStatus();
|
||||
|
||||
// Auto-refresh when connection is restored
|
||||
window.addEventListener('online', () => {
|
||||
setTimeout(() => {
|
||||
if (navigator.onLine) {
|
||||
window.location.reload();
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user