From c6882b2a48c6271b1a8ad7e26d0e70912d9aeb50 Mon Sep 17 00:00:00 2001 From: Kylian Schmidt Date: Tue, 29 Jul 2025 14:05:22 +0200 Subject: [PATCH] Fix metadata display not wrapping long lines. Add LaTeX support --- assets/css/base.css | 19 +++++++++- assets/css/floating-elements.css | 42 +++++++++++++++++++--- assets/css/metadata-section.css | 62 ++++++++++++++++++++------------ assets/css/stats.css | 23 ++++++++++-- assets/css/view-controls.css | 1 + assets/js/metadata-section.js | 7 ++++ templates/gallery.html | 19 +++++++--- 7 files changed, 137 insertions(+), 36 deletions(-) diff --git a/assets/css/base.css b/assets/css/base.css index ae700dc..f007e1e 100644 --- a/assets/css/base.css +++ b/assets/css/base.css @@ -9,7 +9,7 @@ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; margin: 0; padding: 1rem; - padding-bottom: 2rem; + padding-bottom: 400px; /* Further increased bottom padding to prevent overlap with stats box */ background-color: var(--bg-color); color: var(--text-color); transition: background-color 0.3s, color 0.3s; @@ -52,3 +52,20 @@ ul li a:hover { color: var(--link-hover); text-decoration: underline; } + +/* Responsive design adjustments */ +@media (max-width: 768px) { + body { + padding: 0.5rem; + padding-bottom: 300px; /* Further increased mobile bottom padding to match desktop */ + } + + h1 { + font-size: 1.5rem; + } + + h2 { + font-size: 1.2rem; + margin: 1rem 0 0.5rem 0; + } +} diff --git a/assets/css/floating-elements.css b/assets/css/floating-elements.css index ae6a70a..cd8e830 100644 --- a/assets/css/floating-elements.css +++ b/assets/css/floating-elements.css @@ -3,12 +3,14 @@ ======================================== */ .floating-buttons { position: fixed; - bottom: 20px; - right: 20px; + bottom: 80px; + right: 15px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; + /* Ensure buttons don't interfere with content */ + pointer-events: none; } .floating-btn { @@ -23,6 +25,8 @@ display: flex; align-items: center; justify-content: center; + /* Re-enable pointer events for buttons */ + pointer-events: auto; } .floating-btn:hover { @@ -39,22 +43,39 @@ color: white; } +/* Responsive adjustments */ +@media (max-width: 768px) { + .floating-buttons { + bottom: 60px; + right: 10px; + gap: 8px; + } + + .floating-btn { + width: 48px; + height: 48px; + font-size: 1.1rem; + } +} + /* ======================================== KEYBOARD SHORTCUTS HELP ======================================== */ .shortcuts-help { position: fixed; - bottom: 140px; - right: 20px; + bottom: 220px; + right: 15px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 1rem; display: none; box-shadow: 0 4px 15px rgba(0,0,0,0.2); - z-index: 1000; + z-index: 1001; font-size: 0.9rem; max-width: 280px; + max-height: 400px; + overflow-y: auto; } .shortcuts-help h4 { @@ -78,3 +99,14 @@ font-size: 0.8rem; font-weight: 500; } + +/* Responsive adjustments */ +@media (max-width: 768px) { + .shortcuts-help { + bottom: 180px; + right: 10px; + left: 10px; + max-width: none; + max-height: 300px; + } +} diff --git a/assets/css/metadata-section.css b/assets/css/metadata-section.css index b3f7fb9..06930db 100644 --- a/assets/css/metadata-section.css +++ b/assets/css/metadata-section.css @@ -187,53 +187,69 @@ .metadata-grid { padding: 1rem; display: grid; - grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); - gap: 0.5rem 1rem; + grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); + gap: 1rem 1.5rem; /* Increased gaps to prevent overlapping */ } /* Metadata Items */ .metadata-item { display: flex; - align-items: flex-start; - gap: 0.5rem; - padding: 0.25rem 0; + flex-direction: column; /* Stack key and value vertically to prevent overlap */ + gap: 0.25rem; + padding: 0.75rem; + background: var(--card-bg); + border-radius: 6px; + border: 1px solid var(--border-color); + word-wrap: break-word; /* Ensure long text wraps */ + overflow-wrap: break-word; /* Additional word wrapping */ } .metadata-key { font-weight: 600; color: var(--link-color); - white-space: nowrap; - min-width: fit-content; + font-size: 0.9rem; + margin-bottom: 0.25rem; } .metadata-value { color: var(--text-color); word-break: break-word; - flex: 1; + overflow-wrap: break-word; + line-height: 1.4; + font-size: 0.9rem; } -/* Tags for list items */ +/* LaTeX content styling */ +.latex-content { + color: var(--text-color); + line-height: 1.6; + font-family: 'Times New Roman', serif; +} + +/* Simple list items - no special formatting */ .metadata-list { - display: flex; - flex-wrap: wrap; - gap: 0.25rem; + color: var(--text-color); + line-height: 1.4; } +/* Remove the blue box styling for tags */ .metadata-tag { - background: var(--link-color); - color: white; - padding: 0.2rem 0.5rem; - border-radius: 12px; - font-size: 0.8rem; - white-space: nowrap; + display: inline; + background: none; + color: var(--text-color); + padding: 0; + border-radius: 0; + font-size: inherit; + white-space: normal; } -/* Nested metadata */ +/* Simplified nested metadata */ .metadata-nested { - background: var(--card-bg); - padding: 0.5rem; - border-radius: 4px; - border-left: 3px solid var(--link-color); + background: none; + padding: 0; + border-radius: 0; + border-left: none; + color: var(--text-color); } .metadata-nested-item { diff --git a/assets/css/stats.css b/assets/css/stats.css index cec72dc..10868e5 100644 --- a/assets/css/stats.css +++ b/assets/css/stats.css @@ -3,8 +3,8 @@ ======================================== */ .gallery-stats { position: fixed; - bottom: 20px; - left: 20px; + bottom: 80px; + left: 15px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; @@ -16,10 +16,14 @@ opacity: 0.8; transition: opacity 0.2s ease; max-width: 200px; + /* Ensure stats don't interfere with content */ + pointer-events: none; } .gallery-stats:hover { opacity: 1; + /* Re-enable pointer events on hover */ + pointer-events: auto; } .stats-item { @@ -38,3 +42,18 @@ font-weight: 600; color: var(--text-color); } + +/* Responsive adjustments */ +@media (max-width: 768px) { + .gallery-stats { + bottom: 60px; + left: 10px; + padding: 0.6rem 0.8rem; + font-size: 0.8rem; + max-width: 180px; + } + + .stats-item { + margin: 0.15rem 0; + } +} diff --git a/assets/css/view-controls.css b/assets/css/view-controls.css index b608505..11580d8 100644 --- a/assets/css/view-controls.css +++ b/assets/css/view-controls.css @@ -118,6 +118,7 @@ /* Plot Container Base Styles */ .plot-container { margin: 1rem 0; + margin-bottom: 450px; /* Add extra bottom margin to prevent overlap with stats box */ transition: all 0.3s ease; clear: both; } diff --git a/assets/js/metadata-section.js b/assets/js/metadata-section.js index f262411..b8f2485 100644 --- a/assets/js/metadata-section.js +++ b/assets/js/metadata-section.js @@ -28,6 +28,13 @@ function toggleMetadataSection() { content.style.display = 'block'; if (arrow) arrow.textContent = '▲'; console.log('Metadata shown'); + + // Trigger MathJax rendering for LaTeX content + if (typeof MathJax !== 'undefined') { + MathJax.typesetPromise([content]).catch(function (err) { + console.log('MathJax typeset failed: ' + err.message); + }); + } } // Save state to localStorage diff --git a/templates/gallery.html b/templates/gallery.html index da2ea98..ba14396 100644 --- a/templates/gallery.html +++ b/templates/gallery.html @@ -4,6 +4,17 @@ {{ title }} + + + + @@ -64,16 +75,14 @@ {% if value is string and (value.startswith('http://') or value.startswith('https://')) %} {{ value }} + {% elif value is string and '$$' in value %} + {{ value }} {% elif value is string and value|length > 100 %} {% elif value is iterable and value is not string and value is not mapping %} - + {% elif value is mapping %}