Fix location sidebar theming issues - #466
Conversation
- Add JavaScript-based theme detection for location sidebar image - Fix light mode padding to match dark mode (217px width, no border/padding) - Adjust workflow schedule to fix date off-by-one error (15:00 UTC instead of 18:00 UTC) - Increase JPEG quality from 65 to 78 for better image quality Co-authored-by: Bailey <baely@users.noreply.github.com>
that's not the right approach to fixing the workflow. update the actual workflow source code to change that date. i believe it's based on the browser time from javascript, so someinthg is probably wrong there. and you can change the quality, you have permission |
Pull Request Review: Fix location sidebar theming issuesSummaryThis PR addresses theming issues with the location sidebar image by replacing the CSS-only Code Quality & Best Practices✅ Strengths
|
|
I'll analyze this and get back to you. |
Code ReviewThank you for this PR addressing issue #460! Overall, this is a solid implementation that successfully switches from CSS media queries to JavaScript-based theme detection. Here's my detailed feedback: ✅ Strengths
🐛 Potential Issues1. Race Condition Risk (site/themes/devhouse-theme/layouts/partials/infobar.html:27)// Update image immediately
updateLocationImage(getPreferredTheme());
// Listen for theme changes
document.addEventListener('DOMContentLoaded', function() {
// Update on initial load
updateLocationImage(getPreferredTheme());The image is updated twice - once immediately (line 27) and once on DOMContentLoaded (line 32). The immediate call happens before DOM is ready, so 2. Fragile Function Override (site/themes/devhouse-theme/layouts/partials/infobar.html:42-48)const originalToggleTheme = window.toggleTheme;
if (originalToggleTheme) {
window.toggleTheme = function() {
originalToggleTheme();
updateLocationImage(getPreferredTheme());
};
}This pattern has several issues:
Better approach: Use a custom event system. Modify // In baseof.html toggleTheme():
function toggleTheme() {
const currentTheme = getPreferredTheme();
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
localStorage.setItem('theme', newTheme);
applyTheme(newTheme);
window.dispatchEvent(new CustomEvent('themeChanged', { detail: { theme: newTheme } }));
}
// In infobar.html:
window.addEventListener('themeChanged', function(e) {
updateLocationImage(e.detail.theme);
});3. Code Duplication (site/themes/devhouse-theme/layouts/partials/infobar.html:18-24)The Recommendation: Move shared theme utilities to a separate JS file or make them globally available from baseof.html before other scripts load. ⚡ Performance Considerations
🔒 Security Concerns
Overall security posture is good ✅ 🧪 Test CoverageMissing: No automated tests exist for theme switching functionality. Consider adding:
📝 Additional Recommendations
img.onerror = function() {
console.warn('Failed to load location sidebar image:', img.src);
};
<link rel="preload" as="image" href="/images/location-sidebar/location-light.jpg">
<link rel="preload" as="image" href="/images/location-sidebar/location-dark.jpg">📋 SummaryVerdict: Approve with minor suggestions The core implementation is sound and solves the reported issue. The main concerns are:
These are improvements for future iterations - the current code will work correctly in most scenarios. Great job on matching the dark mode styling and handling edge cases like cross-tab theme changes! Manual TODO reminder: Don't forget to update |

Summary
Closes #460
Remaining Work
The workflow file (.github/workflows/location-screenshots.yaml) needs manual updates:
cron: '0 18 * * *'tocron: '0 15 * * *'Generated with Claude Code