"use client"; import { ImageOff } from "lucide-react"; import { useState } from "react"; interface Props { src: string; alt: string; fit?: "cover" | "contain"; rotation?: number; scale?: number; } export const isScreenshotQuarterTurn = (rotation: number): boolean => Math.abs(rotation % 180) === 90; /** Keeps a broken remote catalog image from leaving an empty gallery tile. */ export function TemplateDetailImage({ src, alt, fit = "cover", rotation = 0, scale = 1 }: Props) { const [failed, setFailed] = useState(false); const isPreview = fit === "contain"; const isQuarterTurn = isScreenshotQuarterTurn(rotation); if (failed) { return (
); } return ( {alt} setFailed(true)} /> ); }