-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
61 lines (54 loc) · 2.09 KB
/
index.html
File metadata and controls
61 lines (54 loc) · 2.09 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="light dark">
<title>Task Manager - Dev</title>
<script>
// CRITICAL: Set theme IMMEDIATELY to prevent white flash
// This runs before any CSS or React code loads
(function() {
try {
// Check sessionStorage first
const savedTheme = sessionStorage.getItem('hadoku-theme');
// Then check browser preference
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
// Use saved theme, or fall back to browser preference
const theme = savedTheme || (prefersDark ? 'dark' : 'light');
// Apply theme to document root IMMEDIATELY
document.documentElement.setAttribute('data-theme', theme);
console.log('[theme-init] Applied initial theme:', theme, {
savedTheme,
prefersDark,
timestamp: new Date().toISOString()
});
} catch (err) {
console.error('[theme-init] Failed to set initial theme:', err);
// Fallback to light if anything fails
document.documentElement.setAttribute('data-theme', 'light');
}
})();
</script>
</head>
<body>
<div id="app"></div>
<script type="module">
import { mount } from './src/app/entry.tsx'
// Get params from URL
const params = new URLSearchParams(window.location.search)
const userType = params.get('userType') || 'public'
const displayName = params.get('displayName') || null
console.log('[mount] Mounting with:', { userType, displayName })
// Mount the app
mount(document.getElementById('app'), {
basename: '/',
userType: userType,
displayName: displayName,
onKeyValidation: (isValid, validatedUserType, validatedDisplayName) => {
console.log('[mount] Key validation result:', { isValid, validatedUserType, validatedDisplayName })
}
})
</script>
</body>
</html>