From 86cc6bbff20402a05ca2fb3100772c3a8cd98f95 Mon Sep 17 00:00:00 2001 From: Kobe Date: Mon, 26 May 2025 09:46:24 +0200 Subject: [PATCH] created space for more settings --- static/css/settings.css | 108 ++++++ static/js/settings.js | 138 ++++++++ templates/rooms/room.html | 9 +- .../components/reset_colors_modal.html | 34 ++ templates/settings/settings.html | 333 +++--------------- templates/settings/tabs/colors.html | 137 +++++++ templates/settings/tabs/general.html | 6 + templates/settings/tabs/security.html | 6 + 8 files changed, 476 insertions(+), 295 deletions(-) create mode 100644 static/css/settings.css create mode 100644 static/js/settings.js create mode 100644 templates/settings/components/reset_colors_modal.html create mode 100644 templates/settings/tabs/colors.html create mode 100644 templates/settings/tabs/general.html create mode 100644 templates/settings/tabs/security.html diff --git a/static/css/settings.css b/static/css/settings.css new file mode 100644 index 0000000..915fc04 --- /dev/null +++ b/static/css/settings.css @@ -0,0 +1,108 @@ +/* TEST - This should make all nav links bright red */ +.card-header-tabs .nav-link { + color: var(--text-muted); + background: var(--bg-light); + border: none; + padding: 0.75rem 1.25rem; + font-weight: 500; + transition: all 0.2s; + margin-right: 0.5rem; + border-radius: 0.375rem 0.375rem 0 0; +} + +:root { + --bs-nav-link-color: var(--text-muted) !important; + --bs-nav-link-hover-color: var(--primary-color) !important; + --bs-nav-link-disabled-color: var(--text-muted) !important; + --bs-nav-link-active-color: var(--primary-color) !important; +} + +/* Override base nav-link styles */ +.card-header-tabs .nav-link, +.card-header-tabs .nav-link:focus, +.card-header-tabs .nav-link:hover, +.card-header-tabs .nav-link.active, +.card-header-tabs .nav-item.show .nav-link { + color: var(--text-muted); +} + +.card-header-tabs .nav-link:hover, +.card-header-tabs .nav-link:focus, +.card-header-tabs .nav-link.active, +.card-header-tabs .nav-item.show .nav-link { + color: var(--primary-color); +} + +.nav-tabs { + border-bottom: 1px solid var(--border-light); +} + +.card-header-tabs .nav-link:hover { + color: var(--primary-color); + background: var(--primary-bg-light); + border: none; +} + +.card-header-tabs .nav-link.active { + color: var(--primary-color); + background: var(--white); + border: none; + border-bottom: 2px solid var(--primary-color); + font-weight: 600; +} + +.card-header-tabs .nav-link i { + width: 1.25rem; + text-align: center; + color: var(--primary-color); + opacity: 0.7; +} + +.card-header-tabs .nav-link.active i { + opacity: 1; +} + +.card-header { + border-bottom: 1px solid var(--border-light); + padding: 1rem; + background: var(--bg-light); +} + +.card-header-tabs { + margin: -0.5rem -1rem; + padding: 0.5rem 1rem; +} + +.tab-content { + padding: 1.5rem; + background: var(--white); + border-radius: 0 0 0.375rem 0.375rem; +} + +/* Override Bootstrap's default tab colors */ +.card-header-tabs .nav-link:focus, +.card-header-tabs .nav-link:hover { + border-color: transparent; + isolation: isolate; +} + +.card-header-tabs .nav-link.active, +.card-header-tabs .nav-item.show .nav-link { + background-color: var(--white); + border-color: transparent transparent var(--primary-color); +} + +/* Override Bootstrap's default text colors */ +.nav-tabs .nav-link, +.nav-tabs .nav-link:focus, +.nav-tabs .nav-link:hover, +.nav-tabs .nav-link.active, +.nav-tabs .nav-item.show .nav-link { + color: var(--text-muted) !important; +} + +.nav-tabs .nav-link:hover, +.nav-tabs .nav-link.active, +.nav-tabs .nav-item.show .nav-link { + color: var(--primary-color) !important; +} \ No newline at end of file diff --git a/static/js/settings.js b/static/js/settings.js new file mode 100644 index 0000000..c748ad5 --- /dev/null +++ b/static/js/settings.js @@ -0,0 +1,138 @@ +document.addEventListener('DOMContentLoaded', function() { + const primaryColorInput = document.getElementById('primaryColor'); + const secondaryColorInput = document.getElementById('secondaryColor'); + + // Color manipulation functions + function hexToRgb(hex) { + const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + return result ? { + r: parseInt(result[1], 16), + g: parseInt(result[2], 16), + b: parseInt(result[3], 16) + } : null; + } + + function rgbToHex(r, g, b) { + return '#' + [r, g, b].map(x => { + const hex = x.toString(16); + return hex.length === 1 ? '0' + hex : hex; + }).join(''); + } + + function lightenColor(color, amount) { + const rgb = hexToRgb(color); + if (!rgb) return color; + + return rgbToHex( + Math.min(255, Math.round(rgb.r + (255 - rgb.r) * amount)), + Math.min(255, Math.round(rgb.g + (255 - rgb.g) * amount)), + Math.min(255, Math.round(rgb.b + (255 - rgb.b) * amount)) + ); + } + + function darkenColor(color, amount) { + const rgb = hexToRgb(color); + if (!rgb) return color; + + return rgbToHex( + Math.max(0, Math.round(rgb.r * (1 - amount))), + Math.max(0, Math.round(rgb.g * (1 - amount))), + Math.max(0, Math.round(rgb.b * (1 - amount))) + ); + } + + function updateAllColors(color, isPrimary) { + const prefix = isPrimary ? 'primary' : 'secondary'; + + // Calculate derived colors + const lightColor = lightenColor(color, 0.15); + const bgLightColor = lightenColor(color, 0.9); + const opacity15 = color + '26'; // 15% opacity in hex + + // Calculate chart colors + const chartColors = { + base: color, + light: lightenColor(color, 0.2), + lighter: lightenColor(color, 0.4), + lightest: lightenColor(color, 0.6), + pale: lightenColor(color, 0.8) + }; + + // Update CSS variables for the entire website + document.documentElement.style.setProperty(`--${prefix}-color`, color); + document.documentElement.style.setProperty(`--${prefix}-light`, lightColor); + document.documentElement.style.setProperty(`--${prefix}-bg-light`, bgLightColor); + document.documentElement.style.setProperty(`--${prefix}-opacity-15`, opacity15); + + // Update chart color variables + document.documentElement.style.setProperty(`--chart-${prefix}`, chartColors.base); + document.documentElement.style.setProperty(`--chart-${prefix}-light`, chartColors.light); + document.documentElement.style.setProperty(`--chart-${prefix}-lighter`, chartColors.lighter); + document.documentElement.style.setProperty(`--chart-${prefix}-lightest`, chartColors.lightest); + document.documentElement.style.setProperty(`--chart-${prefix}-pale`, chartColors.pale); + + // Update derived colors in the preview section + const derivedColorsSection = document.getElementById(`${prefix}DerivedColors`); + if (derivedColorsSection) { + const previews = derivedColorsSection.querySelectorAll('.color-preview'); + previews.forEach(preview => { + const colorType = preview.getAttribute('data-color-type'); + let previewColor; + switch (colorType) { + case 'base': + previewColor = color; + break; + case 'light': + previewColor = lightColor; + break; + case 'bg-light': + previewColor = bgLightColor; + break; + case 'opacity': + previewColor = opacity15; + break; + } + preview.style.backgroundColor = previewColor; + }); + } + + // Update the color input value + if (isPrimary) { + primaryColorInput.value = color; + } else { + secondaryColorInput.value = color; + } + } + + // Event listeners for color inputs + primaryColorInput.addEventListener('change', () => { + updateAllColors(primaryColorInput.value, true); + }); + + secondaryColorInput.addEventListener('change', () => { + updateAllColors(secondaryColorInput.value, false); + }); + + // Also listen for input events for real-time updates + primaryColorInput.addEventListener('input', () => { + updateAllColors(primaryColorInput.value, true); + }); + + secondaryColorInput.addEventListener('input', () => { + updateAllColors(secondaryColorInput.value, false); + }); + + // Initialize colors from database values + function initializeColors() { + // Reset inputs to original database values + primaryColorInput.value = primaryColorInput.dataset.originalValue; + secondaryColorInput.value = secondaryColorInput.dataset.originalValue; + + // Update all color previews + updateAllColors(primaryColorInput.value, true); + updateAllColors(secondaryColorInput.value, false); + } + + // Initialize colors when the page loads + initializeColors(); +}); \ No newline at end of file diff --git a/templates/rooms/room.html b/templates/rooms/room.html index 1c97700..63be734 100644 --- a/templates/rooms/room.html +++ b/templates/rooms/room.html @@ -15,7 +15,7 @@ button_icon="fa-arrow-left" ) }} -
+
@@ -79,7 +79,7 @@
-
+