Skip to content

end to end app store screenshot creation using AI

Sanitize loaded typography scales and keep icon glyph fixed-size

Parth Jadhav130831b3ae2a
diff --git a/skills/app-store-screenshots/template/src/components/editor/slide-canvas.tsx b/skills/app-store-screenshots/template/src/components/editor/slide-canvas.tsx
index 5c77b28..28b32da 100644
--- a/skills/app-store-screenshots/template/src/components/editor/slide-canvas.tsx
+++ b/skills/app-store-screenshots/template/src/components/editor/slide-canvas.tsx
@@ -884,7 +884,7 @@ function FeatureGraphicCanvas({
justifyContent: "center",
color: theme.fgAlt,
fontWeight: 800,
- fontSize: cW * 0.07 * appNameScale,
+ fontSize: cW * 0.07,
boxShadow: "0 4px 16px rgba(0,0,0,0.3)",
}}
>
diff --git a/skills/app-store-screenshots/template/src/lib/typography.ts b/skills/app-store-screenshots/template/src/lib/typography.ts
index 83e38bc..75de867 100644
--- a/skills/app-store-screenshots/template/src/lib/typography.ts
+++ b/skills/app-store-screenshots/template/src/lib/typography.ts
@@ -18,18 +18,15 @@ export function slideFontScales(slide: Slide) {
};
}
-/** Persist only non-default scales so JSON stays tidy. */
+/** Persist only non-default scales so JSON stays tidy. Values are clamped
+ * first, so invalid or out-of-range input from a loaded project never ends up
+ * stored as a no-op `1` or outside the slider range. */
export function cleanTypography(raw: SlideTypography | undefined): SlideTypography | undefined {
- if (!raw) return undefined;
+ if (!raw || typeof raw !== "object") return undefined;
const out: SlideTypography = {};
- if (raw.labelScale !== undefined && raw.labelScale !== FONT_SCALE_DEFAULT) {
- out.labelScale = clampFontScale(raw.labelScale);
- }
- if (raw.headlineScale !== undefined && raw.headlineScale !== FONT_SCALE_DEFAULT) {
- out.headlineScale = clampFontScale(raw.headlineScale);
- }
- if (raw.appNameScale !== undefined && raw.appNameScale !== FONT_SCALE_DEFAULT) {
- out.appNameScale = clampFontScale(raw.appNameScale);
+ for (const key of ["labelScale", "headlineScale", "appNameScale"] as const) {
+ const value = clampFontScale(raw[key]);
+ if (value !== FONT_SCALE_DEFAULT) out[key] = value;
}
return Object.keys(out).length > 0 ? out : undefined;
}