fix: correct fee settings button link and improve calendar theming
- Fix fee settings button in dashboard to link to /settings/fees instead of /calendar - Implement proper theme management system for calendar page - Add theme background handler and data-theme-background attribute - Replace broken theme import with complete theme management - Both dashboard and calendar now properly support light/dark themes - Fixed glassmorphism CSS variables and theme switching 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,7 @@ const search = url.searchParams.get('search');
|
||||
---
|
||||
|
||||
<Layout title="Event Calendar - Black Canyon Tickets">
|
||||
<div class="min-h-screen">
|
||||
<div class="min-h-screen" data-theme-background>
|
||||
<!-- Hero Section with Dynamic Background -->
|
||||
<section id="hero-section" class="relative overflow-hidden sticky top-0 z-40" style="background: var(--bg-gradient);">
|
||||
<PublicHeader showCalendarNav={true} />
|
||||
@@ -406,6 +406,9 @@ const search = url.searchParams.get('search');
|
||||
</Layout>
|
||||
|
||||
<style>
|
||||
/* Import glassmorphism theme styles */
|
||||
@import '../styles/glassmorphism.css';
|
||||
|
||||
/* Custom animations */
|
||||
@keyframes float {
|
||||
0%, 100% { transform: translateY(0px); }
|
||||
@@ -502,14 +505,46 @@ const search = url.searchParams.get('search');
|
||||
<script>
|
||||
console.log('=== CALENDAR SCRIPT STARTING ===');
|
||||
|
||||
// Simple theme toggle function
|
||||
window.toggleTheme = function() {
|
||||
const html = document.documentElement;
|
||||
const currentTheme = html.getAttribute('data-theme') || 'light';
|
||||
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
|
||||
// Theme management system
|
||||
function getCurrentTheme() {
|
||||
if (typeof window === 'undefined') return 'dark';
|
||||
|
||||
html.setAttribute('data-theme', newTheme);
|
||||
localStorage.setItem('theme', newTheme);
|
||||
const savedTheme = localStorage.getItem('theme');
|
||||
if (savedTheme) return savedTheme;
|
||||
|
||||
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
function setTheme(theme) {
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
document.documentElement.classList.remove('light', 'dark');
|
||||
document.documentElement.classList.add(theme);
|
||||
|
||||
document.body.classList.remove('light', 'dark');
|
||||
document.body.classList.add(theme);
|
||||
|
||||
localStorage.setItem('theme', theme);
|
||||
|
||||
// Dispatch theme change event
|
||||
window.dispatchEvent(new CustomEvent('themeChanged', {
|
||||
detail: { theme }
|
||||
}));
|
||||
}
|
||||
|
||||
function initializeTheme() {
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
const savedTheme = getCurrentTheme();
|
||||
setTheme(savedTheme);
|
||||
}
|
||||
|
||||
// Theme toggle function
|
||||
window.toggleTheme = function() {
|
||||
const currentTheme = getCurrentTheme();
|
||||
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
|
||||
setTheme(newTheme);
|
||||
|
||||
// Update icon
|
||||
const toggle = document.getElementById('theme-toggle');
|
||||
@@ -523,12 +558,30 @@ const search = url.searchParams.get('search');
|
||||
}
|
||||
|
||||
console.log('Theme toggled to:', newTheme);
|
||||
return newTheme;
|
||||
};
|
||||
|
||||
// Initialize theme on page load
|
||||
const savedTheme = localStorage.getItem('theme') ||
|
||||
(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
||||
document.documentElement.setAttribute('data-theme', savedTheme);
|
||||
// Initialize theme immediately
|
||||
initializeTheme();
|
||||
|
||||
// Handle theme changes and update background
|
||||
function updateBackground() {
|
||||
const theme = getCurrentTheme();
|
||||
const bgElement = document.querySelector('[data-theme-background]');
|
||||
if (bgElement) {
|
||||
if (theme === 'light') {
|
||||
bgElement.style.background = '#f8fafc';
|
||||
} else {
|
||||
bgElement.style.background = 'var(--bg-gradient)';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Listen for theme changes
|
||||
window.addEventListener('themeChanged', updateBackground);
|
||||
|
||||
// Initial background update
|
||||
updateBackground();
|
||||
|
||||
// Import geolocation utilities - get from environment or default to empty
|
||||
const MAPBOX_TOKEN = '';
|
||||
|
||||
Reference in New Issue
Block a user