Skip to content

Commit bc02b88

Browse files
committed
fix(studio): exhaustively type RESOLUTION_OPTIONS and document layout coupling
1 parent 0c026bb commit bc02b88

1 file changed

Lines changed: 26 additions & 8 deletions

File tree

packages/studio/src/components/renders/RenderQueue.tsx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,36 @@ interface RenderQueueProps {
1515
isRendering: boolean;
1616
}
1717

18-
const RESOLUTION_OPTIONS: { value: ResolutionPreset | "auto"; label: string; title: string }[] = [
19-
{ value: "auto", label: "Auto", title: "Render at the composition's authored resolution" },
20-
{ value: "landscape", label: "1080p", title: "1920×1080 landscape" },
21-
{ value: "portrait", label: "1080p ↕", title: "1080×1920 portrait" },
22-
{
23-
value: "landscape-4k",
18+
// Indexing the table by `ResolutionPreset | "auto"` makes adding a new preset
19+
// to `core.types` (e.g. an 8K row) a TypeScript error here instead of a
20+
// silently missing dropdown entry. Order is fixed by the array below.
21+
const RESOLUTION_LABELS: Record<ResolutionPreset | "auto", { label: string; title: string }> = {
22+
auto: { label: "Auto", title: "Render at the composition's authored resolution" },
23+
landscape: { label: "1080p", title: "1920×1080 landscape" },
24+
portrait: { label: "1080p ↕", title: "1080×1920 portrait" },
25+
"landscape-4k": {
2426
label: "4K",
2527
title: "3840×2160 — supersamples a 1080p composition via Chrome DPR. Slower, larger files.",
2628
},
27-
{
28-
value: "portrait-4k",
29+
"portrait-4k": {
2930
label: "4K ↕",
3031
title: "2160×3840 — supersamples a 1080p portrait composition via Chrome DPR.",
3132
},
33+
};
34+
35+
const RESOLUTION_OPTION_ORDER: (ResolutionPreset | "auto")[] = [
36+
"auto",
37+
"landscape",
38+
"portrait",
39+
"landscape-4k",
40+
"portrait-4k",
3241
];
3342

43+
const RESOLUTION_OPTIONS = RESOLUTION_OPTION_ORDER.map((value) => ({
44+
value,
45+
...RESOLUTION_LABELS[value],
46+
}));
47+
3448
const FORMAT_INFO: Record<"mp4" | "webm" | "mov", { label: string; desc: string }> = {
3549
mp4: { label: "MP4", desc: "Best for general use. Smallest file, universal playback." },
3650
mov: {
@@ -128,6 +142,10 @@ function FormatExportButton({
128142
return (
129143
<div className="flex items-center gap-1">
130144
<FormatInfoTooltip format={format} />
145+
{/* Resolution must remain the leftmost <select> in this row — it
146+
carries `rounded-l` for the joined-button look. If you ever hide it
147+
(feature-flag, etc.), move `rounded-l` to whichever element ends up
148+
leftmost. */}
131149
<select
132150
value={resolution}
133151
onChange={(e) => setResolution(e.target.value as ResolutionPreset | "auto")}

0 commit comments

Comments
 (0)