Create professional demos and 3D mockups in seconds, directly in your browser
Refactor VideoCanvas and Phone3DViewer components; adjust rotation logic in DoubleIPhone3DViewer; update SocialReactions card height and text clamping; modify CanvasContextMenu translations for clarity.
CristianOlivera1c8a151f6307f
diff --git a/app/components/ui/editor/PhotoEditorPlaceholder.tsx b/app/components/ui/editor/PhotoEditorPlaceholder.tsxindex 03b1a5c..48f2b4e 100644--- a/app/components/ui/editor/PhotoEditorPlaceholder.tsx+++ b/app/components/ui/editor/PhotoEditorPlaceholder.tsx@@ -9,608 +9,602 @@ import { AspectRatioSelect } from "@/app/components/ui/AspectRatioSelect";import { TooltipAction } from "@/components/ui/tooltip-action";import { ImageMaskEditor } from "./ImageMaskEditor";import {- Popover,- PopoverTrigger,- PopoverContent,- PopoverHeader,- PopoverTitle,+ Popover,+ PopoverTrigger,+ PopoverContent,+ PopoverHeader,+ PopoverTitle,} from "@/components/ui/popover";-import { PhotoEditorPlaceholderProps, Preview3DConfig, PREVIEW_CONFIGS, THREEJS_PHONE_ROTATIONS, THREEJS_LAPTOP_ROTATIONS, CSS_PHONE_PREVIEW_ROTATIONS, CSS_LAPTOP_PREVIEW_ROTATIONS } from "@/types/photo.types";+import {+ PhotoEditorPlaceholderProps,+ Preview3DConfig,+ PREVIEW_CONFIGS,+ LAPTOP_IMAGE_PREVIEWS,+ PhoneImagePreviewConfig,+ LaptopImagePreviewConfig,+ getPhoneImagePreviews,+} from "@/types/photo.types";import { useMockup3dContext } from "@/app/contexts/Mockup3dContext";const DEFAULT_PHONE_ROTATION = { rx: -58.23, ry: -29.82 };const DEFAULT_LAPTOP_ROTATION = { rx: 43.23, ry: -37.82 };function getDefaultRotation(device: string) {- return device === "laptop" ? DEFAULT_LAPTOP_ROTATION : DEFAULT_PHONE_ROTATION;+ return device === "laptop" ? DEFAULT_LAPTOP_ROTATION : DEFAULT_PHONE_ROTATION;}export function PhotoEditorPlaceholder({- className = "",- canvasImageUrl,- staticImageUrl,- onSelectPreview,- selectedPreviewId = "front",- aspectRatio = "auto",- onAspectRatioChange,- customAspectRatio = null,- onCustomAspectRatioChange,- onOpenCropper,- apply3DToBackground = false,- onToggle3DBackground,- imageMaskConfig,- onImageMaskConfigChange,- onReset,+ className = "",+ canvasImageUrl,+ staticImageUrl,+ onSelectPreview,+ selectedPreviewId = "front",+ aspectRatio = "auto",+ onAspectRatioChange,+ customAspectRatio = null,+ onCustomAspectRatioChange,+ onOpenCropper,+ apply3DToBackground = false,+ onToggle3DBackground,+ imageMaskConfig,+ onImageMaskConfigChange,+ onReset,}: PhotoEditorPlaceholderProps) {- const previewImageUrl = staticImageUrl ?? canvasImageUrl;- const t = useTranslations("editor");- const { imagePhoneActive, imagePhoneDevice, setImagePhoneRotX, setImagePhoneRotY, setImagePhoneRotZ, setImagePhonePerspective, setImagePhoneScale, setImagePhoneY, setImagePhonePresetId } = useMockup3dContext();- const [customConfig, setCustomConfig] = useState<Preview3DConfig>({- id: "custom",- label: "Custom",- rotateX: 0,- rotateY: 0,- rotateZ: 0,- translateY: 0,- scale: 0.9,- perspective: 600,- });- const [isCustomPopoverOpen, setIsCustomPopoverOpen] = useState(false);-- const isCustomUntouched =- customConfig.rotateX === 0 &&- customConfig.rotateY === 0 &&- customConfig.rotateZ === 0 &&- customConfig.translateY === 0 &&- customConfig.scale === 0.9 &&- customConfig.perspective === 600;-- const updateCustomConfig = useCallback(- (updates: Partial<Preview3DConfig>) => {- const newConfig = { ...customConfig, ...updates };- setCustomConfig(newConfig);- if (selectedPreviewId === "custom") {- onSelectPreview?.(newConfig);- }- },- [customConfig, onSelectPreview, selectedPreviewId]+ const previewImageUrl = staticImageUrl ?? canvasImageUrl;+ const t = useTranslations("editor");++ const {+ imagePhoneActive,+ imagePhoneDevice,+ setImagePhoneRotX,+ setImagePhoneRotY,+ setImagePhoneRotZ,+ setImagePhonePerspective,+ setImagePhoneScale,+ setImagePhoneX,+ setImagePhoneY,+ setImagePhonePresetId,+ setImagePhoneOpening+ } = useMockup3dContext();++ const [customConfig, setCustomConfig] = useState<Preview3DConfig>({+ id: "custom",+ label: "Custom",+ rotateX: 0,+ rotateY: 0,+ rotateZ: 0,+ translateY: 0,+ scale: 0.9,+ perspective: 600,+ });++ const [isCustomPopoverOpen, setIsCustomPopoverOpen] = useState(false);++ const isCustomUntouched =+ customConfig.rotateX === 0 &&+ customConfig.rotateY === 0 &&+ customConfig.rotateZ === 0 &&+ customConfig.translateY === 0 &&+ customConfig.scale === 0.9 &&+ customConfig.perspective === 600;++ const updateCustomConfig = useCallback(+ (updates: Partial<Preview3DConfig>) => {+ const newConfig = { ...customConfig, ...updates };+ setCustomConfig(newConfig);+ if (selectedPreviewId === "custom") {+ onSelectPreview?.(newConfig);+ }+ },+ [customConfig, onSelectPreview, selectedPreviewId]+ );++ const allPreviews: Preview3DConfig[] = [+ { ...customConfig, label: t("photoPreview.custom.label") },+ ...PREVIEW_CONFIGS.map((config) => ({+ ...config,+ label: t(`photoPreview.configs.${config.id}`),+ })),+ ];++ if (!previewImageUrl) {+ return (+ <div+ className={`flex flex-col items-center justify-center bg-black border-t border-white/10 ${className}`}+ style={{ height: "180px" }}+ >+ <div className="flex flex-col items-center gap-3 text-white/40">+ <div className="p-3 rounded-xl bg-white/5 border border-white/10">+ <Icon icon="lucide:image" width={28} height={28} aria-hidden="true" />+ </div>+ <div className="text-center">+ <p className="text-sm font-medium text-white/60">+ {t("photoMode.title") || "No Image"}+ </p>+ <p className="text-xs text-white/40 mt-1 max-w-xs">+ {t("photoMode.description") || "Upload or capture an image to get started"}+ </p>+ </div>+ </div>+ </div>);+ }++ const renderPreviewCard = (config: Preview3DConfig) => {+ const isSelected = selectedPreviewId === config.id;+ const isCustom = config.id === "custom";++ const ButtonCard = (+ <button+ onClick={() => {+ if (isCustom && selectedPreviewId !== "custom") {+ let activePreset: Preview3DConfig | undefined = PREVIEW_CONFIGS.find(+ (p) => p.id === selectedPreviewId+ );- const allPreviews: Preview3DConfig[] = [- { ...customConfig, label: t("photoPreview.custom.label") },- ...PREVIEW_CONFIGS.map(config => ({- ...config,- label: t(`photoPreview.configs.${config.id}`)- })),- ];+ if (!activePreset && imagePhoneActive) {+ const deviceList = imagePhoneDevice === "laptop" ? LAPTOP_IMAGE_PREVIEWS : getPhoneImagePreviews(imagePhoneDevice);++ const devicePreset = deviceList.find((p) => p.id === selectedPreviewId);++ if (devicePreset) {+ activePreset = {+ id: devicePreset.id,+ label: devicePreset.label,+ rotateX: devicePreset.rotateX,+ rotateY: devicePreset.rotateY,+ rotateZ: devicePreset.rotateZ,+ translateY: devicePreset.y,+ scale: devicePreset.scale,+ perspective: 600,+ };+ }+ }- if (!previewImageUrl) {- return (+ if (activePreset) {+ const seeded: Preview3DConfig = {+ ...activePreset,+ id: "custom",+ label: t("photoPreview.custom.label"),+ };+ setCustomConfig(seeded);+ onSelectPreview?.(seeded);+ setIsCustomPopoverOpen(true);+ return;+ }+ }++ onSelectPreview?.(config);+ if (isCustom) setIsCustomPopoverOpen(true);+ }}+ className={`group relative shrink-0 w-32 sm:w-62 aspect-video squircle-element p-px transition-all duration-300 ease-out outline-none ${isSelected+ ? `shadow-[0_0_20px_rgba(0,163,255,0.15)]`+ : isCustom && isCustomUntouched+ ? "bg-gradient-radial-primary border border-dashed border-white/20 hover:border-white/40"+ : "bg-white/10 hover:bg-white/20"+ }`}+ aria-label={config.label}+ aria-pressed={isSelected}+ >+ <div+ className={`relative w-full h-full rounded-[10px] overflow-hidden transition-colors ${isCustom && isCustomUntouched ? "bg-transparent" : "bg-black/90"+ }`}+ >+ {(!isCustom || !isCustomUntouched) && (<div- className={`flex flex-col items-center justify-center bg-black border-t border-white/10 ${className}`}- style={{ height: "180px" }}- >- <div className="flex flex-col items-center gap-3 text-white/40">- <div className="p-3 rounded-xl bg-white/5 border border-white/10">- <Icon icon="lucide:image" width={28} height={28} aria-hidden="true" />- </div>- <div className="text-center">- <p className="text-sm font-medium text-white/60">- {t("photoMode.title") || "No Image"}- </p>- <p className="text-xs text-white/40 mt-1 max-w-xs">- {t("photoMode.description") || "Upload or capture an image to get started"}- </p>- </div>+ className="absolute inset-0 opacity-10 pointer-events-none group-hover:opacity-[0.3] transition-opacity duration-300"+ style={{+ backgroundImage: `radial-gradient(circle, #ffffff 0.8px, transparent 0.8px)`,+ backgroundSize: "10px 10px",+ }}+ />+ )}++ {isCustom && isCustomUntouched ? (+ <div className="absolute inset-0 flex flex-col items-center justify-center gap-1.5 bg-white/3 group-hover:bg-white/5 border border-white/10 transition-colors">+ <div className="w-7 h-7 rounded-full bg-white/5 border border-white/5 flex items-center justify-center">+ <Icon+ icon="mdi:tune-variant"+ width={14}+ className="text-white/60 group-hover:text-[#00A3EE] transition-colors"+ />+ </div>+ <span className="text-[10px] font-medium text-white/50 group-hover:text-white/80 transition-colors">+ {t("photoPreview.custom.customize")}+ </span>+ </div>+ ) : (+ <>+ <div className="absolute inset-0 bg-linear-to-br from-white/3 to-transparent" />+ {isCustom && (+ <div className="absolute top-2 left-2 z-20 flex items-center gap-1 bg-black/60 backdrop-blur-md border border-white/10 px-1.5 py-0.5 rounded text-[9px] font-bold text-white/90 uppercase tracking-wider pointer-events-none shadow-lg">+ <Icon icon="mdi:tune" width={10} className="text-[#00A3EE]" aria-hidden="true" />+ {t("photoPreview.custom.customize")}</div>+ )}+ <div className="absolute inset-0 flex items-center justify-center z-10">+ <div+ style={{+ perspective: `${config.perspective || 600}px`,+ perspectiveOrigin: "center center",+ }}+ className="w-full h-full flex items-center justify-center p-3"+ >+ <div+ className="relative w-full h-full max-w-[92%] max-h-[92%] rounded-lg overflow-hidden border border-white/10 shadow-2xl"+ style={{+ transform: `rotateX(${config.rotateX}deg) rotateY(${config.rotateY}deg) rotateZ(${config.rotateZ}deg) scale(${config.scale}) translateY(${config.translateY}%)`,+ transformStyle: "preserve-3d",+ transition: "transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94)",+ }}+ >+ {previewImageUrl && (+ <img+ src={previewImageUrl}+ alt={config.label}+ className="w-full h-full object-cover"+ draggable={false}+ />+ )}+ </div>+ </div>+ </div>+ <div className="absolute inset-0 bg-linear-to-t from-black/80 via-black/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none z-20" />+ <div className="absolute bottom-2 left-2 opacity-0 group-hover:opacity-100 transition-all duration-300 translate-y-1 group-hover:translate-y-0 pointer-events-none flex items-center gap-1.5 z-20">+ {!isCustom && (+ <Icon icon="mdi:eye-outline" width={12} className="text-white/70" aria-hidden="true" />+ )}+ <span className="text-[11px] font-medium text-white/90 tracking-wide">+ {config.label}+ </span>+ </div>+ </>+ )}+ {isSelected && (+ <div+ className={`absolute top-2 right-2 z-30 size-5 rounded-full bg-gradient-primary flex items-center justify-center shadow-xl`}+ aria-hidden="true"+ >+ <Icon icon="mdi:check-bold" width={12} className="text-white" aria-hidden="true" /></div>- );- }+ )}+ </div>+ </button>+ );- const renderPreviewCard = (config: Preview3DConfig) => {- const isSelected = selectedPreviewId === config.id;- const isCustom = config.id === "custom";- const ButtonCard = (- <button- onClick={() => {- if (isCustom && selectedPreviewId !== "custom") {- // Seed custom config from the currently active preset- const activePreset = PREVIEW_CONFIGS.find(p => p.id === selectedPreviewId);- if (activePreset) {- const seeded: Preview3DConfig = {- ...activePreset,- id: "custom",- label: t("photoPreview.custom.label"),- };- setCustomConfig(seeded);- onSelectPreview?.(seeded);- setIsCustomPopoverOpen(true);- return;- }- }- onSelectPreview?.(config);- if (isCustom) setIsCustomPopoverOpen(true);- if (imagePhoneActive) {- const threejsMap = imagePhoneDevice === "laptop"- ? THREEJS_LAPTOP_ROTATIONS- : THREEJS_PHONE_ROTATIONS;- const rotation = threejsMap[config.id];- if (rotation) {- setImagePhoneRotX(rotation.rx);- setImagePhoneRotY(rotation.ry);- setImagePhonePresetId(config.id);- }- }+ if (isCustom) {+ return (+ <Popover open={isCustomPopoverOpen} onOpenChange={setIsCustomPopoverOpen} key={config.id}>+ <PopoverTrigger asChild>{ButtonCard}</PopoverTrigger>+ <PopoverContent+ align="start"+ sideOffset={12}+ className="w-64 bg-[#0A0A0A] border-white/10 shadow-2xl p-4 space-y-4 rounded-xl z-50"+ >+ <PopoverHeader className="mb-2">+ <PopoverTitle className="text-xs font-semibold text-white/80 tracking-wide uppercase flex items-center gap-2">+ <Icon icon="mdi:tune" width={14} className="text-[#00A3EE]" />+ {t("photoPreview.custom.title")}+ </PopoverTitle>+ </PopoverHeader>++ <div className="space-y-4">+ {!imagePhoneActive && (+ <SliderControl+ icon="mdi:cube-outline"+ label={t("photoPreview.custom.perspective")}+ value={customConfig.perspective || 600}+ min={200}+ max={1000}+ step={50}+ onChange={(value) => {+ updateCustomConfig({ perspective: value });+ }}+ suffix="px"+ />+ )}++ <SliderControl+ icon="mdi:resize"+ label={t("photoPreview.custom.scale")}+ value={Math.round(customConfig.scale * 100)}+ min={50}+ max={150}+ step={5}+ onChange={(value) => {+ updateCustomConfig({ scale: value / 100 });+ if (imagePhoneActive) setImagePhoneScale(value / 100);}}- className={`group relative shrink-0 w-32 sm:w-62 aspect-video squircle-element p-px transition-all duration-300 ease-out outline-none ${isSelected- ? `shadow-[0_0_20px_rgba(0,163,255,0.15)]`- : isCustom && isCustomUntouched- ? "bg-gradient-radial-primary border border-dashed border-white/20 hover:border-white/40"- : "bg-white/10 hover:bg-white/20"- }`}- aria-label={config.label}- aria-pressed={isSelected}- >+ suffix="%"+ />++ <div className="space-y-2">+ <div className="flex items-center gap-1.5 text-[11px] text-white/50">+ <Icon icon="mdi:rotate-3d-variant" width={12} />+ <span>{t("photoPreview.custom.rotationXY")}</span>+ </div><div- className={`relative w-full h-full rounded-[10px] overflow-hidden transition-colors ${isCustom && isCustomUntouched ? "bg-transparent" : "bg-black/90"- }`}+ className="relative w-full aspect-square bg-white/3 rounded-lg border border-white/10 cursor-crosshair overflow-hidden hover:bg-white/4 transition-colors"+ onClick={(e) => {+ const rect = e.currentTarget.getBoundingClientRect();+ const x = ((e.clientX - rect.left) / rect.width) * 2 - 1;+ const y = ((e.clientY - rect.top) / rect.height) * 2 - 1;+ const rY = Math.round(-x * 45);+ const rX = Math.round(y * 45);++ updateCustomConfig({ rotateY: rY, rotateX: rX });+ if (imagePhoneActive) {+ setImagePhoneRotX(rX);+ setImagePhoneRotY(rY);+ }+ }}>- {(!isCustom || !isCustomUntouched) && (- <div- className="absolute inset-0 opacity-10 pointer-events-none group-hover:opacity-[0.3] transition-opacity duration-300"- style={{- backgroundImage: `radial-gradient(circle, #ffffff 0.8px, transparent 0.8px)`,- backgroundSize: '10px 10px',- }}- />- )}- {isCustom && isCustomUntouched ? (- <div className="absolute inset-0 flex flex-col items-center justify-center gap-1.5 bg-white/3 group-hover:bg-white/5 border border-white/10 transition-colors">- <div className="w-7 h-7 rounded-full bg-white/5 border border-white/5 flex items-center justify-center">- <Icon icon="mdi:tune-variant" width={14} className="text-white/60 group-hover:text-[#00A3EE] transition-colors" />- </div>- <span className="text-[10px] font-medium text-white/50 group-hover:text-white/80 transition-colors">- {t("photoPreview.custom.customize")}- </span>- </div>- ) : (- <>- <div className="absolute inset-0 bg-linear-to-br from-white/3 to-transparent" />- {isCustom && (- <div className="absolute top-2 left-2 z-20 flex items-center gap-1 bg-black/60 backdrop-blur-md border border-white/10 px-1.5 py-0.5 rounded text-[9px] font-bold text-white/90 uppercase tracking-wider pointer-events-none shadow-lg">- <Icon icon="mdi:tune" width={10} className="text-[#00A3EE]" aria-hidden="true" />- {t("photoPreview.custom.customize")}- </div>- )}- {/* 3D preview: phone shape when phone active, CSS-transformed image otherwise */}- <div className="absolute inset-0 flex items-center justify-center z-10">- {imagePhoneActive ? (- imagePhoneDevice === "laptop" ? (- <div style={{- perspective: `${Math.round((config.perspective || 600) * 0.5)}px`,- perspectiveOrigin: 'center center',- }}>- {(() => {- const cssRot = CSS_LAPTOP_PREVIEW_ROTATIONS[config.id] ?? CSS_LAPTOP_PREVIEW_ROTATIONS["front"]!;- return (- <div style={{- transform: `rotateX(${cssRot.rx}deg) rotateY(${cssRot.ry}deg)`,- transformStyle: 'preserve-3d',- transition: 'transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94)',- width: 96, height: 62,- position: 'relative',- filter: 'drop-shadow(0 8px 16px rgba(0,0,0,0.6))',- }}>-- <div style={{- position: 'absolute', top: 0, left: '1%', right: '1%', height: '62%',- borderRadius: '4px 4px 0 0',- background: '#151515',- border: '1px solid #333',- borderBottom: 'none',- overflow: 'hidden',- boxShadow: 'inset 0 1px 1px rgba(255,255,255,0.1)',- }}>- <div style={{- position: 'absolute', top: '4%', left: '2%', right: '2%', bottom: '6%',- backgroundColor: '#000',- ...(previewImageUrl- ? { backgroundImage: `url(${previewImageUrl})`, backgroundSize: 'cover', backgroundPosition: 'center' }- : { background: 'linear-gradient(135deg, rgba(0,163,255,0.15) 0%, rgba(0,0,0,0.8) 100%)' }- ),- }}>- <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(115deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 45%)', pointerEvents: 'none' }} />- </div>-- <div style={{ position: 'absolute', top: '1.5%', left: '50%', transform: 'translateX(-50%)', width: 2, height: 2, borderRadius: '50%', background: '#000', border: '0.5px solid rgba(255,255,255,0.15)' }} />-- <div style={{ position: 'absolute', bottom: '2%', left: '50%', transform: 'translateX(-50%)', width: 8, height: 1, borderRadius: '1px', background: 'rgba(255,255,255,0.15)' }} />- </div>-- <div style={{- position: 'absolute', bottom: 0, left: 0, right: 0, height: '38%',- borderRadius: '2px 2px 4px 4px',- background: 'linear-gradient(180deg, #d0d2d7 0%, #9ca0a8 100%)',- border: '1px solid #888',- boxShadow: 'inset 0 1px 2px rgba(255,255,255,0.9), 0 2px 4px rgba(0,0,0,0.4)',- display: 'flex', flexDirection: 'column', alignItems: 'center',- }}>-- <div style={{ position: 'absolute', top: 0, left: '50%', transform: 'translateX(-50%)', width: '15%', height: '8%', background: 'rgba(0,0,0,0.15)', borderRadius: '0 0 3px 3px' }} />-- <div style={{ width: '65%', height: '5%', background: '#222', opacity: 0.8, borderRadius: '0 0 2px 2px' }} />-- <div style={{- width: '78%', height: '48%',- marginTop: '2%',- background: '#1a1a1c',- borderRadius: '2px',- boxShadow: 'inset 0 1px 3px rgba(0,0,0,0.9)',- position: 'relative',- overflow: 'hidden'- }}>- <div style={{- position: 'absolute', inset: '1px',- background: `- repeating-linear-gradient(0deg, transparent, transparent 2.5px, rgba(255,255,255,0.1) 2.5px, rgba(255,255,255,0.1) 3px),- repeating-linear-gradient(90deg, transparent, transparent 2.5px, rgba(255,255,255,0.1) 2.5px, rgba(255,255,255,0.1) 3px)- `,- }} />- </div>-- <div style={{- width: '32%', height: '32%',- marginTop: '2%',- background: 'linear-gradient(180deg, #c1c3c9 0%, #aab0b8 100%)',- border: '0.5px solid rgba(0,0,0,0.15)',- borderRadius: '1.5px',- }} />- </div>-- </div>- );- })()}- </div>- ) : (- (() => {- const cssRot = CSS_PHONE_PREVIEW_ROTATIONS[config.id] ?? CSS_PHONE_PREVIEW_ROTATIONS["front"]!;- const previewRx = cssRot.rx;- const previewRy = cssRot.ry;-- return (- <div style={{ perspective: `${Math.round((config.perspective || 600) * 0.55)}px`, perspectiveOrigin: 'center center' }}>- <div style={{- transform: `rotateX(${previewRx}deg) rotateY(${previewRy}deg)`,- transformStyle: 'preserve-3d',- transition: 'transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94)',- width: 53, height: 106,- borderRadius: '9px',- background: '#1a1a1c',- border: '1px solid #3a3a3c',- boxShadow: '0 8px 24px rgba(0,0,0,0.7), inset 0 0 3px rgba(255,255,255,0.2)',- position: 'relative',- }}>- <div style={{- position: 'absolute', top: 2, left: 2, right: 2, bottom: 2,- borderRadius: '7px',- overflow: 'hidden',- backgroundColor: '#000',- ...(previewImageUrl- ? { backgroundImage: `url(${previewImageUrl})`, backgroundSize: 'cover', backgroundPosition: 'center' }- : { background: 'linear-gradient(150deg, #151520 0%, #0d0d15 100%)' }- ),- }}>- <div style={{ position: 'absolute', top: 0, left: '50%', transform: 'translateX(-50%)', width: 22, height: 5, borderBottomLeftRadius: '4px', borderBottomRightRadius: '4px', background: '#1a1a1c' }} />-- <div style={{ position: 'absolute', bottom: 2, left: '50%', transform: 'translateX(-50%)', width: 16, height: 1.5, borderRadius: '2px', background: 'rgba(255,255,255,0.4)' }} />- </div>- </div>- </div>- );- })()- )- ) : (- <div- style={{ perspective: `${config.perspective || 600}px`, perspectiveOrigin: 'center center' }}- className="w-full h-full flex items-center justify-center p-3"- >- <div- className="relative w-full h-full max-w-[92%] max-h-[92%] rounded-lg overflow-hidden border border-white/5 shadow-2xl"- style={{- transform: `rotateX(${config.rotateX}deg) rotateY(${config.rotateY}deg) rotateZ(${config.rotateZ}deg) scale(${config.scale}) translateY(${config.translateY}%)`,- transformStyle: 'preserve-3d',- transition: 'transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94)',- }}- >- {previewImageUrl && (- <img- src={previewImageUrl}- alt={config.label}- className="w-full h-full object-cover"- draggable={false}- />- )}- </div>- </div>- )}- </div>-- <div className="absolute inset-0 bg-linear-to-t from-black/80 via-black/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none z-20" />- <div className="absolute bottom-2 left-2 opacity-0 group-hover:opacity-100 transition-all duration-300 translate-y-1 group-hover:translate-y-0 pointer-events-none flex items-center gap-1.5 z-20">- {!isCustom && <Icon icon="mdi:eye-outline" width={12} className="text-white/70" aria-hidden="true" />}- <span className="text-[11px] font-medium text-white/90 tracking-wide">- {config.label}- </span>- </div>- </>- )}- {isSelected && (- <div className={`absolute top-2 right-2 z-30 size-5 rounded-full bg-gradient-primary flex items-center justify-center shadow-xl`} aria-hidden="true">- <Icon icon="mdi:check-bold" width={12} className="text-white" aria-hidden="true" />- </div>- )}+ <div className="absolute inset-0 flex items-center justify-center pointer-events-none">+ <div className="w-full h-px bg-white/5" />+ <div className="h-full w-px bg-white/5 absolute" />+ </div>+ <div+ className="absolute bg-white border border-white/40 rounded-full shadow-[0_0_20px_4px_rgba(255,255,255,0.12),0_4px_12px_rgba(0,0,0,0.6)] mix-blend-screen flex items-center justify-center pointer-events-auto transition-all duration-75 cursor-grab"+ style={{+ width: "14px",+ height: "14px",+ left: `${50 + (-customConfig.rotateY / 45) * 50}%`,+ top: `${50 + (customConfig.rotateX / 45) * 50}%`,+ transform: "translate(-50%, -50%) scale(1)",+ }}+ /></div>- </button>- );-- if (isCustom) {- return (- <Popover open={isCustomPopoverOpen} onOpenChange={setIsCustomPopoverOpen} key={config.id}>- <PopoverTrigger asChild>- {ButtonCard}- </PopoverTrigger>- <PopoverContent- align="start"- sideOffset={12}- className="w-64 bg-[#0A0A0A] border-white/10 shadow-2xl p-4 space-y-4 rounded-xl z-50"- >- <PopoverHeader className="mb-2">- <PopoverTitle className="text-xs font-semibold text-white/80 tracking-wide uppercase flex items-center gap-2">- <Icon icon="mdi:tune" width={14} className="text-[#00A3EE]" />- {t("photoPreview.custom.title")}- </PopoverTitle>- </PopoverHeader>-- <div className="space-y-4">- {!imagePhoneActive && (- <SliderControl- icon="mdi:cube-outline"- label={t("photoPreview.custom.perspective")}- value={customConfig.perspective || 600}- min={200}- max={1000}- step={50}- onChange={(value) => {- updateCustomConfig({ perspective: value });- }}- suffix="px"- />- )}-- <SliderControl- icon="mdi:resize"- label={t("photoPreview.custom.scale")}- value={Math.round(customConfig.scale * 100)}- min={50}- max={150}- step={5}- onChange={(value) => {- updateCustomConfig({ scale: value / 100 });- if (imagePhoneActive) setImagePhoneScale(value / 100);- }}- suffix="%"- />-- <div className="space-y-2">- <div className="flex items-center gap-1.5 text-[11px] text-white/50">- <Icon icon="mdi:rotate-3d-variant" width={12} />- <span>{t("photoPreview.custom.rotationXY")}</span>- </div>- <div- className="relative w-full aspect-square bg-white/3 rounded-lg border border-white/10 cursor-crosshair overflow-hidden hover:bg-white/4 transition-colors"- onClick={(e) => {- const rect = e.currentTarget.getBoundingClientRect();- const x = ((e.clientX - rect.left) / rect.width) * 2 - 1;- const y = ((e.clientY - rect.top) / rect.height) * 2 - 1;- const rY = Math.round(-x * 45);- const rX = Math.round(y * 45);- updateCustomConfig({ rotateY: rY, rotateX: rX });- if (imagePhoneActive) {- setImagePhoneRotX(rX);- setImagePhoneRotY(rY);- }- }}- >- <div className="absolute inset-0 flex items-center justify-center pointer-events-none">- <div className="w-full h-px bg-white/5" />- <div className="h-full w-px bg-white/5 absolute" />- </div>- <div- className="absolute bg-white border border-white/40 rounded-full shadow-[0_0_20px_4px_rgba(255,255,255,0.12),0_4px_12px_rgba(0,0,0,0.6)] mix-blend-screen flex items-center justify-center pointer-events-auto transition-all duration-75 cursor-grab"- style={{- width: "14px",- height: "14px",- left: `${50 + (-customConfig.rotateY / 45) * 50}%`,- top: `${50 + (customConfig.rotateX / 45) * 50}%`,- transform: "translate(-50%, -50%) scale(1)"- }}- />-- </div>- </div>-- <SliderControl- icon="mdi:axis-z-rotate-clockwise"- label={t("photoPreview.custom.rotationZ")}- value={customConfig.rotateZ}- min={-45}- max={45}- step={5}- onChange={(value) => {- updateCustomConfig({ rotateZ: value });- if (imagePhoneActive) setImagePhoneRotZ(value);- }}- suffix="°"- />-- <SliderControl- icon="mdi:arrow-up-down"- label={t("photoPreview.custom.vertical")}- value={customConfig.translateY}- min={-10}- max={100}- step={1}- onChange={(value) => {- updateCustomConfig({ translateY: value });- if (imagePhoneActive) setImagePhoneY(value);- }}- suffix="%"- />- </div>-- <button- onClick={() => {- const resetConfig: Preview3DConfig = {- id: "custom",- label: t("photoPreview.custom.label"),- rotateX: 0,- rotateY: 0,- rotateZ: 0,- translateY: 0,- scale: 0.9,- perspective: 600- };- setCustomConfig(resetConfig);- if (selectedPreviewId === "custom") onSelectPreview?.(resetConfig);- if (imagePhoneActive) {- const defaults = getDefaultRotation(imagePhoneDevice);- setImagePhoneRotX(defaults.rx);- setImagePhoneRotY(defaults.ry);- setImagePhoneRotZ(0);- setImagePhonePerspective(600);- setImagePhoneScale(0.9);- setImagePhoneY(0);- }- }}- className="w-full mt-4 px-3 py-2 rounded-lg bg-white/5 hover:bg-white/10 text-[11px] text-white/60 hover:text-white transition-all flex items-center justify-center gap-2 border border-white/5"- >- <Icon icon="mdi:restore" width={14} />- {t("photoPreview.custom.reset")}- </button>- </PopoverContent>- </Popover>- );- }+ </div>++ <SliderControl+ icon="mdi:axis-z-rotate-clockwise"+ label={t("photoPreview.custom.rotationZ")}+ value={customConfig.rotateZ}+ min={-45}+ max={45}+ step={5}+ onChange={(value) => {+ updateCustomConfig({ rotateZ: value });+ if (imagePhoneActive) setImagePhoneRotZ(value);+ }}+ suffix="°"+ />++ <SliderControl+ icon="mdi:arrow-up-down"+ label={t("photoPreview.custom.vertical")}+ value={customConfig.translateY}+ min={-10}+ max={100}+ step={1}+ onChange={(value) => {+ updateCustomConfig({ translateY: value });+ if (imagePhoneActive) setImagePhoneY(value);+ }}+ suffix="%"+ />+ </div>- return <div key={config.id} className="contents">{ButtonCard}</div>;- };+ <button+ onClick={() => {+ const resetConfig: Preview3DConfig = {+ id: "custom",+ label: t("photoPreview.custom.label"),+ rotateX: 0,+ rotateY: 0,+ rotateZ: 0,+ translateY: 0,+ scale: 1.2,+ perspective: 600,+ };+ setCustomConfig(resetConfig);+ if (selectedPreviewId === "custom") onSelectPreview?.(resetConfig);++ if (imagePhoneActive) {+ const defaults = getDefaultRotation(imagePhoneDevice);+ setImagePhoneRotX(defaults.rx);+ setImagePhoneRotY(defaults.ry);+ setImagePhoneRotZ(0);+ setImagePhonePerspective(600);+ setImagePhoneScale(1.2);+ setImagePhoneY(0);+ }+ }}+ className="w-full mt-4 px-3 py-2 rounded-lg bg-white/5 hover:bg-white/10 text-[11px] text-white/60 hover:text-white transition-all flex items-center justify-center gap-2 border border-white/5"+ >+ <Icon icon="mdi:restore" width={14} />+ {t("photoPreview.custom.reset")}+ </button>+ </PopoverContent>+ </Popover>+ );+ }return (- <div className={`flex flex-col bg-black border-t border-white/10 ${className}`}>- {/* 👇 Contenedor principal de ajustes: Scroll activado y barra oculta */}- <div className="h-13 shrink-0 border-t border-white/10 flex items-center justify-between px-5 bg-[#0D0D11] overflow-x-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden">-- {/* GRUPO IZQUIERDO (Añadido shrink-0 para que no se apachurre) */}- <div className="flex items-center gap-2 text-white/60 whitespace-nowrap shrink-0">- <Icon icon="mdi:tune-vertical" width={16} aria-hidden="true" />- <span className="hidden sm:flex text-xs font-semibold tracking-wide uppercase">- {t("photoPreview.settings")}- </span>-- {imageMaskConfig && onImageMaskConfigChange && (- <ImageMaskEditor- maskConfig={imageMaskConfig}- onMaskConfigChange={onImageMaskConfigChange}- canvasImageUrl={staticImageUrl ?? canvasImageUrl}- />- )}-- {onToggle3DBackground && (- <TooltipAction label={t("photoPreview.apply3D")}>- <Button- variant="outline"- size="sm"- onClick={() => onToggle3DBackground(!apply3DToBackground)}- className={`px-2.5 py-2 text-xs font-medium squircle-element transition-all ${apply3DToBackground- ? "bg-gradient-radial-primary text-cyan-500 border border-cyan-500/50!"- : "bg-white/5 text-white/50 border border-white/10 hover:bg-white/10"- }`}- aria-label={t("photoPreview.apply3D")}- aria-pressed={apply3DToBackground}- >- <Icon icon="mdi:layers" width={12} className="inline" aria-hidden="true" />- {t("photoPreview.mockup3D")}- </Button>- </TooltipAction>- )}-- <TooltipAction label={t("photoPreview.resetDefaults")}>- <Button- variant="outline"- size="sm"- className="text-xs"- onClick={() => {- const defaultCustom: Preview3DConfig = {- id: "custom",- label: t("photoPreview.custom.label"),- rotateX: 0,- rotateY: 0,- rotateZ: 0,- translateY: 0,- scale: 0.9,- perspective: 600- };- setCustomConfig(defaultCustom);-- if (imagePhoneActive) {- const defaults = getDefaultRotation(imagePhoneDevice);- setImagePhoneRotX(defaults.rx);- setImagePhoneRotY(defaults.ry);- setImagePhoneRotZ(0);- setImagePhonePerspective(600);- setImagePhoneScale(0.9);- setImagePhoneY(0);- }- onReset?.();- }}- >- <Icon icon="material-symbols:refresh-rounded" width={12} aria-hidden="true" />- {t("photoPreview.reset")}- </Button>- </TooltipAction>- </div>+ <div key={config.id} className="contents">+ {ButtonCard}+ </div>+ );+ };- {/* GRUPO DERECHO (Quité flex-wrap, puse whitespace-nowrap, ml-4 y shrink-0) */}- <div className="flex items-center justify-end gap-2 whitespace-nowrap shrink-0 ml-4">- {onOpenCropper && (- <TooltipAction label={t("cropper.tooltip")}>- <Button- variant="outline"- size="sm"- className="gap-1.5 px-3 py-1.5 text-xs bg-transparent border-white/10 hover:bg-white/5"- onClick={onOpenCropper}- aria-label={t("cropper.tooltip")}- >- <Icon icon="mdi:crop" width={14} aria-hidden="true" />- {t("cropper.button")}- </Button>- </TooltipAction>- )}+ const renderDevicePreviewCard = (preset: PhoneImagePreviewConfig | LaptopImagePreviewConfig) => {+ const isSelected = selectedPreviewId === preset.id;- {onAspectRatioChange && (- <AspectRatioSelect- value={aspectRatio}- onChange={onAspectRatioChange}- customDimensions={customAspectRatio}- onCustomDimensionsChange={onCustomAspectRatioChange}- />- )}- </div>+ return (+ <button+ key={preset.id}+ onClick={() => {+ setImagePhoneX(preset.x);+ setImagePhoneY(preset.y);+ setImagePhoneScale(preset.scale);+ setImagePhoneRotX(preset.rotateX);+ setImagePhoneRotY(preset.rotateY);+ setImagePhoneRotZ(preset.rotateZ);+ setImagePhonePresetId(preset.id);++ if ('imagePhoneOpening' in preset && setImagePhoneOpening) {+ setImagePhoneOpening(preset.imagePhoneOpening);+ }++ onSelectPreview?.({+ id: preset.id,+ label: preset.label,+ rotateX: preset.rotateX,+ rotateY: preset.rotateY,+ rotateZ: preset.rotateZ,+ translateY: preset.y,+ scale: preset.scale,+ });+ }}+ className={`group relative shrink-0 w-32 sm:w-62 aspect-video squircle-element p-px transition-all duration-300 outline-none ${isSelected ? "shadow-[0_0_20px_rgba(0,163,255,0.15)]" : "bg-white/10 hover:bg-white/20"+ }`}+ aria-label={preset.label}+ aria-pressed={isSelected}+ >+ <div className="relative w-full h-full rounded-[10px] overflow-hidden bg-black/90">+ {preset.imageUrl ? (+ <img+ src={preset.imageUrl}+ alt={preset.label}+ className="w-full h-full object-cover"+ draggable={false}+ />+ ) : (+ <div className="absolute inset-0 flex flex-col items-center justify-center gap-1.5 bg-white/3 border border-dashed border-white/10">+ <Icon icon="mdi:image-off-outline" width={16} className="text-white/30" aria-hidden="true" />+ <span className="text-[9px] text-white/30 px-2 text-center">{preset.label}</span></div>+ )}- <div className="flex gap-1 sm:gap-3 px-5 overflow-x-auto custom-scrollbar mask-r-from-90%">- {allPreviews.map(renderPreviewCard)}+ <div className="absolute inset-0 bg-linear-to-t from-black/80 via-black/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none z-20" />+ <div className="absolute bottom-2 left-2 opacity-0 group-hover:opacity-100 transition-all duration-300 translate-y-1 group-hover:translate-y-0 pointer-events-none flex items-center gap-1.5 z-20">+ <Icon icon="mdi:eye-outline" width={12} className="text-white/70" aria-hidden="true" />+ <span className="text-[11px] font-medium text-white/90 tracking-wide">{preset.label}</span>+ </div>++ {isSelected && (+ <div+ className="absolute top-2 right-2 z-30 size-5 rounded-full bg-gradient-primary flex items-center justify-center shadow-xl"+ aria-hidden="true"+ >+ <Icon icon="mdi:check-bold" width={12} className="text-white" aria-hidden="true" /></div>+ )}</div>+ </button>);+ };++ return (+ <div className={`flex flex-col bg-black border-t border-white/10 ${className}`}>+ <div className="h-13 shrink-0 border-t border-white/10 flex items-center justify-between px-5 bg-[#0D0D11] overflow-x-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden">+ <div className="flex items-center gap-2 text-white/60 whitespace-nowrap shrink-0">+ <Icon icon="mdi:tune-vertical" width={16} aria-hidden="true" />+ <span className="hidden sm:flex text-xs font-semibold tracking-wide uppercase">+ {t("photoPreview.settings")}+ </span>+ {imageMaskConfig && onImageMaskConfigChange && (+ <ImageMaskEditor+ maskConfig={imageMaskConfig}+ onMaskConfigChange={onImageMaskConfigChange}+ canvasImageUrl={staticImageUrl ?? canvasImageUrl}+ />+ )}++ {onToggle3DBackground && (+ <TooltipAction label={t("photoPreview.apply3D")}>+ <Button+ variant="outline"+ size="sm"+ onClick={() => onToggle3DBackground(!apply3DToBackground)}+ className={`px-2.5 py-2 text-xs font-medium squircle-element transition-all ${apply3DToBackground+ ? "bg-gradient-radial-primary text-cyan-500 border border-cyan-500/50!"+ : "bg-white/5 text-white/50 border border-white/10 hover:bg-white/10"+ }`}+ aria-label={t("photoPreview.apply3D")}+ aria-pressed={apply3DToBackground}+ >+ <Icon icon="mdi:layers" width={12} className="inline" aria-hidden="true" />+ {t("photoPreview.mockup3D")}+ </Button>+ </TooltipAction>+ )}++ <TooltipAction label={t("photoPreview.resetDefaults")}>+ <Button+ variant="outline"+ size="sm"+ className="text-xs"+ onClick={() => {+ const defaultCustom: Preview3DConfig = {+ id: "custom",+ label: t("photoPreview.custom.label"),+ rotateX: 0,+ rotateY: 0,+ rotateZ: 0,+ translateY: 0,+ scale: 0.9,+ perspective: 600,+ };+ setCustomConfig(defaultCustom);++ if (imagePhoneActive) {+ const defaults = getDefaultRotation(imagePhoneDevice);+ setImagePhoneRotX(defaults.rx);+ setImagePhoneRotY(defaults.ry);+ setImagePhoneRotZ(0);+ setImagePhonePerspective(600);+ setImagePhoneScale(0.9);+ setImagePhoneY(0);+ }+ onReset?.();+ }}+ >+ <Icon icon="material-symbols:refresh-rounded" width={12} aria-hidden="true" />+ {t("photoPreview.reset")}+ </Button>+ </TooltipAction>+ </div>++ <div className="flex items-center justify-end gap-2 whitespace-nowrap shrink-0 ml-4">+ {onOpenCropper && (+ <TooltipAction label={t("cropper.tooltip")}>+ <Button+ variant="outline"+ size="sm"+ className="gap-1.5 px-3 py-1.5 text-xs bg-transparent border-white/10 hover:bg-white/5"+ onClick={onOpenCropper}+ aria-label={t("cropper.tooltip")}+ >+ <Icon icon="mdi:crop" width={14} aria-hidden="true" />+ {t("cropper.button")}+ </Button>+ </TooltipAction>+ )}++ {onAspectRatioChange && (+ <AspectRatioSelect+ value={aspectRatio}+ onChange={onAspectRatioChange}+ customDimensions={customAspectRatio}+ onCustomDimensionsChange={onCustomAspectRatioChange}+ />+ )}+ </div>+ </div>++ <div className="flex gap-1 sm:gap-3 px-5 overflow-x-auto custom-scrollbar mask-r-from-90%">+ {imagePhoneActive ? (+ <>+ {renderPreviewCard(allPreviews[0])}+ {(imagePhoneDevice === "laptop" ? LAPTOP_IMAGE_PREVIEWS : getPhoneImagePreviews(imagePhoneDevice)).map(+ renderDevicePreviewCard+ )}+ </>+ ) : (+ allPreviews.map(renderPreviewCard)+ )}+ </div>+ </div>+ );}\ No newline at end of filediff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsxindex 20949ac..672c2f4 100644--- a/app/components/ui/editor/VideoCanvas.tsx+++ b/app/components/ui/editor/VideoCanvas.tsx@@ -251,6 +251,30 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioconst lastSetVideoUrlRef = useRef<string | null>(null);const preservedVideoStateRef = useRef<{ time: number; playing: boolean } | null>(null);const imagePhoneRescaleTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ /*const phonePresetLogTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ useEffect(() => {+ if (!imagePhoneActive) return;++ if (phonePresetLogTimerRef.current) clearTimeout(phonePresetLogTimerRef.current);+ phonePresetLogTimerRef.current = setTimeout(() => {+ console.log('[Mockup3D preset]', {+ id: 'CAMBIA_ESTE_ID',+ label: 'CAMBIA_ESTE_LABEL',+ imageUrl: null,+ x: Math.round(imagePhoneX),+ y: Math.round(imagePhoneY),+ imagePhoneOpening: Number(imagePhoneOpening.toFixed(2)),+ scale: Number(imagePhoneScale.toFixed(2)),+ rotateX: Number(imagePhoneRotX.toFixed(2)),+ rotateY: Number(imagePhoneRotY.toFixed(2)),+ rotateZ: Number(imagePhoneRotZ.toFixed(2)),+ });+ }, 150);++ return () => {+ if (phonePresetLogTimerRef.current) clearTimeout(phonePresetLogTimerRef.current);+ };+ }, [imagePhoneActive, imagePhoneDevice, imagePhoneX, imagePhoneY, imagePhoneScale, imagePhoneRotX, imagePhoneRotY, imagePhoneRotZ]);*/// Reset lastSetVideoUrlRef when mockupId changes to force src re-assignment on remountuseEffect(() => {@@ -2039,7 +2063,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiotransformStyle: mediaType === "image" && !apply3DToBackground ? 'preserve-3d' : undefined,}}>- <EditorHoverTooltip show={isVideoHovered && imagePhoneActive} />+ <EditorHoverTooltip show={isVideoHovered && !imagePhoneActive} /></div></div></div>@@ -2110,7 +2134,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiosetEditingTextId(null);}}/>-+{/* ── 3D phone overlay (video & image mode) ── */}{imagePhoneActive && (<div className="absolute inset-0 pointer-events-none" style={{ zIndex: 155, overflow: "visible" }}>@@ -2140,7 +2164,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiopointerEvents: "none",}}>- <EditorHoverTooltip show={isVideoHovered && imagePhoneActive} />+ <EditorHoverTooltip show={isVideoHovered} /></div></div>diff --git a/app/components/ui/editor/mockups-3d/DoubleIPhone3DViewer.tsx b/app/components/ui/editor/mockups-3d/DoubleIPhone3DViewer.tsxindex 9b958c1..47680a9 100644--- a/app/components/ui/editor/mockups-3d/DoubleIPhone3DViewer.tsx+++ b/app/components/ui/editor/mockups-3d/DoubleIPhone3DViewer.tsx@@ -348,7 +348,7 @@ function ModelScene({useEffect(() => {if (rootRef.current) {- rootRef.current.rotation.y = initialRotationZ * DEG;+ rootRef.current.rotation.z = initialRotationZ * DEG;invalidate();}}, [initialRotationZ, invalidate]);@@ -385,7 +385,7 @@ function ModelScene({<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} />- <group ref={rootRef} rotation={[0, initialRotationZ * DEG, 0]}>+ <group ref={rootRef} rotation={[0, 0, initialRotationZ * DEG]}><group ref={modelContainerRef} /></group></>diff --git a/app/components/ui/editor/mockups-3d/Phone3DViewer.tsx b/app/components/ui/editor/mockups-3d/Phone3DViewer.tsxindex 5f4f3e8..ebb4b5b 100644--- a/app/components/ui/editor/mockups-3d/Phone3DViewer.tsx+++ b/app/components/ui/editor/mockups-3d/Phone3DViewer.tsx@@ -121,6 +121,7 @@ function ModelScene({const orbitRef = useRef<OrbitControlsType | null>(null);const screenMatRef = useRef<THREE.MeshBasicMaterial | null>(null);const videoTextureRef = useRef<THREE.VideoTexture | null>(null);+const [modelGroup, setModelGroup] = useState<THREE.Group | null>(null);const lastLoadedUrlRef = useRef<string | null>(null);const lastLoadedCropKeyRef = useRef<string | null>(null);@@ -146,7 +147,6 @@ function ModelScene({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));@@ -157,14 +157,12 @@ function ModelScene({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;@@ -188,11 +186,9 @@ function ModelScene({if (!mat) return;const cropKey = cropArea ? JSON.stringify(cropArea) : null;-if (!imageUrl) {const placeholderKey = `__placeholder__:${PLACEHOLDER_PHONE_URL}`;if (lastLoadedUrlRef.current === placeholderKey) return;-const device = getDeviceFromModelUrl(modelUrl);const deviceConfig = deviceConfigs[device];const isDefaultPhone = device === "phone";@@ -216,7 +212,6 @@ function ModelScene({}const cover = createCoverScreenCanvas(img, TARGET_W, TARGET_H, cornerRadius, null);-if (currentMat.map) {currentMat.map.dispose();currentMat.map = null;@@ -337,7 +332,6 @@ function ModelScene({const applyVideoTextureIfReady = useCallback(() => {const mat = screenMatRef.current;const tex = videoTextureRef.current;-if (mat && tex) {if (mat.map && mat.map !== tex) {mat.map.dispose();@@ -346,7 +340,6 @@ function ModelScene({const isDefaultPhone = device === "phone";tex.flipY = !isDefaultPhone;tex.needsUpdate = true;-mat.map = tex;mat.color.set(0xffffff);mat.needsUpdate = true;@@ -362,7 +355,6 @@ function ModelScene({}return;}-const device = getDeviceFromModelUrl(modelUrl);const isDefaultPhone = device === "phone";@@ -379,7 +371,6 @@ function ModelScene({videoTextureRef.current.dispose();}videoTextureRef.current = tex;-applyVideoTextureIfReady();return () => {@@ -391,7 +382,6 @@ function ModelScene({}, [videoElement, modelUrl, applyVideoTextureIfReady]);const applyTextureRef = useRef(applyTexture);-useEffect(() => {applyTextureRef.current = applyTexture;}, [applyTexture]);@@ -421,14 +411,14 @@ function ModelScene({loadGltfGroup().then((cached) => {const group = cloneGroup(cached);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.8) / size.y;-++ // Se reduce ligeramente el factor (de 0.8 a 0.72) para dar mayor margen a la diagonal del teléfono al girar+ const sf = (halfH * 2 * 0.72) / size.y;+group.scale.setScalar(sf);group.position.copy(center).negate().multiplyScalar(sf);@@ -436,14 +426,11 @@ function ModelScene({if (!(child instanceof THREE.Mesh)) return;const mat = Array.isArray(child.material) ? child.material[0] : child.material;const matName = (mat as THREE.Material)?.name ?? "";-const isScreen = matName === "Screen.editable" || child.name === "Screen";-if (isScreen) {const meshBox = new THREE.Box3().setFromObject(child);const meshSize = meshBox.getSize(new THREE.Vector3());if (meshSize.x > 0 && meshSize.y > 0) screenAspectRef.current = meshSize.x / meshSize.y;-const basicMat = new THREE.MeshBasicMaterial({color: 0x111111,side: THREE.FrontSide,@@ -451,7 +438,6 @@ function ModelScene({depthTest: false,depthWrite: false,});-child.material = basicMat;child.renderOrder = 10;screenMatRef.current = basicMat;@@ -460,7 +446,6 @@ function ModelScene({applyMetalMaterial(mat, matName);}});-finalizeSetup(group);});} else {@@ -468,11 +453,9 @@ function ModelScene({loadSpecificGltf(modelUrl!).then((loadedScene) => {const group = loadedScene.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.6) / size.y;@@ -491,7 +474,6 @@ function ModelScene({depthTest: false,depthWrite: false,});-screenMatRef.current = basicMat;applyVideoTextureIfReady();@@ -514,14 +496,12 @@ function ModelScene({const plane = new THREE.Mesh(new THREE.ShapeGeometry(shape), basicMat);const uvAttr = plane.geometry.getAttribute("uv") as THREE.BufferAttribute;-for (let i = 0; i < uvAttr.count; i++) {const x = plane.geometry.getAttribute("position").getX(i);const y = plane.geometry.getAttribute("position").getY(i);uvAttr.setXY(i, (x + hw) / planeW, (y + hh) / planeH);}uvAttr.needsUpdate = true;-plane.position.set(deviceConfig.screenOffset.x,deviceConfig.screenOffset.y,@@ -533,7 +513,6 @@ function ModelScene({finalizeSetup(group);});}-return () => {isMounted = false;};@@ -548,24 +527,23 @@ function ModelScene({) {return;}-const id = setTimeout(() => {const orbit = orbitRef.current;if (!orbit) return;-- const radius = 1.5 / zoom;++ // Mantenemos la cámara siempre a una distancia física de 1.5 para evitar colisionar con el Near-Plane.+ // El zoom es manejado de manera óptica (PerspectiveCamera zoom prop)+ 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]);+ }, [initialRotationX, initialRotationY, invalidate]);useEffect(() => {if (rootRef.current) {@@ -576,14 +554,9 @@ function ModelScene({return (<>- <PerspectiveCamera- ref={cameraRef}- makeDefault- fov={40}- near={0.01}- far={100}- position={[0, 0, 1.5 / zoom]}- />+ {/* Pasamos zoom={zoom} y bloqueamos pos Z en 1.5 en lugar de (1.5 / zoom) para no golpear el recorte Near de la cámara */}+ <PerspectiveCamera ref={cameraRef} makeDefault fov={40} near={0.01} far={100} position={[0, 0, 1.5]} zoom={zoom} />+<OrbitControlsref={orbitRef}enableZoom={false}@@ -605,6 +578,7 @@ function ModelScene({<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} />+<group ref={rootRef} rotation={[0, 0, initialRotationZ * DEG]}>{modelGroup && <primitive object={modelGroup} />}</group>@@ -667,11 +641,10 @@ export function Phone3DViewer(props: Props) {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 shadowRgba = shadowColor.startsWith("#") ? parseShadowColor(shadowColor, computedOpacity) : shadowColor;const hasShadow = t > 0.01;return (@@ -704,10 +677,16 @@ export function Phone3DViewer(props: Props) {}}/>)}++ {/* El canvas ahora fuerza una proporción cuadradra 1:1 de un tamaño generoso para evitar recortes del Frustum Horizontal */}<divstyle={{position: "absolute",- inset: "-400px",+ top: "50%",+ left: "50%",+ width: "1400px",+ height: "1400px",+ transform: "translate(-50%, -50%)",zIndex: 2,overflow: "visible",cursor: grabbing ? "grabbing" : "grab",diff --git a/app/components/ui/home/SocialReactions.tsx b/app/components/ui/home/SocialReactions.tsxindex a5c4bd6..939f6dd 100644--- a/app/components/ui/home/SocialReactions.tsx+++ b/app/components/ui/home/SocialReactions.tsx@@ -175,7 +175,7 @@ const getSocialData = (t: (key: string) => string): SocialPost[] => [},];-const CARD_HEIGHT = "h-[700px]";+const CARD_HEIGHT = "h-[500px] sm:h-[700px]";const DraggableCarousel = memo(({ children }: { children: React.ReactNode }) => {const scrollRef = useRef<HTMLDivElement>(null);@@ -278,7 +278,7 @@ const CustomSocialCard = memo(({ data }: { data: SocialPost }) => {{data.platform === "facebook" && <Icon icon="ic:baseline-facebook" className="h-6 w-6" />}</div></div>- <div className="mb-3 text-[15px] leading-normal whitespace-pre-wrap">+ <div className="mb-3 text-[15px] leading-normal whitespace-pre-wrap line-clamp-5 sm:line-clamp-none">{data.content.text}{data.content.link && (<>@@ -294,6 +294,7 @@ const CustomSocialCard = memo(({ data }: { data: SocialPost }) => {</>)}</div>+{data.content.mediaUrl && (<divonClick={handleRedirect}diff --git a/components/ui/CanvasContextMenu.tsx b/components/ui/CanvasContextMenu.tsxindex a11deb0..bb1efc4 100644--- a/components/ui/CanvasContextMenu.tsx+++ b/components/ui/CanvasContextMenu.tsx@@ -1,5 +1,5 @@import { Icon } from "@iconify/react";-import { useTranslations } from "next-intl";+import { useTranslations } from "next-intl";interface CanvasElement {id: string;@@ -30,7 +30,7 @@ export function CanvasContextMenu({setCanvasCtxMenu,setCanvasSelectedIds,}: CanvasContextMenuProps) {- const t = useTranslations("canvasMenu");+ const t = useTranslations("elementsMenu");if (!canvasCtxMenu) return null;@@ -59,9 +59,9 @@ export function CanvasContextMenu({}}><Icon icon="qlementine-icons:bring-to-front-16" className="size-3.5 shrink-0 opacity-70" />- {t("bringToFront")}+ {t("actions.bringToFront")}</button>-+<buttonclassName="w-full flex items-center gap-2.5 px-3 py-1.5 text-[11.5px] text-neutral-300 hover:bg-white/6 transition-colors text-left"onClick={() => {@@ -77,9 +77,9 @@ export function CanvasContextMenu({}}><Icon icon="qlementine-icons:bring-to-back-16" className="size-3.5 shrink-0 opacity-70" />- {t("sendToBack")}+ {t("actions.sendToBack")}</button>-+<div className="my-1 h-px bg-white/6" /></>)}@@ -99,7 +99,7 @@ export function CanvasContextMenu({<Icon icon="solar:layers-minimalistic-bold" className="size-3.5 shrink-0 opacity-70" />{t("group", { count: ids.length })}</button>-+<buttonclassName="w-full flex items-center gap-2.5 px-3 py-1.5 text-[11.5px] text-neutral-300 hover:bg-white/6 transition-colors text-left"onClick={() => {@@ -117,7 +117,7 @@ export function CanvasContextMenu({<Icon icon="solar:layers-bold" className="size-3.5 shrink-0 opacity-70" />{t("ungroup")}</button>-+<div className="my-1 h-px bg-white/6" /></>)}@@ -131,7 +131,7 @@ export function CanvasContextMenu({}}><Icon icon="solar:trash-bin-trash-bold" className="size-3.5 shrink-0 opacity-70" />- {isMulti ? t("deleteMultiple", { count: ids.length }) : t("deleteSingle")}+ {isMulti ? t("actions.deleteMultiple", { count: ids.length }) : t("actions.delete")}</button></div>);