Add progressive web app companion for cross-platform access

Vite + TypeScript PWA that mirrors the Android app's core features:
- Pre-processed shelter data (build-time UTM33N→WGS84 conversion)
- Leaflet map with shelter markers, user location, and offline tiles
- Canvas compass arrow (ported from DirectionArrowView.kt)
- IndexedDB shelter cache with 7-day staleness check
- Service worker with CacheFirst tiles and precached app shell
- i18n for en, nb, nn (ported from Android strings.xml)
- iOS/Android compass handling with low-pass filter
- Respects user map interaction (no auto-snap on pan/zoom)
- Build revision cache-breaker for reliable SW updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-03-08 17:41:38 +01:00
commit e8428de775
12051 changed files with 1799735 additions and 0 deletions

49
pwa/src/i18n/en.ts Normal file
View file

@ -0,0 +1,49 @@
/** English strings — default locale. Ported from res/values/strings.xml. */
export const en: Record<string, string> = {
app_name: 'Tilfluktsrom',
// Status
status_ready: 'Ready',
status_loading: 'Loading shelter data\u2026',
status_updating: 'Updating\u2026',
status_offline: 'Offline mode',
status_shelters_loaded: '%d shelters loaded',
status_no_location: 'Waiting for GPS\u2026',
status_caching_map: 'Caching map for offline use\u2026',
// Loading
loading_shelters: 'Downloading shelter data\u2026',
loading_map: 'Caching map tiles\u2026',
loading_map_explanation:
'Preparing offline map.\nThe map will scroll briefly to cache your surroundings.',
loading_first_time: 'Setting up for first use\u2026',
// Shelter info
shelter_capacity: '%d places',
shelter_room_nr: 'Room %d',
nearest_shelter: 'Nearest shelter',
no_shelters: 'No shelter data available',
// Actions
action_refresh: 'Refresh data',
action_toggle_view: 'Toggle map/compass view',
action_skip: 'Skip',
action_cache_ok: 'Cache map',
action_cache_now: 'Cache now',
warning_no_map_cache: 'No offline map cached. Map requires internet.',
// Permissions
permission_location_title: 'Location permission required',
permission_location_message:
'This app needs your location to find the nearest shelter. Please grant location access.',
permission_denied:
'Location permission denied. The app cannot find nearby shelters without it.',
// Errors
error_download_failed:
'Could not download shelter data. Check your internet connection.',
error_no_data_offline:
'No cached data available. Connect to the internet to download shelter data.',
update_success: 'Shelter data updated',
update_failed: 'Update failed \u2014 using cached data',
};