Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tphakala committed Jan 14, 2025
2 parents 50fed1b + 033c8da commit ba6219d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 16 deletions.
55 changes: 48 additions & 7 deletions assets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ thead.sticky-header {
position: sticky;
top: 0;
z-index: 10;
background-image: linear-gradient(to bottom, white 70%, transparent 100%);
height: 2rem;
background-color: var(--fallback-b1,oklch(var(--b1)/1));
}

[data-theme=dark] thead.sticky-header {
Expand Down Expand Up @@ -105,8 +106,10 @@ thead.sticky-header {
}

.hour-data a {
height: 100%;
width: 100%;
height: 2rem;
min-height: 2rem;
max-height: 2rem;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -518,12 +521,50 @@ thead.sticky-header {
transition: transform 0.2s ease-in-out;
}

/* Style date input calendar icon for dark mode */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
filter: invert(1);
/* Style date input calendar icon for light mode */
[data-theme="light"] input[type="date"] {
color-scheme: light;
}

/* For Firefox */
/* Style date input calendar icon for dark mode */
[data-theme="dark"] input[type="date"] {
color-scheme: dark;
}

/* Ensure table cells have consistent height and prevent content overflow */
.hour-data {
height: 2rem;
min-height: 2rem;
max-height: 2rem;
line-height: 2rem;
box-sizing: border-box;
vertical-align: middle;
}

/* Fix table row height consistency */
.table tr {
height: 2rem;
min-height: 2rem;
max-height: 2rem;
}

/* Ensure table cells maintain their dimensions */
.table td,
.table th {
box-sizing: border-box;
height: 2rem;
min-height: 2rem;
max-height: 2rem;
vertical-align: middle;
}

/* Fix flex alignment in cells with links */
.hour-data a {
height: 2rem;
min-height: 2rem;
max-height: 2rem;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
}
16 changes: 7 additions & 9 deletions assets/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,17 @@ function initializeDatePicker() {
return `${year}-${month}-${day}`;
}

const today = getIsoDateString(new Date()); // ensures consistent 'YYYY-MM-DD' format

// Set the value first
const today = getIsoDateString(new Date());
const newValue = hashDate || today;

// Only trigger change if the picker is invisible (first load)
// or if the value has actually changed
if (picker.classList.contains('invisible') || picker.value !== newValue) {
// Only trigger change if the value is actually different
if (picker.value !== newValue) {
picker.value = newValue;
picker.classList.remove('invisible'); // Make picker visible
picker.classList.remove('invisible');
htmx.trigger(picker, 'change');
} else if (!document.getElementById('topBirdsChart').children.length) {
// If the value hasn't changed but the chart is empty, trigger the change
htmx.trigger(picker, 'change');
} else {
picker.classList.remove('invisible'); // Make picker visible
}
}

Expand Down

0 comments on commit ba6219d

Please sign in to comment.