Make sure history graph fits in modal

This commit is contained in:
Bill Thiede 2025-12-04 16:39:55 -08:00
parent cb62961be0
commit 8b229237c9

View File

@ -931,8 +931,9 @@ class HTMLGenerator:
if len(data_points) < 2: if len(data_points) < 2:
return "" return ""
# Graph dimensions # Graph dimensions - make responsive to fit in modal
width = 600 # Modal has max-width 600px with 20px padding, so max SVG width should be ~560px
width = 560
height = 200 height = 200
padding = 40 padding = 40
graph_width = width - 2 * padding graph_width = width - 2 * padding
@ -961,9 +962,9 @@ class HTMLGenerator:
else: else:
return f"{ns}ns" return f"{ns}ns"
# Generate SVG # Generate SVG - make it responsive
svg_parts = [] svg_parts = []
svg_parts.append(f'<svg width="{width}" height="{height}" style="border: 1px solid #ddd; background: #fafafa;">') svg_parts.append(f'<svg width="100%" height="{height}" viewBox="0 0 {width} {height}" preserveAspectRatio="xMidYMid meet" style="border: 1px solid #ddd; background: #fafafa; max-width: 100%;">')
# Draw axes # Draw axes
svg_parts.append(f'<line x1="{padding}" y1="{padding}" x2="{padding}" y2="{height - padding}" stroke="#333" stroke-width="2"/>') # Y-axis svg_parts.append(f'<line x1="{padding}" y1="{padding}" x2="{padding}" y2="{height - padding}" stroke="#333" stroke-width="2"/>') # Y-axis
@ -1387,6 +1388,15 @@ class HTMLGenerator:
padding: 10px; padding: 10px;
background: white; background: white;
border-radius: 4px; border-radius: 4px;
overflow-x: auto;
overflow-y: visible;
}}
.history-graph svg {{
display: block;
width: 100%;
max-width: 100%;
height: auto;
}} }}
.compact-commits {{ .compact-commits {{