fix: derive poster key from plan

This commit is contained in:
William Valentin
2026-02-01 14:16:30 -08:00
parent d6e6f275b7
commit 0bf2f2d827
3 changed files with 21 additions and 3 deletions

View File

@@ -3,6 +3,11 @@ export type VariantPlanItem = {
size: number;
};
export function pickSmallestVariantSize(plan: VariantPlanItem[]): number | null {
if (plan.length === 0) return null;
return plan.reduce((min, item) => (item.size < min ? item.size : min), plan[0].size);
}
export function computeImageVariantPlan(): VariantPlanItem[] {
return [
{ kind: "thumb", size: 256 },