-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
102 lines (101 loc) · 4.48 KB
/
Copy pathindex.html
File metadata and controls
102 lines (101 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- Primary SVG Icon -->
<link rel="icon" type="image/svg+xml" href="/icon.svg?v=1.0" />
<!-- Fallback PNG Icons -->
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?v=1.0" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?v=1.0" />
<link rel="shortcut icon" href="/favicon-32x32.png?v=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#6f42c1" />
<meta
name="description"
content="An experience planning app for travelers and adventurers alike."
/>
<!-- Apple Touch Icons -->
<link rel="apple-touch-icon" sizes="180x180" href="/icon-192x192.png?v=1.0" />
<link rel="apple-touch-icon" sizes="192x192" href="/icon-192x192.png?v=1.0" />
<link rel="apple-touch-icon" sizes="512x512" href="/icon-512x512.png?v=1.0" />
<link rel="manifest" href="/manifest.json?v=1.0" />
<title>Biensperience</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script>
(function() {
try {
var raw = null;
try { raw = localStorage.getItem('biensperience:preferences'); } catch (e) { raw = null; }
var theme = null;
if (raw) {
try {
var prefs = JSON.parse(raw) || {};
if (prefs && prefs.theme) theme = prefs.theme;
} catch (e) { theme = null; }
}
if (!theme) {
// fallback: use system preference
var prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
theme = prefersDark ? 'dark' : 'light';
}
// resolve system-default to actual applied theme
var applied = theme;
if (theme === 'system-default') {
try {
var prefersDark2 = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
applied = prefersDark2 ? 'dark' : 'light';
} catch (e) { applied = 'light'; }
}
document.documentElement.setAttribute('data-theme', applied);
document.documentElement.classList.remove('dark', 'light');
document.documentElement.classList.add(applied);
document.documentElement.style.colorScheme = applied;
} catch (err) {
// ignore
}
})();
</script>
<script>
// CRITICAL: Preserve hash fragments ONLY for direct URL access (page load/refresh)
// React Router doesn't handle hash fragments in URLs during navigation,
// so we capture them here and store in localStorage for React to retrieve
// This should NOT run for in-app navigation (HashLink handles that)
(function() {
try {
// Simple debug logger (console.log wrapper for pre-React environment)
var isDev = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
var log = isDev ? console.log.bind(console) : function() {};
var error = console.error.bind(console); // Always log errors
var hash = window.location.hash || '';
// Only preserve hash if:
// 1. Hash exists and is a plan hash
// 2. localStorage does NOT already have a pending hash (meaning this is a direct URL, not in-app navigation)
if (hash && hash.startsWith('#plan-')) {
var existing = localStorage.getItem('bien:pending_hash');
if (!existing) {
log('[Hash Preservation] Direct URL hash detected:', hash);
// Store hash in localStorage so React can retrieve it after Router strips it
var payload = JSON.stringify({
hash: hash,
originPath: window.location.pathname,
storedAt: Date.now(),
meta: { source: 'direct-url' }
});
localStorage.setItem('bien:pending_hash', payload);
log('[Hash Preservation] Hash stored in localStorage for React to retrieve');
} else {
log('[Hash Preservation] Skipping - pending hash already exists (in-app navigation)');
}
}
} catch (e) {
error('[Hash Preservation] Failed to preserve hash:', e);
}
})();
</script>
<!-- Vite entry point -->
<script type="module" src="/src/index.jsx"></script>
</body>
</html>