added support for dark mode
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Settings - Baby Monitor</title>
|
||||
<link rel="stylesheet" href="/dark-mode.css" />
|
||||
<script src="/theme-init.js"></script>
|
||||
<link rel="stylesheet" href="/menu.css" />
|
||||
<style>
|
||||
* {
|
||||
@@ -16,7 +18,7 @@
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
|
||||
Cantarell, sans-serif;
|
||||
background-color: #f0f0f0;
|
||||
background-color: var(--bg-primary);
|
||||
min-height: 100vh;
|
||||
max-width: 800px;
|
||||
margin: 2rem auto;
|
||||
@@ -24,20 +26,20 @@
|
||||
}
|
||||
|
||||
.container {
|
||||
background: white;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #333;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 10px;
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: #666;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 30px;
|
||||
font-size: 14px;
|
||||
}
|
||||
@@ -45,12 +47,12 @@
|
||||
.section {
|
||||
margin-bottom: 40px;
|
||||
padding: 20px;
|
||||
background: #f8f9fa;
|
||||
background: var(--bg-tertiary);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.section h2 {
|
||||
color: #333;
|
||||
color: var(--text-primary);
|
||||
font-size: 20px;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
@@ -65,7 +67,7 @@
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
color: #333;
|
||||
color: var(--text-primary);
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
@@ -73,24 +75,27 @@
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 2px solid #e0e0e0;
|
||||
border: 2px solid var(--border-color, #ddd);
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
transition: border-color 0.2s;
|
||||
background-color: var(--input-bg);
|
||||
color: var(--input-text);
|
||||
}
|
||||
|
||||
.form-group input:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
border-color: var(--input-focus-border);
|
||||
}
|
||||
|
||||
.form-group input:disabled {
|
||||
background-color: #f5f5f5;
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.button {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
background: var(--gradient-purple);
|
||||
background-color: #667eea;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
@@ -125,7 +130,7 @@
|
||||
}
|
||||
|
||||
.button.success {
|
||||
background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
|
||||
background: var(--gradient-success);
|
||||
}
|
||||
|
||||
.button.success:hover {
|
||||
@@ -139,20 +144,20 @@
|
||||
}
|
||||
|
||||
.child-card {
|
||||
background: white;
|
||||
background: var(--bg-secondary);
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.child-card h3 {
|
||||
color: #333;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.child-info {
|
||||
color: #666;
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
@@ -169,7 +174,7 @@
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 40px;
|
||||
color: #666;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.alert {
|
||||
@@ -200,7 +205,7 @@
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
background: white;
|
||||
background: var(--bg-secondary);
|
||||
border: 2px solid #667eea;
|
||||
color: #667eea;
|
||||
border-radius: 8px;
|
||||
@@ -233,6 +238,38 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>🌓 Theme Preference</h2>
|
||||
<p style="color: var(--text-secondary); margin-bottom: 20px; font-size: 14px">
|
||||
Choose how Baby Monitor looks to you.
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<div style="display: flex; flex-direction: column; gap: 15px">
|
||||
<label style="display: flex; align-items: center; cursor: pointer; padding: 12px; border: 2px solid var(--border-light); border-radius: 8px; transition: all 0.2s;" class="theme-option" data-theme="light">
|
||||
<input type="radio" name="theme" value="light" style="margin-right: 12px; width: 20px; height: 20px; cursor: pointer;" />
|
||||
<div>
|
||||
<div style="font-weight: 600; color: var(--text-primary); margin-bottom: 4px;">☀️ Light Mode</div>
|
||||
<div style="font-size: 12px; color: var(--text-secondary);">Always use light theme</div>
|
||||
</div>
|
||||
</label>
|
||||
<label style="display: flex; align-items: center; cursor: pointer; padding: 12px; border: 2px solid var(--border-light); border-radius: 8px; transition: all 0.2s;" class="theme-option" data-theme="dark">
|
||||
<input type="radio" name="theme" value="dark" style="margin-right: 12px; width: 20px; height: 20px; cursor: pointer;" />
|
||||
<div>
|
||||
<div style="font-weight: 600; color: var(--text-primary); margin-bottom: 4px;">🌙 Dark Mode</div>
|
||||
<div style="font-size: 12px; color: var(--text-secondary);">Always use dark theme</div>
|
||||
</div>
|
||||
</label>
|
||||
<label style="display: flex; align-items: center; cursor: pointer; padding: 12px; border: 2px solid var(--border-light); border-radius: 8px; transition: all 0.2s;" class="theme-option" data-theme="auto">
|
||||
<input type="radio" name="theme" value="auto" style="margin-right: 12px; width: 20px; height: 20px; cursor: pointer;" />
|
||||
<div>
|
||||
<div style="font-weight: 600; color: var(--text-primary); margin-bottom: 4px;">🔄 Auto</div>
|
||||
<div style="font-size: 12px; color: var(--text-secondary);">Match your browser settings</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>🔑 Change Password</h2>
|
||||
<form id="userForm">
|
||||
@@ -261,12 +298,12 @@
|
||||
"
|
||||
>
|
||||
<h3 style="color: #dc3545; margin-bottom: 15px">⚠️ Danger Zone</h3>
|
||||
<p style="color: #666; margin-bottom: 15px; font-size: 14px">
|
||||
<p style="color: var(--text-secondary); margin-bottom: 15px; font-size: 14px">
|
||||
Deleting your account is permanent and cannot be undone. This will:
|
||||
</p>
|
||||
<ul
|
||||
style="
|
||||
color: #666;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 20px;
|
||||
margin-left: 20px;
|
||||
font-size: 14px;
|
||||
@@ -286,7 +323,7 @@
|
||||
<button
|
||||
class="button"
|
||||
style="
|
||||
background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
|
||||
background: var(--gradient-error);
|
||||
"
|
||||
onclick="confirmDeleteAccount()"
|
||||
>
|
||||
@@ -338,15 +375,15 @@
|
||||
>
|
||||
<div
|
||||
style="
|
||||
background: white;
|
||||
background: var(--bg-secondary);
|
||||
padding: 30px;
|
||||
border-radius: 12px;
|
||||
max-width: 400px;
|
||||
width: 90%;
|
||||
"
|
||||
>
|
||||
<h2 style="margin-top: 0">🔗 Redeem Share Code</h2>
|
||||
<p style="color: #666; margin-bottom: 20px">
|
||||
<h2 style="margin-top: 0; color: var(--text-primary);">🔗 Redeem Share Code</h2>
|
||||
<p style="color: var(--text-secondary); margin-bottom: 20px">
|
||||
Enter the share code to get access to a child.
|
||||
</p>
|
||||
<form id="redeemCodeForm">
|
||||
@@ -360,9 +397,11 @@
|
||||
style="
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 2px solid #e0e0e0;
|
||||
border: 2px solid var(--border-color, #ddd);
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
background-color: var(--input-bg);
|
||||
color: var(--input-text);
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
@@ -402,18 +441,18 @@
|
||||
>
|
||||
<div
|
||||
style="
|
||||
background: white;
|
||||
background: var(--bg-secondary);
|
||||
padding: 30px;
|
||||
border-radius: 12px;
|
||||
max-width: 400px;
|
||||
width: 90%;
|
||||
"
|
||||
>
|
||||
<h2 style="margin-top: 0">🔗 Share Code</h2>
|
||||
<p style="color: #666; margin-bottom: 20px" id="shareCodeChildName"></p>
|
||||
<h2 style="margin-top: 0; color: var(--text-primary);">🔗 Share Code</h2>
|
||||
<p style="color: var(--text-secondary); margin-bottom: 20px" id="shareCodeChildName"></p>
|
||||
<div
|
||||
style="
|
||||
background: #f8f9fa;
|
||||
background: var(--bg-tertiary);
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
@@ -430,7 +469,7 @@
|
||||
style="
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: 2px;
|
||||
"
|
||||
id="shareCodeValue"
|
||||
@@ -451,7 +490,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p style="color: #666; font-size: 14px; margin-bottom: 20px">
|
||||
<p style="color: var(--text-secondary); font-size: 14px; margin-bottom: 20px">
|
||||
Share this code with another user. They can use it in Settings >
|
||||
Redeem Share Code to get access to this child.
|
||||
<br /><br />
|
||||
@@ -478,6 +517,43 @@
|
||||
// Initialize burger menu
|
||||
initBurgerMenu({ includeHome: true });
|
||||
|
||||
// Initialize theme selector
|
||||
function initThemeSelector() {
|
||||
const currentTheme = window.getThemePreference();
|
||||
const themeRadio = document.querySelector(`input[name="theme"][value="${currentTheme}"]`);
|
||||
if (themeRadio) {
|
||||
themeRadio.checked = true;
|
||||
}
|
||||
|
||||
// Add visual feedback for selected theme option
|
||||
updateThemeOptionStyles();
|
||||
|
||||
// Listen for theme changes
|
||||
document.querySelectorAll('input[name="theme"]').forEach(radio => {
|
||||
radio.addEventListener('change', (e) => {
|
||||
window.setTheme(e.target.value);
|
||||
updateThemeOptionStyles();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function updateThemeOptionStyles() {
|
||||
const selectedValue = document.querySelector('input[name="theme"]:checked')?.value;
|
||||
document.querySelectorAll('.theme-option').forEach(option => {
|
||||
const isSelected = option.dataset.theme === selectedValue;
|
||||
if (isSelected) {
|
||||
option.style.borderColor = '#667eea';
|
||||
option.style.background = 'rgba(102, 126, 234, 0.05)';
|
||||
} else {
|
||||
option.style.borderColor = '#e0e0e0';
|
||||
option.style.background = 'transparent';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize theme selector on load
|
||||
initThemeSelector();
|
||||
|
||||
let currentUser = null;
|
||||
let children = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user