Skip to content

Commit a9d1385

Browse files
fix: remove preview_thumb attributes from bokeh.yaml files
- Clean up unnecessary preview_thumb entries - Ensure consistency across multiple plot configurations
1 parent 6f59d6e commit a9d1385

File tree

2,674 files changed

+81
-2685
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,674 files changed

+81
-2685
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""remove_preview_thumb_column
2+
3+
Revision ID: b833d85c09ed
4+
Revises: a2f4b8c91d23
5+
Create Date: 2026-03-31 23:07:22.910889
6+
7+
"""
8+
from typing import Sequence, Union
9+
10+
from alembic import op
11+
import sqlalchemy as sa
12+
13+
14+
# revision identifiers, used by Alembic.
15+
revision: str = 'b833d85c09ed'
16+
down_revision: Union[str, None] = 'a2f4b8c91d23'
17+
branch_labels: Union[str, Sequence[str], None] = None
18+
depends_on: Union[str, Sequence[str], None] = None
19+
20+
21+
def upgrade() -> None:
22+
op.drop_column("impls", "preview_thumb")
23+
24+
25+
def downgrade() -> None:
26+
op.add_column(
27+
"impls",
28+
sa.Column("preview_thumb", sa.String(), nullable=True),
29+
)

app/src/components/SpecDetailView.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import ContentCopyIcon from '@mui/icons-material/ContentCopy';
1515
import CheckIcon from '@mui/icons-material/Check';
1616

1717
import type { Implementation } from '../types';
18-
import { buildSrcSet } from '../utils/responsiveImage';
18+
import { buildDetailSrcSet, DETAIL_SIZES } from '../utils/responsiveImage';
1919

2020
interface SpecDetailViewProps {
2121
specId: string;
@@ -92,13 +92,13 @@ export function SpecDetailView({
9292
>
9393
<source
9494
type="image/webp"
95-
srcSet={buildSrcSet(currentImpl.preview_url, 'webp')}
96-
sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 33vw"
95+
srcSet={buildDetailSrcSet(currentImpl.preview_url, 'webp')}
96+
sizes={DETAIL_SIZES}
9797
/>
9898
<source
9999
type="image/png"
100-
srcSet={buildSrcSet(currentImpl.preview_url, 'png')}
101-
sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 33vw"
100+
srcSet={buildDetailSrcSet(currentImpl.preview_url, 'png')}
101+
sizes={DETAIL_SIZES}
102102
/>
103103
<Box
104104
component="img"

app/src/components/SpecOverview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import ContentCopyIcon from '@mui/icons-material/ContentCopy';
1818
import CheckIcon from '@mui/icons-material/Check';
1919

2020
import type { Implementation } from '../types';
21-
import { buildSrcSet } from '../utils/responsiveImage';
21+
import { buildSrcSet, OVERVIEW_SIZES } from '../utils/responsiveImage';
2222

2323
interface LibraryMeta {
2424
id: string;
@@ -147,12 +147,12 @@ function ImplementationCard({
147147
<source
148148
type="image/webp"
149149
srcSet={buildSrcSet(impl.preview_url, 'webp')}
150-
sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 33vw"
150+
sizes={OVERVIEW_SIZES}
151151
/>
152152
<source
153153
type="image/png"
154154
srcSet={buildSrcSet(impl.preview_url, 'png')}
155-
sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 33vw"
155+
sizes={OVERVIEW_SIZES}
156156
/>
157157
<Box
158158
component="img"

app/src/pages/CatalogPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Fab from '@mui/material/Fab';
88
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
99

1010
import { API_URL, GITHUB_URL } from '../constants';
11-
import { buildSrcSet, getFallbackSrc } from '../utils/responsiveImage';
11+
import { buildSrcSet, getFallbackSrc, CATALOG_SIZES } from '../utils/responsiveImage';
1212
import { useAnalytics } from '../hooks';
1313
import { useAppData, useHomeState } from '../hooks';
1414
import { Breadcrumb, Footer } from '../components';
@@ -253,12 +253,12 @@ export function CatalogPage() {
253253
<source
254254
type="image/webp"
255255
srcSet={buildSrcSet(currentImage.url, 'webp')}
256-
sizes="(max-width: 600px) 50vw, 25vw"
256+
sizes={CATALOG_SIZES}
257257
/>
258258
<source
259259
type="image/png"
260260
srcSet={buildSrcSet(currentImage.url, 'png')}
261-
sizes="(max-width: 600px) 50vw, 25vw"
261+
sizes={CATALOG_SIZES}
262262
/>
263263
<Box
264264
component="img"

app/src/utils/responsiveImage.ts

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
*
44
* All variant URLs are derived by convention from the base plot.png URL:
55
* plot.png -> plot.webp, plot_1200.png, plot_1200.webp, plot_800.png, etc.
6+
*
7+
* Breakpoints match MUI defaults: sm=600, md=900, lg=1200, xl=1536.
8+
* Principle: always prefer slightly too large over too small (never pixelated).
69
*/
710

811
import type { ImageSize } from '../constants';
@@ -29,18 +32,51 @@ export function buildSrcSet(url: string, format: 'webp' | 'png'): string {
2932
}
3033

3134
/**
32-
* Get the sizes attribute based on the view mode.
35+
* Build a srcSet for the detail view that includes the full-resolution original.
36+
* Adds plot.webp/plot.png (~5000px) as the largest option so the detail view
37+
* is never pixelated, even on high-DPR displays.
38+
*/
39+
export function buildDetailSrcSet(url: string, format: 'webp' | 'png'): string {
40+
const base = getBasePath(url);
41+
const entries = RESPONSIVE_SIZES.map((w) => `${base}_${w}.${format} ${w}w`);
42+
entries.push(`${base}.${format} 3840w`);
43+
return entries.join(', ');
44+
}
45+
46+
/**
47+
* Get the sizes attribute for the homepage image grid.
48+
* Matches MUI Grid columns: normal = 1→1→2→2→3, compact = 2→2→4→4→6.
3349
*
34-
* Normal mode: fewer, larger cards.
35-
* Compact mode: more, smaller cards (roughly half the width).
50+
* MUI breakpoints: xs=0, sm=600, md=900, lg=1200, xl=1536.
3651
*/
3752
export function getResponsiveSizes(imageSize: ImageSize): string {
3853
if (imageSize === 'compact') {
39-
return '(max-width: 600px) 50vw, (max-width: 1200px) 25vw, 17vw';
54+
// xs/sm: 2 cols (50vw), md/lg: 4 cols (25vw), xl: 6 cols (17vw)
55+
return '(max-width: 899px) 50vw, (max-width: 1535px) 25vw, 17vw';
4056
}
41-
return '(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 33vw';
57+
// xs/sm: 1 col (100vw), md/lg: 2 cols (50vw), xl: 3 cols (33vw)
58+
return '(max-width: 899px) 100vw, (max-width: 1535px) 50vw, 33vw';
4259
}
4360

61+
/**
62+
* Sizes for the detail view (single large image).
63+
* Container maxWidth: xs=100%, md=1200, lg=1400, xl=1600.
64+
*/
65+
export const DETAIL_SIZES = '(max-width: 1199px) 100vw, (max-width: 1535px) 1400px, 1600px';
66+
67+
/**
68+
* Sizes for the spec overview grid (always 3 columns).
69+
* Container maxWidth: xs=100%, md=1200, lg=1400, xl=1600.
70+
* Each card = container / 3.
71+
*/
72+
export const OVERVIEW_SIZES = '(max-width: 1199px) 33vw, (max-width: 1535px) 467px, 534px';
73+
74+
/**
75+
* Sizes for the catalog page image thumbnails.
76+
* Mobile (xs): full width. Desktop (sm+): fixed 280px.
77+
*/
78+
export const CATALOG_SIZES = '(max-width: 599px) 100vw, 280px';
79+
4480
/**
4581
* Get the fallback image URL (plot_800.png - good middle ground).
4682
*/

core/database/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ class Impl(Base):
9292

9393
# Previews (filled by workflow, synced from metadata YAML)
9494
preview_url: Mapped[Optional[str]] = mapped_column(String, nullable=True) # Full PNG
95-
preview_thumb: Mapped[Optional[str]] = mapped_column(String, nullable=True) # Thumbnail PNG
9695
preview_html: Mapped[Optional[str]] = mapped_column(String, nullable=True) # Interactive HTML
9796

9897
# Creation versions (filled by workflow)

plots/acf-pacf/metadata/altair.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ issue: 4663
88
python_version: 3.14.3
99
library_version: 6.0.0
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/altair/plot.png
11-
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/altair/plot_thumb.png
1211
preview_html: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/altair/plot.html
1312
quality_score: 92
1413
review:

plots/acf-pacf/metadata/bokeh.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ issue: 4663
88
python_version: 3.14.3
99
library_version: 3.9.0
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/bokeh/plot.png
11-
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/bokeh/plot_thumb.png
1211
preview_html: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/bokeh/plot.html
1312
quality_score: 92
1413
review:

plots/acf-pacf/metadata/highcharts.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ issue: 4663
88
python_version: 3.14.3
99
library_version: unknown
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/highcharts/plot.png
11-
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/highcharts/plot_thumb.png
1211
preview_html: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/highcharts/plot.html
1312
quality_score: 87
1413
review:

plots/acf-pacf/metadata/letsplot.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ issue: 4663
88
python_version: 3.14.3
99
library_version: 4.9.0
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/letsplot/plot.png
11-
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/letsplot/plot_thumb.png
1211
preview_html: https://storage.googleapis.com/pyplots-images/plots/acf-pacf/letsplot/plot.html
1312
quality_score: 90
1413
review:

0 commit comments

Comments
 (0)