Skip to content

end to end app store screenshot creation using AI

feat(mac): keep Mac as its own platform tab, driven by one device map

Parth Jadhavffd325355f15
diff --git a/skills/app-store-screenshots/template/src/components/editor/toolbar.tsx b/skills/app-store-screenshots/template/src/components/editor/toolbar.tsx
index aa69ab7..791618e 100644
--- a/skills/app-store-screenshots/template/src/components/editor/toolbar.tsx
+++ b/skills/app-store-screenshots/template/src/components/editor/toolbar.tsx
@@ -20,6 +20,7 @@ import {
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import {
DEVICE_LABEL,
+ PLATFORM_DEVICES,
THEMES,
supportsLandscape,
themeById,
@@ -55,7 +56,7 @@ export function Toolbar(props: Props) {
const hasLandscape = supportsLandscape(props.device);
const [resetOpen, setResetOpen] = React.useState(false);
- // Track last device per platform so iOS/Android tabs preserve user's choice.
+ // Track last device per platform so the platform tabs preserve the user's choice.
const lastByPlatform = React.useRef<Record<Platform, Device>>({
ios: platform === "ios" ? props.device : "iphone",
macos: platform === "macos" ? props.device : "mac",
@@ -68,6 +69,7 @@ export function Toolbar(props: Props) {
const showLocale = props.locales.length > 1;
const deviceLabel = DEVICE_LABEL[props.device];
+ const platformDevices = PLATFORM_DEVICES[platform];
const activeTheme = themeById(props.themeId);
return (
@@ -140,35 +142,23 @@ export function Toolbar(props: Props) {
</TabsList>
</Tabs>
- <Select
- value={props.device}
- onValueChange={(v) => props.setDevice(v as Device)}
- disabled={props.busy}
- >
- <SelectTrigger className="h-8 w-44 text-xs">
- <SelectValue placeholder="Device">{deviceLabel}</SelectValue>
- </SelectTrigger>
- <SelectContent>
- {platform === "ios" ? (
- <>
- <SelectItem value="iphone">{DEVICE_LABEL.iphone}</SelectItem>
- <SelectItem value="ipad">{DEVICE_LABEL.ipad}</SelectItem>
- <SelectItem value="tvos">{DEVICE_LABEL.tvos}</SelectItem>
- <SelectItem value="watchos">{DEVICE_LABEL.watchos}</SelectItem>
- <SelectItem value="carplay">{DEVICE_LABEL.carplay}</SelectItem>
- </>
- ) : platform === "macos" ? (
- <SelectItem value="mac">{DEVICE_LABEL.mac}</SelectItem>
- ) : (
- <>
- <SelectItem value="android">{DEVICE_LABEL.android}</SelectItem>
- <SelectItem value="android-7">{DEVICE_LABEL["android-7"]}</SelectItem>
- <SelectItem value="android-10">{DEVICE_LABEL["android-10"]}</SelectItem>
- <SelectItem value="feature-graphic">{DEVICE_LABEL["feature-graphic"]}</SelectItem>
- </>
- )}
- </SelectContent>
- </Select>
+ {/* Mac has a single device, so the tab alone says which deck is open. */}
+ {platformDevices.length > 1 && (
+ <Select
+ value={props.device}
+ onValueChange={(v) => props.setDevice(v as Device)}
+ disabled={props.busy}
+ >
+ <SelectTrigger className="h-8 w-44 text-xs">
+ <SelectValue placeholder="Device">{deviceLabel}</SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {platformDevices.map((d) => (
+ <SelectItem key={d} value={d}>{DEVICE_LABEL[d]}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
{hasLandscape && (
<Select
diff --git a/skills/app-store-screenshots/template/src/lib/constants.ts b/skills/app-store-screenshots/template/src/lib/constants.ts
index af9a615..4b39b15 100644
--- a/skills/app-store-screenshots/template/src/lib/constants.ts
+++ b/skills/app-store-screenshots/template/src/lib/constants.ts
@@ -1,4 +1,4 @@
-import type { Device, Orientation, SlideLayout, Theme, ThemeId } from "./types";
+import type { Device, Orientation, Platform, SlideLayout, Theme, ThemeId } from "./types";
// ---------- Canvas dimensions (design at largest required resolution) ----------
export const CANVAS: Record<Device, { w: number; h: number; wL?: number; hL?: number }> = {
@@ -424,6 +424,15 @@ export function hasTheme(themeId: string | undefined): boolean {
export const STORAGE_KEY = "app-store-screenshots:project:v1";
export const PROJECT_SCHEMA_VERSION = 2;
+// Toolbar platform tabs, in menu order. The platform is also the top-level
+// export folder (ios/…, macos/…, android/…). Mac gets its own tab because App
+// Store Connect lists macOS as a separate platform with its own screenshot set.
+export const PLATFORM_DEVICES: Record<Platform, Device[]> = {
+ ios: ["iphone", "ipad", "tvos", "watchos", "carplay"],
+ macos: ["mac"],
+ android: ["android", "android-7", "android-10", "feature-graphic"],
+};
+
export const DEVICE_LABEL: Record<Device, string> = {
iphone: "iPhone",
ipad: "iPad",
diff --git a/skills/app-store-screenshots/template/src/lib/defaults.ts b/skills/app-store-screenshots/template/src/lib/defaults.ts
index 468612b..374f37f 100644
--- a/skills/app-store-screenshots/template/src/lib/defaults.ts
+++ b/skills/app-store-screenshots/template/src/lib/defaults.ts
@@ -1,6 +1,6 @@
import { DEFAULT_LOCALE } from "./locale";
-import { DEFAULT_THEME_ID, PROJECT_SCHEMA_VERSION } from "./constants";
-import type { Device, ProjectState, Slide } from "./types";
+import { DEFAULT_THEME_ID, PLATFORM_DEVICES, PROJECT_SCHEMA_VERSION } from "./constants";
+import type { Device, Platform, ProjectState, Slide } from "./types";
let _id = 0;
export const nid = () => `s_${Date.now().toString(36)}_${(_id++).toString(36)}`;
@@ -179,11 +179,7 @@ export function newSlide(layout: Slide["layout"] = "device-bottom"): Slide {
};
}
-const IOS_DEVICES: ReadonlySet<Device> = new Set<Device>([
- "iphone", "ipad", "tvos", "watchos", "carplay",
-]);
-
-export function detectPlatform(device: Device): "ios" | "macos" | "android" {
- if (device === "mac") return "macos";
- return IOS_DEVICES.has(device) ? "ios" : "android";
+export function detectPlatform(device: Device): Platform {
+ const platforms = Object.keys(PLATFORM_DEVICES) as Platform[];
+ return platforms.find((p) => PLATFORM_DEVICES[p].includes(device)) ?? "ios";
}