- Add build-time version generation script that captures git commit info - Create /api/version endpoint to serve version data - Add version footer component showing commit SHA, date, and branch - Link version SHA to commit on git.deco.sh for easy navigation - Fix footer text duplication issue with i18n translations - Disable mouse wheel zoom on map, require +/- buttons for better UX - Update service worker cache to v4 with new version-footer.js 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
233 lines
14 KiB
HTML
233 lines
14 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title data-i18n="common.appName">Great Lakes Ice Report</title>
|
|
|
|
<!-- PWA Meta Tags -->
|
|
<meta name="description" content="Community-driven winter road conditions and icy hazards tracker for the Great Lakes region" data-i18n="meta.description">
|
|
<meta name="theme-color" content="#2196F3">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
<meta name="apple-mobile-web-app-title" content="Ice Report">
|
|
<meta name="msapplication-TileColor" content="#2196F3">
|
|
<meta name="msapplication-config" content="/browserconfig.xml">
|
|
|
|
<!-- PWA Manifest -->
|
|
<link rel="manifest" href="/manifest.json">
|
|
|
|
<!-- Icons -->
|
|
<link rel="icon" type="image/svg+xml" href="/icons/favicon.svg">
|
|
<link rel="icon" type="image/x-icon" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIj4KICA8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgLnNub3dmbGFrZSB7IGZpbGw6ICMyMTk2RjM7IH0KICAgICAgLmNlbnRlciB7IGZpbGw6ICMxOTc2RDI7IH0KICAgIDwvc3R5bGU+CiAgPC9kZWZzPgogIAogIDxnIGNsYXNzPSJzbm93Zmxha2UiPgogICAgPHJlY3QgeD0iMT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Icons -->
|
|
<link rel="apple-touch-icon" sizes="152x152" href="/icons/icon-152.svg">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/icon-192.svg">
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
|
<link rel="stylesheet" href="style.css">
|
|
<script>
|
|
// Apply theme immediately to prevent flash
|
|
(function() {
|
|
const savedTheme = localStorage.getItem('theme') || 'auto';
|
|
if (savedTheme === 'auto') {
|
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
document.documentElement.setAttribute('data-theme', prefersDark ? 'dark' : 'light');
|
|
} else {
|
|
document.documentElement.setAttribute('data-theme', savedTheme);
|
|
}
|
|
})();
|
|
</script>
|
|
<noscript>
|
|
<style>
|
|
.js-only { display: none !important; }
|
|
.nojs-fallback { display: block !important; }
|
|
</style>
|
|
</noscript>
|
|
|
|
<!-- Internationalization -->
|
|
<script src="i18n.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<header>
|
|
<div class="header-content">
|
|
<div class="header-text">
|
|
<h1><a href="/" style="text-decoration: none; color: inherit;">❄️</a> <span data-i18n="common.appName"></span></h1>
|
|
<p data-i18n="meta.subtitle">Community-reported ICEy road conditions and winter hazards (auto-expire after 48 hours)</p>
|
|
</div>
|
|
<div class="header-controls">
|
|
<div id="language-selector-container" class="language-selector-container"></div>
|
|
<button id="theme-toggle" class="theme-toggle js-only" title="Toggle dark mode" data-i18n="common.darkMode">
|
|
<span class="theme-icon">🌙</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="content">
|
|
<!-- Non-JavaScript fallback notice -->
|
|
<noscript>
|
|
<div class="nojs-notice">
|
|
<p data-i18n="nojs.notice"><strong>JavaScript is disabled.</strong> For the best experience with interactive maps, please enable JavaScript.</p>
|
|
<p><a href="/table" style="color: #007bff; text-decoration: underline;" data-i18n="nojs.viewTable">Click here to view the table-only version →</a></p>
|
|
</div>
|
|
</noscript>
|
|
|
|
<div class="form-section">
|
|
<h2 data-i18n="form.reportConditions">Report ICEy Conditions</h2>
|
|
<form id="location-form" method="POST" action="/submit-report">
|
|
<div class="form-group">
|
|
<label for="address" data-i18n="form.addressLabel">Address or Location *</label>
|
|
<div class="autocomplete-container">
|
|
<input type="text" id="address" name="address" required
|
|
placeholder="Enter address, intersection (e.g., Main St & Second St, City), or landmark" data-i18n-placeholder="form.addressPlaceholder"
|
|
autocomplete="off">
|
|
<div id="autocomplete-list" class="autocomplete-list js-only"></div>
|
|
</div>
|
|
<small class="input-help" data-i18n="form.addressExamples">Examples: "123 Main St, City" or "Main St & Oak Ave, City" or "CVS Pharmacy, City"</small>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="description" data-i18n="form.detailsLabel">Additional Details (Optional)</label>
|
|
<textarea id="description" name="description" rows="3"
|
|
placeholder="Number of vehicles, time observed, etc." data-i18n-placeholder="form.detailsPlaceholder" aria-describedby="description-help"></textarea>
|
|
<small id="description-help" class="input-help" data-i18n="form.detailsHelp">Keep descriptions appropriate and relevant to road conditions. Submissions with inappropriate language will be rejected.</small>
|
|
</div>
|
|
|
|
<button type="submit" id="submit-btn">
|
|
<span id="submit-text" data-i18n="form.reportLocation">Report Location</span>
|
|
<span id="submit-loading" style="display: none;" class="js-only" data-i18n="form.submitting">Submitting...</span>
|
|
</button>
|
|
</form>
|
|
|
|
<div id="message" class="message js-only"></div>
|
|
</div>
|
|
|
|
<div class="map-section">
|
|
<div class="reports-header">
|
|
<h2 data-i18n="map.currentReports">Current Reports</h2>
|
|
<div class="view-toggle js-only">
|
|
<button id="map-view-btn" class="toggle-btn active" data-i18n="navigation.mapView">📍 Map View</button>
|
|
<button id="table-view-btn" class="toggle-btn" data-i18n="navigation.tableView">📋 Table View</button>
|
|
<a href="/table" class="toggle-btn" style="text-decoration: none; line-height: normal;" title="Server-side view that works without JavaScript">📊 Basic View</a>
|
|
</div>
|
|
<noscript>
|
|
<div class="nojs-fallback" style="display: block;">
|
|
<div style="text-align: center; margin: 24px 0;">
|
|
<h3 data-i18n="map.staticMapOverview">Static Map Overview</h3>
|
|
<img src="/map-image.png?width=600&height=400"
|
|
alt="Static map showing ice report locations"
|
|
style="max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
|
|
<p style="font-size: 14px; color: #666; margin-top: 8px;" data-i18n="map.markerLegend">
|
|
Red markers: Regular reports | Orange markers: Persistent reports
|
|
</p>
|
|
</div>
|
|
<p style="text-align: center;"><a href="/table" style="color: #007bff; text-decoration: underline;" data-i18n="nojs.viewDetailed">📋 View Detailed Table Format →</a></p>
|
|
</div>
|
|
</noscript>
|
|
</div>
|
|
|
|
<div id="map-view" class="view-container js-only">
|
|
<div id="map"></div>
|
|
<div class="map-info">
|
|
<p data-i18n="map.redMarkers"><strong>🔴 Red markers:</strong> Icy conditions reported</p>
|
|
<p data-i18n="map.autoCleanup"><strong>⏰ Auto-cleanup:</strong> Reports disappear after 48 hours</p>
|
|
<p id="location-count" data-i18n="common.loading">Loading locations...</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="table-view" class="view-container js-only" style="display: none;">
|
|
<div class="table-controls">
|
|
<div class="table-info">
|
|
<p id="table-location-count" data-i18n="common.loading">Loading locations...</p>
|
|
</div>
|
|
</div>
|
|
<div class="table-container">
|
|
<table class="reports-table">
|
|
<thead>
|
|
<tr>
|
|
<th data-i18n="table.headers.location">Location</th>
|
|
<th data-i18n="table.headers.details">Details</th>
|
|
<th data-i18n="table.headers.reported">Reported</th>
|
|
<th data-i18n="table.headers.timeRemaining">Time Remaining</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="reports-tbody">
|
|
<tr>
|
|
<td colspan="4" class="loading" data-i18n="table.loading">Loading reports...</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<footer>
|
|
<p><span data-i18n="footer.safetyNotice">Safety Notice: This is a community tool for awareness. Stay safe and</span> <a href="https://www.aclu.org/know-your-rights/immigrants-rights" target="_blank" rel="noopener noreferrer" style="color: #007bff; text-decoration: underline;" data-i18n="footer.knowRights">know your rights</a>.</p>
|
|
<div class="disclaimer">
|
|
<small><span data-i18n="footer.disclaimer">This website is for informational purposes only. Verify information independently. Reports are automatically deleted after 48 hours.</span> • <a href="/privacy" style="color: #007bff; text-decoration: underline;" data-i18n="common.privacyPolicy">Privacy Policy</a></small>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
|
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
|
<script src="utils.js"></script>
|
|
<script src="app-mapbox.js"></script>
|
|
<script src="version-footer.js"></script>
|
|
|
|
<!-- PWA Service Worker Registration -->
|
|
<script>
|
|
// Register service worker for PWA functionality
|
|
if ('serviceWorker' in navigator) {
|
|
window.addEventListener('load', () => {
|
|
navigator.serviceWorker.register('/sw.js')
|
|
.then((registration) => {
|
|
console.log('✅ Service Worker registered successfully:', registration.scope);
|
|
|
|
// Check for updates
|
|
registration.addEventListener('updatefound', () => {
|
|
const newWorker = registration.installing;
|
|
if (newWorker) {
|
|
newWorker.addEventListener('statechange', () => {
|
|
if (newWorker.state === 'installed') {
|
|
if (navigator.serviceWorker.controller) {
|
|
// New content available, notify user
|
|
console.log('🔄 New content available! Please refresh.');
|
|
// Could show a notification here
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
})
|
|
.catch((error) => {
|
|
console.warn('❌ Service Worker registration failed:', error);
|
|
});
|
|
});
|
|
} else {
|
|
console.log('Service Worker not supported in this browser');
|
|
}
|
|
|
|
// PWA Install Prompt
|
|
let deferredPrompt;
|
|
|
|
window.addEventListener('beforeinstallprompt', (e) => {
|
|
console.log('💾 PWA install prompt available');
|
|
// Prevent Chrome 67 and earlier from automatically showing the prompt
|
|
e.preventDefault();
|
|
// Stash the event so it can be triggered later
|
|
deferredPrompt = e;
|
|
|
|
// Could show custom install button here
|
|
// For now, let the browser handle it naturally
|
|
});
|
|
|
|
window.addEventListener('appinstalled', (evt) => {
|
|
console.log('🎉 PWA was installed successfully!');
|
|
deferredPrompt = null;
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|