Create professional demos and 3D mockups in seconds, directly in your browser
feat: add iPad Mini 6 (2021) support with 3D viewer and model integration
CristianOlivera13ec49dbdb8dd
diff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsxindex 672c2f4..01e7e28 100644--- a/app/components/ui/editor/VideoCanvas.tsx+++ b/app/components/ui/editor/VideoCanvas.tsx@@ -57,6 +57,11 @@ const IPhone17ProMax3DViewer = dynamic({ ssr: false });+const IPadMini63DViewer = dynamic(+ () => import("./mockups-3d/IPadMini63DViewer").then((m) => ({ default: m.IPadMini63DViewer })),+ { ssr: false }+);+const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(function VideoCanvas({activeTool: _activeTool,mediaType = "video",@@ -163,6 +168,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functio'iphone-13-pro-max': '/models/apple_iphone_13_pro_max.glb','double_iphone_13_pro': '/models/double_iphone_13_pro.glb','iphone-17-pro-max': '/models/iphone-17-pro-max.glb',+ 'ipad_mini_6_2021': '/models/ipad_mini_6_2021.glb',laptop: '/models/mac-book.glb',};const imagePhoneModelUrl = PHONE_DEVICE_URLS[imagePhoneDevice];@@ -2299,6 +2305,28 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioglow={viewer3D.glow}environment={viewer3D.environment}/>+ ) : activePhoneDevice === "ipad_mini_6_2021" ? (+ <IPadMini63DViewer+ key="ipad_mini_6_2021"+ imageUrl={imageUrl}+ videoElement={mediaType === "video" ? videoRef.current : undefined}+ imageMaskConfig={imageMaskConfig}+ cropArea={cropArea}+ initialRotationX={imagePhoneRotX}+ initialRotationY={imagePhoneRotY}+ initialRotationZ={imagePhoneRotZ}+ onRotationChange={handlePhoneRotationChange}+ onMount={handlePhoneMount}+ onApi={handlePhoneApi}+ zoom={1}+ shadowIntensity={imagePhoneShadow}+ shadowColor={imagePhoneShadowColor}+ autoRotate={viewer3D.autoRotate}+ rotationSpeed={viewer3D.rotationSpeed}+ glow={viewer3D.glow}+ environment={viewer3D.environment}+ />+) : (<Phone3DViewerkey={imagePhoneDevice}diff --git a/app/components/ui/editor/mockups-3d/DoubleIPhone3DViewer.tsx b/app/components/ui/editor/mockups-3d/DoubleIPhone3DViewer.tsxindex 47680a9..82601d3 100644--- a/app/components/ui/editor/mockups-3d/DoubleIPhone3DViewer.tsx+++ b/app/components/ui/editor/mockups-3d/DoubleIPhone3DViewer.tsx@@ -44,7 +44,7 @@ interface Props {const DEG = Math.PI / 180;const PLACEHOLDER_PHONE_URL = "/images/mockups-3d/placeholder-phone.avif";const MODEL_URL = "/models/double_iphone_13_pro.glb";-const DRACO_URL = "https://www.gstatic.com/draco/versioned/decoders/1.5.6/";+const DRACO_URL = "/draco/";const DEFAULT_CAMERA_POS: [number, number, number] = [0, 0, 1.5];useGLTF.preload(MODEL_URL, DRACO_URL);diff --git a/app/components/ui/editor/mockups-3d/IPadMini63DViewer.tsx b/app/components/ui/editor/mockups-3d/IPadMini63DViewer.tsxnew file mode 100644index 0000000..ba7e001--- /dev/null+++ b/app/components/ui/editor/mockups-3d/IPadMini63DViewer.tsx@@ -0,0 +1,517 @@+"use client";+import { Canvas, useThree, useFrame } from "@react-three/fiber";+import { PerspectiveCamera, Environment, OrbitControls, ContactShadows, useGLTF } from "@react-three/drei";+import { useEffect, useRef, useState, Suspense, useCallback, useLayoutEffect } from "react";+import * as THREE from "three";+import {+ createCoverScreenCanvas,+ applyCropToImage,+ type ImageMaskConfigLike,+ parseShadowColor,+} from "@/lib/phone3d.utils";+import type { OrbitControls as OrbitControlsType } from 'three-stdlib';+import { EnvironmentPreset, HDRI_FILES } from "@/lib/viewer-controls3d";++export interface IPadMini63DApi {+ renderAt: (width: number, height: number) => void;+ restorePreview: () => void;+ hasBuiltInShadow: boolean;+}++interface Props {+ imageUrl?: string | null;+ imageMaskConfig?: ImageMaskConfigLike | null;+ cropArea?: { x: number; y: number; width: number; height: number } | null;+ initialRotationX?: number;+ initialRotationY?: number;+ initialRotationZ?: number;+ onRotationChange?: (rx: number, ry: number) => void;+ onMount?: (canvas: HTMLCanvasElement) => void;+ onApi?: (api: IPadMini63DApi | null) => void;+ zoom?: number;+ shadowIntensity?: number;+ shadowColor?: string;+ videoElement?: HTMLVideoElement | null;+ autoRotate?: boolean;+ rotationSpeed?: number;+ glow?: number;+ environment?: EnvironmentPreset;+}++const DEG = Math.PI / 180;+const PLACEHOLDER_IPAD_URL = "/images/mockups-3d/placeholder-phone.avif";+const MODEL_URL = "/models/ipad_mini_6_2021.glb";+const DRACO_URL = "/draco/";+const DEFAULT_CAMERA_POS: [number, number, number] = [0, 0, 1.5];++const TARGET_W = 1040;+const TARGET_H = 1500;++useGLTF.preload(MODEL_URL, DRACO_URL);++function ModelScene({+ imageUrl,+ imageMaskConfig,+ cropArea,+ initialRotationX = -58.23,+ initialRotationY = -29.82,+ initialRotationZ = 0,+ onRotationChange,+ rootRef,+ cameraRef,+ zoom = 1,+ onApi,+ onLoaded,+ videoElement,+ shadowIntensity = 0,+ shadowColor = "#000000",+ autoRotate = false,+ rotationSpeed = 3.5,+ glow = 1.0,+ environment = "studio",+}: Props & {+ rootRef: React.MutableRefObject<THREE.Group | null>;+ cameraRef: React.MutableRefObject<THREE.PerspectiveCamera | null>;+ onLoaded?: () => void;+}) {+ const { gl, scene, camera, invalidate } = useThree();+ const gltf = useGLTF(MODEL_URL, DRACO_URL);++ const orbitRef = useRef<OrbitControlsType | null>(null);+ const screenMatRef = useRef<THREE.MeshPhysicalMaterial | null>(null);+ const videoTextureRef = useRef<THREE.VideoTexture | null>(null);+ const modelContainerRef = useRef<THREE.Group>(null!);++ const lastLoadedUrlRef = useRef<string | null>(null);+ const lastLoadedCropKeyRef = useRef<string | null>(null);+ const onApiRef = useRef(onApi);++ useLayoutEffect(() => {+ onApiRef.current = onApi;+ });++ useFrame(() => {+ if (videoElement && videoTextureRef.current) {+ videoTextureRef.current.needsUpdate = true;+ }+ });++ useEffect(() => {+ const capturedOnApi = onApiRef.current;+ const RENDER_PIXEL_RATIO = 2;+ const api: IPadMini63DApi = {+ renderAt: (w, h) => {+ const cam = cameraRef.current ?? camera;+ if (!cam) return;+ const maxTexSize = gl.capabilities.maxTextureSize || 4096;+ const maxDim = Math.floor(maxTexSize / RENDER_PIXEL_RATIO) - 1;+ const safeW = Math.max(1, Math.min(Math.round(w), maxDim));+ const safeH = Math.max(1, Math.min(Math.round(h), maxDim));+ (cam as THREE.PerspectiveCamera).aspect = safeW / safeH;+ (cam as THREE.PerspectiveCamera).updateProjectionMatrix();+ gl.setPixelRatio(RENDER_PIXEL_RATIO);+ gl.setSize(safeW, safeH, false);+ if (videoTextureRef.current) videoTextureRef.current.needsUpdate = true;+ gl.render(scene, cam);+ },+ restorePreview: () => {+ const cam = cameraRef.current ?? camera;+ if (!cam) return;+ const freshW = gl.domElement.clientWidth;+ const freshH = gl.domElement.clientHeight;+ (cam as THREE.PerspectiveCamera).aspect = freshW / freshH;+ (cam as THREE.PerspectiveCamera).updateProjectionMatrix();+ gl.setPixelRatio(window.devicePixelRatio > 1 ? 2 : 1);+ gl.setSize(freshW, freshH, false);+ invalidate();+ },+ hasBuiltInShadow: true,+ };+ capturedOnApi?.(api);+ return () => capturedOnApi?.(null);+ }, [gl, scene, camera, cameraRef, invalidate]);++ const applyTexture = useCallback(() => {+ if (videoElement) return;+ const mat = screenMatRef.current;+ if (!mat) return;++ const cropKey = cropArea ? JSON.stringify(cropArea) : null;+ const targetImgUrl = imageUrl || PLACEHOLDER_IPAD_URL;++ if (+ lastLoadedUrlRef.current === targetImgUrl &&+ lastLoadedCropKeyRef.current === cropKey &&+ mat.map !== null+ ) {+ return;+ }++ const img = new Image();+ img.crossOrigin = "anonymous";+ img.onload = () => {+ const currentMat = screenMatRef.current;+ if (!currentMat) return;++ const sourceImg = cropArea ? applyCropToImage(img, cropArea) : img;+ const cover = createCoverScreenCanvas(sourceImg, TARGET_W, TARGET_H, 0, imageMaskConfig);++ if (currentMat.map) {+ currentMat.map.dispose();+ }++ const tex = new THREE.CanvasTexture(cover);+ tex.flipY = false;+ tex.center.set(0.5, 0.5);+ tex.rotation = Math.PI;+ tex.colorSpace = THREE.SRGBColorSpace;+ tex.generateMipmaps = true;+ tex.minFilter = THREE.LinearMipmapLinearFilter;+ tex.magFilter = THREE.LinearFilter;+ tex.wrapS = THREE.ClampToEdgeWrapping;+ tex.wrapT = THREE.ClampToEdgeWrapping;+ tex.anisotropy = gl.capabilities.getMaxAnisotropy();++ currentMat.map = tex;+ currentMat.color.set(0xffffff);+ currentMat.needsUpdate = true;++ lastLoadedUrlRef.current = targetImgUrl;+ lastLoadedCropKeyRef.current = cropKey;+ invalidate();+ };+ img.onerror = () => {+ if (mat.map) mat.map.dispose();+ mat.color.set(0x111111);+ mat.needsUpdate = true;+ invalidate();+ };+ img.src = targetImgUrl;+ }, [imageUrl, imageMaskConfig, cropArea, gl, videoElement, invalidate]);++ const applyVideoTextureIfReady = useCallback(() => {+ const mat = screenMatRef.current;+ const tex = videoTextureRef.current;+ if (mat && tex) {+ if (mat.map && mat.map !== tex) {+ mat.map.dispose();+ }+ tex.flipY = false;+ tex.center.set(0.5, 0.5);+ tex.rotation = Math.PI;+ tex.needsUpdate = true;+ mat.map = tex;+ mat.color.set(0xffffff);+ mat.needsUpdate = true;+ invalidate();+ }+ }, [invalidate]);++ useEffect(() => {+ if (!videoElement) {+ if (videoTextureRef.current) {+ videoTextureRef.current.dispose();+ videoTextureRef.current = null;+ }+ return;+ }+ const tex = new THREE.VideoTexture(videoElement);+ tex.flipY = false;+ tex.center.set(0.5, 0.5);+ tex.rotation = Math.PI;+ tex.colorSpace = THREE.SRGBColorSpace;+ tex.generateMipmaps = true;+ tex.minFilter = THREE.LinearMipmapLinearFilter;+ tex.magFilter = THREE.LinearFilter;+ tex.wrapS = THREE.ClampToEdgeWrapping;+ tex.wrapT = THREE.ClampToEdgeWrapping;+ if (videoTextureRef.current) {+ videoTextureRef.current.dispose();+ }+ videoTextureRef.current = tex;+ applyVideoTextureIfReady();+ return () => {+ if (videoTextureRef.current === tex) {+ videoTextureRef.current = null;+ }+ tex.dispose();+ };+ }, [videoElement, applyVideoTextureIfReady]);++ const applyTextureRef = useRef(applyTexture);+ useEffect(() => {+ applyTextureRef.current = applyTexture;+ }, [applyTexture]);++ useEffect(() => {+ applyTexture();+ }, [applyTexture]);++ // Lógica de centrado automático, escalado y corrección de rotación+ useEffect(() => {+ let isMounted = true;+ const group = gltf.scene.clone(true);++ const camZ = 1.5;+ const box = new THREE.Box3().setFromObject(group);+ const center = box.getCenter(new THREE.Vector3());+ const size = box.getSize(new THREE.Vector3());++ const halfH = camZ * Math.tan((40 / 2) * DEG);+ const sf = (halfH * 2 * 0.70) / size.y;++ // SOLUCIÓN: Creamos un wrapper para centrar y rotar 180 grados sin perder el eje+ const wrapper = new THREE.Group();++ // 1. Centramos el grupo original restando su propio centro+ group.position.copy(center).negate();++ // 2. Lo añadimos al wrapper+ wrapper.add(group);++ // 3. Escalamos y giramos 180 grados (Math.PI) en el eje Y para que no salga de espaldas+ wrapper.scale.setScalar(sf);+ wrapper.rotation.y = Math.PI;++ const basicMat = new THREE.MeshPhysicalMaterial({+ color: 0x000000,+ roughness: 0.8,+ metalness: 0.1,+ envMapIntensity: 0.1,+ clearcoat: 0.0,+ transparent: false,+ depthTest: true,+ depthWrite: true,+ });+ screenMatRef.current = basicMat;++ applyVideoTextureIfReady();++ group.traverse((child) => {+ if (child instanceof THREE.Mesh) {+ // SOLUCIÓN: Búsqueda flexible. GLB suele transformar "iPad Mini_Screen_0" en "iPad_Mini_Screen_0"+ if (child.name.includes("Screen")) {+ child.material = basicMat;+ }+ }+ });++ const container = modelContainerRef.current;+ if (container) {+ container.clear();+ // Añadimos el wrapper (que contiene el modelo centrado y rotado) en lugar del grupo directo+ container.add(wrapper);+ }++ setTimeout(() => {+ if (!isMounted) return;+ applyTextureRef.current();+ onLoaded?.();+ invalidate();+ }, 50);++ return () => {+ isMounted = false;+ if (screenMatRef.current) {+ if (screenMatRef.current.map) {+ screenMatRef.current.map.dispose();+ }+ screenMatRef.current.dispose();+ }+ };+ }, [gltf.scene, applyVideoTextureIfReady, onLoaded, invalidate]);++ const prevRotationRef = useRef<{ x: number; y: number } | null>(null);+ useEffect(() => {+ if (+ prevRotationRef.current?.x === initialRotationX &&+ prevRotationRef.current?.y === initialRotationY+ ) {+ return;+ }+ const id = setTimeout(() => {+ const orbit = orbitRef.current;+ if (!orbit) return;+ const radius = 1.5;+ const phi = Math.PI / 2 - initialRotationX * DEG;+ const theta = initialRotationY * DEG;+ orbit.object.position.setFromSphericalCoords(radius, phi, theta);+ orbit.update();+ invalidate();+ prevRotationRef.current = { x: initialRotationX, y: initialRotationY };+ }, 0);+ return () => clearTimeout(id);+ }, [initialRotationX, initialRotationY, zoom, invalidate]);++ useEffect(() => {+ if (rootRef.current) {+ rootRef.current.rotation.z = initialRotationZ * DEG;+ invalidate();+ }+ }, [initialRotationZ, invalidate]);++ const shadowT = Math.max(0, Math.min(1, shadowIntensity));+ const showContactShadow = shadowT > 0.01;+ const contactOpacity = shadowT * 0.65;+ const contactBlur = 1.5 + shadowT * 1.5;++ return (+ <>+ <PerspectiveCamera ref={cameraRef} makeDefault fov={40} near={0.01} far={100} position={DEFAULT_CAMERA_POS} zoom={zoom} />+ <OrbitControls+ ref={orbitRef}+ enableZoom={false}+ enablePan={false}+ enableDamping+ dampingFactor={0.08}+ autoRotate={autoRotate}+ autoRotateSpeed={rotationSpeed}+ onEnd={() => {+ const orbit = orbitRef.current;+ if (!orbit || !onRotationChange) return;+ const ry = orbit.getAzimuthalAngle() * (180 / Math.PI);+ const rx = (Math.PI / 2 - orbit.getPolarAngle()) * (180 / Math.PI);+ onRotationChange(rx, ry);+ }}+ />+ <Environment files={HDRI_FILES[environment as EnvironmentPreset]} environmentIntensity={glow} background={false} />++ <ambientLight intensity={0.3} />+ <directionalLight position={[3, 6, 5]} intensity={0.6} />+ <directionalLight position={[-4, -2, 3]} intensity={0.25} color="#c8d8ff" />+ <directionalLight position={[0, -5, 5]} intensity={0.35} />++ {showContactShadow && (+ <ContactShadows+ position={[0, -0.65, 0]}+ opacity={contactOpacity}+ scale={4}+ blur={contactBlur}+ far={4}+ color={shadowColor}+ resolution={512}+ />+ )}++ <group ref={rootRef} rotation={[0, 0, initialRotationZ * DEG]}>+ <group ref={modelContainerRef} />+ </group>+ </>+ );+}++function CanvasWithLoader(+ props: Props & {+ rootRef: React.MutableRefObject<THREE.Group | null>;+ cameraRef: React.MutableRefObject<THREE.PerspectiveCamera | null>;+ }+) {+ const [loaded, setLoaded] = useState(false);+ const handleLoaded = useCallback(() => setLoaded(true), []);++ return (+ <>+ <Canvas+ style={{ width: "100%", height: "100%", overflow: "visible" }}+ gl={{+ antialias: true,+ alpha: true,+ preserveDrawingBuffer: true,+ powerPreference: "high-performance",+ failIfMajorPerformanceCaveat: false,+ }}+ dpr={3}+ frameloop={props.videoElement ? "always" : "demand"}+ resize={{ scroll: false, debounce: { scroll: 0, resize: 0 } }}+ onCreated={({ gl, scene }) => {+ gl.outputColorSpace = THREE.SRGBColorSpace;+ gl.toneMapping = THREE.NeutralToneMapping;+ gl.toneMappingExposure = 1.0;+ scene.environmentIntensity = 1.6;+ props.onMount?.(gl.domElement);+ }}+ >+ <Suspense fallback={null}>+ <ModelScene {...props} onLoaded={handleLoaded} />+ </Suspense>+ </Canvas>++ {!loaded && (+ <div className="absolute inset-0 flex items-center justify-center pointer-events-none" style={{ zIndex: 4 }}>+ <div className="w-6 h-6 border-2 border-white/20 border-t-white/60 rounded-full animate-spin" />+ </div>+ )}+ </>+ );+}++export function IPadMini63DViewer(props: Props) {+ const { shadowIntensity = 0, shadowColor = "#000000" } = props;+ const rootRef = useRef<THREE.Group | null>(null);+ const cameraRef = useRef<THREE.PerspectiveCamera | null>(null);+ const [grabbing, setGrabbing] = useState(false);++ const t = Math.max(0, Math.min(1, shadowIntensity));+ const tEased = t * t;+ const computedBlur = tEased * 60;+ const computedOpacity = tEased * 0.7;+ const shadowRgba = shadowColor.startsWith("#") ? parseShadowColor(shadowColor, computedOpacity) : shadowColor;+ const hasShadow = t > 0.01;++ const VIEWER_W = 750;+ const VIEWER_H = 1000;++ return (+ <>+ <div+ style={{+ display: "inline-block",+ transformOrigin: "top center",+ width: VIEWER_W,+ height: VIEWER_H + (hasShadow ? computedBlur * 0.8 : 0),+ marginTop: "100px",+ marginLeft: "100px",+ }}+ >+ <div style={{ position: "relative", width: VIEWER_W, height: VIEWER_H }}>+ {hasShadow && (+ <div+ aria-hidden+ style={{+ position: "absolute",+ bottom: -(computedBlur * 0.5),+ left: `${15 + tEased * 5}%`,+ width: `${70 - tEased * 10}%`,+ height: Math.max(4, computedBlur * 0.55),+ borderRadius: "50%",+ background: shadowRgba,+ filter: `blur(${Math.max(2, computedBlur * 0.6)}px)`,+ zIndex: 0,+ pointerEvents: "none",+ }}+ />+ )}+ <div+ style={{+ position: "absolute",+ inset: "-300px",+ zIndex: 2,+ overflow: "visible",+ cursor: grabbing ? "grabbing" : "grab",+ filter: hasShadow+ ? `drop-shadow(0px ${(tEased * 22).toFixed(1)}px ${(tEased * 32).toFixed(1)}px ${shadowRgba})`+ : "none",+ transition: "filter 0.15s ease",+ pointerEvents: "auto",+ }}+ onPointerDown={() => setGrabbing(true)}+ onPointerUp={() => setGrabbing(false)}+ onPointerLeave={() => setGrabbing(false)}+ >+ <CanvasWithLoader {...props} rootRef={rootRef} cameraRef={cameraRef} />+ </div>+ </div>+ </div>+ </>+ );+}\ No newline at end of filediff --git a/app/components/ui/editor/mockups-3d/IPhone13ProMax3DViewer.tsx b/app/components/ui/editor/mockups-3d/IPhone13ProMax3DViewer.tsxindex 160d8a0..7fdbdd3 100644--- a/app/components/ui/editor/mockups-3d/IPhone13ProMax3DViewer.tsx+++ b/app/components/ui/editor/mockups-3d/IPhone13ProMax3DViewer.tsx@@ -38,7 +38,7 @@ const TEX_W = 1284 * 2;const TEX_H = 2778 * 2;const PLACEHOLDER_PHONE_URL = "/images/mockups-3d/placeholder-phone.avif";const DEFAULT_CAMERA_POS: [number, number, number] = [0, 0, 1.5];-const DRACO_URL = "https://www.gstatic.com/draco/versioned/decoders/1.5.6/";+const DRACO_URL = "/draco/";useGLTF.preload("/models/apple_iphone_13_pro_max.glb", DRACO_URL);diff --git a/app/components/ui/editor/mockups-3d/IPhone17ProMax3DViewer.tsx b/app/components/ui/editor/mockups-3d/IPhone17ProMax3DViewer.tsxindex 43495f1..1b12c81 100644--- a/app/components/ui/editor/mockups-3d/IPhone17ProMax3DViewer.tsx+++ b/app/components/ui/editor/mockups-3d/IPhone17ProMax3DViewer.tsx@@ -39,7 +39,7 @@ const TEX_W = 1284 * 2;const TEX_H = 2778 * 2;const PLACEHOLDER_PHONE_URL = "/images/mockups-3d/placeholder-phone.avif";const DEFAULT_CAMERA_POS: [number, number, number] = [0, 0, 1.5];-const DRACO_URL = "https://www.gstatic.com/draco/versioned/decoders/1.5.6/";+const DRACO_URL = "/draco/";useGLTF.preload("/models/iphone-17-pro-max.glb", DRACO_URL);diff --git a/app/contexts/Mockup3dContext.tsx b/app/contexts/Mockup3dContext.tsxindex 09119c9..0994cb7 100644--- a/app/contexts/Mockup3dContext.tsx+++ b/app/contexts/Mockup3dContext.tsx@@ -36,8 +36,8 @@ interface Mockup3dState {imagePhonePerspective: number;setImagePhonePerspective: (v: number) => void;/** Which 3D device model is active: the default phone JSON, iPhone 15 Pro Max, Samsung S25 Ultra, or single macOS laptop */- imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop';- setImagePhoneDevice: (d: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop') => void;+ imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop' | 'ipad_mini_6_2021';+ setImagePhoneDevice: (d: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop' | 'ipad_mini_6_2021') => void;imagePhonePresetId: string;setImagePhonePresetId: (id: string) => void;/** Laptop opening animation progress (0 = closed, 1 = fully open) */@@ -68,7 +68,7 @@ export function Mockup3dProvider({ children }: { children: ReactNode }) {const [imagePhoneRotY, setImagePhoneRotY] = useState(0);const [imagePhoneRotZ, setImagePhoneRotZ] = useState(0);const [imagePhonePerspective, setImagePhonePerspective] = useState(600);- const [imagePhoneDevice, setImagePhoneDevice] = useState<'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop'>('phone');+ const [imagePhoneDevice, setImagePhoneDevice] = useState<'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop' | 'ipad_mini_6_2021'>('phone');const [imagePhonePresetId, setImagePhonePresetId] = useState('front');const [imagePhoneOpening, setImagePhoneOpening] = useState(1);const [imagePhoneShadow, setImagePhoneShadow] = useState(0.6);diff --git a/hooks/useImageProjects.ts b/hooks/useImageProjects.tsindex 26e8648..8e7f8d9 100644--- a/hooks/useImageProjects.ts+++ b/hooks/useImageProjects.ts@@ -50,7 +50,7 @@ interface ImageProjectState {imagePhoneRotY: number;imagePhoneRotZ: number;imagePhonePerspective: number;- imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop';+ imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop' | 'ipad_mini_6_2021';imagePhonePresetId: string;imagePhoneOpening: number;imagePhoneShadow: number;diff --git a/lib/mockup-data.tsx b/lib/mockup-data.tsxindex d3e3e91..d775115 100644--- a/lib/mockup-data.tsx+++ b/lib/mockup-data.tsx@@ -349,13 +349,12 @@ export const MOCKUPS: Mockup[] = [hasUrl: false,hasHeaderScale: true,hasCornerRadius: true,- hasHeaderOpacity: true,+ hasHeaderOpacity: false,},defaultConfig: {darkMode: false,headerScale: 60,cornerRadius: 28,- headerOpacity: 30,},preview: (<HardShellPreview />@@ -371,14 +370,13 @@ export const MOCKUPS: Mockup[] = [hasUrl: false,hasHeaderScale: true,hasCornerRadius: true,- hasHeaderOpacity: true,+ hasHeaderOpacity: false,},defaultConfig: {darkMode: true,frameColor: "#262626",headerScale: 60,cornerRadius: 28,- headerOpacity: 30,},preview: (<S24UltraPreview />diff --git a/lib/phone3d.utils.ts b/lib/phone3d.utils.tsindex 5d1202f..5717559 100644--- a/lib/phone3d.utils.ts+++ b/lib/phone3d.utils.ts@@ -35,6 +35,7 @@ export const DEVICE_3D_DIMENSIONS: Record<string, { width: number; height: numbe'iphone-17-pro-max': { width: 480, height: 1000 },'double_iphone_13_pro': { width: 960, height: 2000 },'laptop': { width: 1500, height: 1035 },+ 'ipad_mini_6_2021': { width: 1040, height: 1500 },};export const CAM_FOV = 20;@@ -73,6 +74,7 @@ export const DEVICE_VIEWER_DEFAULTS: Record<string, { environment: EnvironmentPrlaptop: { environment: "forest", glow: 1.0 },phone: { environment: "studio", glow: 2.0 },iphone: { environment: "studio", glow: 2.0 },+ "ipad_mini_6_2021": { environment: "studio", glow: 1.0 },};export function getDeviceFromModelUrl(modelUrl: string | undefined): DeviceKey {diff --git a/public/models/ipad_mini_6_2021.glb b/public/models/ipad_mini_6_2021.glbnew file mode 100644index 0000000..ffe494fBinary files /dev/null and b/public/models/ipad_mini_6_2021.glb differdiff --git a/types/editor-state.types.ts b/types/editor-state.types.tsindex f796856..5529ad5 100644--- a/types/editor-state.types.ts+++ b/types/editor-state.types.ts@@ -45,7 +45,7 @@ export interface EditorState {imagePhoneRotY: number;imagePhoneRotZ: number;imagePhonePerspective: number;- imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop';+ imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'iphone-17-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop' | 'ipad_mini_6_2021';imagePhonePresetId: string;imagePhoneOpening: number;imagePhoneShadow: number;diff --git a/types/image-project.types.ts b/types/image-project.types.tsindex 14dd664..c2bfd79 100644--- a/types/image-project.types.ts+++ b/types/image-project.types.ts@@ -50,7 +50,7 @@ export interface ImageProject {imagePhoneRotY: number;imagePhoneRotZ: number;imagePhonePerspective: number;- imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop' | 'iphone-17-pro-max';+ imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop' | 'iphone-17-pro-max' | 'ipad_mini_6_2021';imagePhonePresetId: string;imagePhoneOpening: number;imagePhoneShadow: number;diff --git a/types/mockup.types.ts b/types/mockup.types.tsindex 7164a28..3aa6d3f 100644--- a/types/mockup.types.ts+++ b/types/mockup.types.ts@@ -144,4 +144,13 @@ export const IMAGE_DEVICE_TEMPLATES = [posterUrl: encodeURI("/images/mockups-3d/macos-laptop.avif"),videoUrl: encodeURI("/videos/mockups-3d/macos-laptop.mp4"),},+ {+ id: "ipad_mini_6_2021",+ title: "iPad mini 6 (2021)",+ accentColor: "#a3b8cc",+ icon: "ph:tablet-bold",+ modelUrl: "/models/ipad_mini_6_2021.glb",+ posterUrl: encodeURI("/images/mockups-3d/macos-laptop.avif"),+ videoUrl: encodeURI("/videos/mockups-3d/macos-laptop.mp4"),+ },] as const;\ No newline at end of file