Create professional demos and 3D mockups in seconds, directly in your browser
feat: enhance PhotoEditorPlaceholder and VideoCanvas with improved styling and functionality
CristianOlivera1b954986acb47
diff --git a/app/components/ui/editor/ImageMaskEditor.tsx b/app/components/ui/editor/ImageMaskEditor.tsxindex 1b6c174..5c25136 100644--- a/app/components/ui/editor/ImageMaskEditor.tsx+++ b/app/components/ui/editor/ImageMaskEditor.tsx@@ -15,7 +15,7 @@ import type { ImageMaskConfig } from "@/types/photo.types";import { ImageMaskEditorProps, MaskPreset, MASK_PRESETS } from "@/types/ImageMask.types";import { TooltipAction } from "@/components/ui/tooltip-action";import { useTranslations } from "next-intl";-import { GetMediaMaskStyles } from "./GetMediaMaskStyles";+import { GetMediaMaskStyles } from "@/lib/media-mask.utils";export function ImageMaskEditor({maskConfig,@@ -142,23 +142,22 @@ export function ImageMaskEditor({<buttonkey={preset.id}onClick={() => handlePresetClick(preset)}- className={`group relative flex flex-col rounded-lg border transition-all overflow-hidden ${active+ className={`group relative flex flex-col squircle-element border transition-all overflow-hidden ${active? "border-blue-500 bg-blue-500/10": "border-white/10 hover:border-white/30 bg-white/5 hover:bg-white/10"}`}><div className="relative w-full aspect-video bg-zinc-900">- {canvasImageUrl ? (- <div className="absolute inset-0 flex items-center justify-center p-1">- <img- src={canvasImageUrl}- alt={t(`presets.${preset.id}`)}- className="w-full h-full object-cover"- style={previewStyles}- />- </div>- ) : (- <div className="absolute inset-0 flex items-center justify-center">+ <div className="absolute inset-0 flex items-center justify-center p-3 bg-zinc-950 overflow-hidden">+ <div className="absolute top-0 inset-x-0 h-40 bg-[radial-gradient(ellipse_at_top,rgba(255,255,255,0.05)_0%,transparent_75%)] pointer-events-none" />+ <div+ className="w-full h-full squircle-element bg-[#EAEAEA]"+ style={previewStyles}+ />+ </div>++ {!canvasImageUrl && (+ <div className="absolute inset-0 flex items-center justify-center pointer-events-none"><Iconicon={preset.icon}width="28"@@ -167,9 +166,8 @@ export function ImageMaskEditor({</div>)}- <div className="absolute inset-x-0 bottom-0 h-full flex items-end p-2 pointer-events-none">- <span className={`text-[10px] font-bold text-shadow-lg transition-colors leading-tight ${active ? "text-blue-400" : "text-white/90"}`}>- {/* Aquí traducimos el nombre del preset usando su ID */}+ <div className="absolute bottom-1.5 left-1.5 z-10 bg-black/70 backdrop-blur-md px-1.5 py-0.5 rounded border border-white/5 pointer-events-none max-w-[85%]">+ <span className={`text-[10px] font-medium tracking-wide block truncate transition-colors ${active ? "text-blue-400" : "text-white/85"}`}>{t(`presets.${preset.id}`)}</span></div>@@ -186,7 +184,6 @@ export function ImageMaskEditor({</div>) : (<div className="space-y-4">- {/* Controles de TOP */}<div className="space-y-2"><div className="flex items-center justify-between"><label className="text-xs font-medium text-white/70">{t("controls.top")}</label>@@ -232,7 +229,6 @@ export function ImageMaskEditor({<div className="space-y-2"><hr className="border-white/10" />- {/* Controles de BOTTOM */}<div className="flex items-center justify-between"><label className="text-xs font-medium text-white/70">{t("controls.bottom")}</label><button@@ -276,7 +272,6 @@ export function ImageMaskEditor({</div><hr className="border-white/10" /><div className="grid grid-cols-2 gap-4">- {/* Controles de LEFT */}<div className="space-y-2"><div className="flex items-center justify-between"><label className="text-xs font-medium text-white/70">{t("controls.left")}</label>@@ -306,7 +301,6 @@ export function ImageMaskEditor({)}</div>- {/* Controles de RIGHT */}<div className="space-y-2"><div className="flex items-center justify-between"><label className="text-xs font-medium text-white/70">{t("controls.right")}</label>diff --git a/app/components/ui/editor/LayersPanel.tsx b/app/components/ui/editor/LayersPanel.tsxindex 866b485..c750396 100644--- a/app/components/ui/editor/LayersPanel.tsx+++ b/app/components/ui/editor/LayersPanel.tsx@@ -9,6 +9,7 @@ import { buildLayerNames, buildGroupNumbers } from "@/lib/layers.utils";import ContextMenu from "./ContextMenu";import { useTranslations } from "next-intl";import { TooltipAction } from "@/components/ui/tooltip-action";+const VIDEO_SENTINEL = "__video__";export function LayersPanel({elements,@@ -39,7 +40,10 @@ export function LayersPanel({const selectedIdsRef = useRef<string[]>([]);selectedIdsRef.current = selectedIds;const [ctxMenu, setCtxMenu] = useState<CtxMenuState | null>(null);+ const [videoCtxMenu, setVideoCtxMenu] = useState<{ x: number; y: number } | null>(null);+ const tActions = useTranslations("elementsMenu");const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(new Set());+ const [groupCtxMenu, setGroupCtxMenu] = useState<{ x: number; y: number; groupId: string } | null>(null);const [pointerDrag, setPointerDrag] = useState<PointerDragState | null>(null);const pointerDragRef = useRef<PointerDragState | null>(null);@@ -51,21 +55,26 @@ export function LayersPanel({const ignoreSyncUntilRef = useRef<number>(0);const syncKey = elements.map((e) => e.id + ":" + e.zIndex + ":" + (e.groupId ?? "")).join(",");+ const insertVideoSentinel = useCallback((ids: string[]): string[] => {+ if (!videoLayerVisible) return ids;+ const zIndexOf = (id: string) => elements.find((e) => e.id === id)?.zIndex ?? 0;+ const idx = ids.findIndex((id) => zIndexOf(id) < 1000);+ return idx === -1+ ? [...ids, VIDEO_SENTINEL]+ : [...ids.slice(0, idx), VIDEO_SENTINEL, ...ids.slice(idx)];+ }, [elements, videoLayerVisible]);const [displayOrder, setDisplayOrder] = useState<string[]>(() =>- [...elements].sort((a, b) => b.zIndex - a.zIndex).map((e) => e.id)+ insertVideoSentinel([...elements].sort((a, b) => b.zIndex - a.zIndex).map((e) => e.id)));useEffect(() => {if (isDraggingRef.current) return;if (Date.now() < ignoreSyncUntilRef.current) return;-- const sortedIncoming = [...elements]- .sort((a, b) => b.zIndex - a.zIndex)- .map((e) => e.id);- setDisplayOrder(sortedIncoming);+ const sortedIncoming = [...elements].sort((a, b) => b.zIndex - a.zIndex).map((e) => e.id);+ setDisplayOrder(insertVideoSentinel(sortedIncoming));// eslint-disable-next-line react-hooks/exhaustive-deps- }, [syncKey]);+ }, [syncKey, videoLayerVisible]);useEffect(() => {if (selectedId) {@@ -84,15 +93,17 @@ export function LayersPanel({}, [multiIdsKey]);useEffect(() => {- if (!ctxMenu) return;+ if (!ctxMenu && !videoCtxMenu && !groupCtxMenu) return;const close = (e: PointerEvent) => {if ((e.target as HTMLElement).closest("[data-ctx-menu]")) return;setCtxMenu(null);+ setVideoCtxMenu(null);+ setGroupCtxMenu(null);};window.addEventListener("pointerdown", close);return () => window.removeEventListener("pointerdown", close);// eslint-disable-next-line react-hooks/exhaustive-deps- }, [!!ctxMenu]);+ }, [!!ctxMenu, !!videoCtxMenu, !!groupCtxMenu]);useEffect(() => {const handleKeyDown = (e: KeyboardEvent) => {@@ -159,22 +170,18 @@ export function LayersPanel({const renderedGroupIds = new Set<string>();const rows: VisualRow[] = [];- let videoInserted = false;-for (const id of displayOrder) {- const el = elementsById[id];- if (!el) continue;-- if (!videoInserted && videoLayerVisible && el.zIndex < 1000) {+ if (id === VIDEO_SENTINEL) {rows.push({ kind: "video" });- videoInserted = true;+ continue;}+ const el = elementsById[id];+ if (!el) continue;if (el.groupId) {if (!renderedGroupIds.has(el.groupId)) {renderedGroupIds.add(el.groupId);rows.push({ kind: "group", groupId: el.groupId });-if (!collapsedGroups.has(el.groupId)) {const members = displayOrder.map((mid) => elementsById[mid])@@ -186,13 +193,8 @@ export function LayersPanel({rows.push({ kind: "element", id: el.id });}}-- if (!videoInserted && videoLayerVisible) {- rows.push({ kind: "video" });- }-return rows;- }, [displayOrder, elementsById, collapsedGroups, videoLayerVisible]);+ }, [displayOrder, elementsById, collapsedGroups]);useEffect(() => {if (!pointerDrag) return;@@ -211,15 +213,13 @@ export function LayersPanel({const INTO_ZONE = 0.30;visualRows.forEach((row, i) => {- if (row.kind === "video") return;-- const key = row.kind === "element" ? row.id : `group:${row.groupId}`;+ const key = row.kind === "element" ? row.id : row.kind === "group" ? `group:${row.groupId}` : VIDEO_SENTINEL;if (key === drag.id) return;const el = rowRefs.current.get(key);if (!el) return;const rect = el.getBoundingClientRect();- if (row.kind === "group" && !drag.isGroup) {+ if (row.kind === "group" && !drag.isGroup && drag.id !== VIDEO_SENTINEL) {const midTop = rect.top + rect.height * INTO_ZONE;const midBot = rect.bottom - rect.height * INTO_ZONE;if (e.clientY >= midTop && e.clientY <= midBot) {@@ -249,7 +249,7 @@ export function LayersPanel({}});- if (!drag.isGroup && !intoGroupId && dropIdx > 0 && dropIdx < visualRows.length) {+ if (!drag.isGroup && !intoGroupId && drag.id !== VIDEO_SENTINEL && dropIdx > 0 && dropIdx < visualRows.length) {const prevRow = visualRows[dropIdx - 1];const nextRow = visualRows[dropIdx];@@ -307,7 +307,7 @@ export function LayersPanel({}const movingSet = new Set(movingIds);- if (dropTargetGroupId && !isGroup && onSetGroupId) {+ if (dropTargetGroupId && !isGroup && id !== VIDEO_SENTINEL && onSetGroupId) {const dragged = elementsById[id];if (dragged && dragged.groupId !== dropTargetGroupId) {ignoreSyncUntilRef.current = Date.now() + 1000;@@ -317,7 +317,7 @@ export function LayersPanel({}let pendingGroupChange: { id: string; groupId: string | undefined } | null = null;- if (!isGroup && onSetGroupId) {+ if (!isGroup && id !== VIDEO_SENTINEL && onSetGroupId) {const dragged = elementsById[id];if (dragged?.groupId) {const anchorVRow = visualRows[dropIndex];@@ -332,7 +332,8 @@ export function LayersPanel({}const isRowDragged = (r: VisualRow) => {- if (r.kind === "video") return false;+ if (r.kind === "video") return movingSet.has(VIDEO_SENTINEL);+if (r.kind === "element") return movingSet.has(r.id);if (r.kind === "group") {const firstMember = displayOrder.find(@@ -374,7 +375,15 @@ export function LayersPanel({if (changed) {ignoreSyncUntilRef.current = Math.max(ignoreSyncUntilRef.current, Date.now() + 1500);setDisplayOrder(next);- onReorder(next);+ const videoIdx = next.indexOf(VIDEO_SENTINEL);+ if (videoIdx === -1) {+ onReorder(next, []);+ } else {+ onReorder(+ next.slice(0, videoIdx).filter((x) => x !== VIDEO_SENTINEL),+ next.slice(videoIdx + 1).filter((x) => x !== VIDEO_SENTINEL)+ );+ }}},[displayOrder, elementsById, visualRows, onReorder, onSetGroupId]@@ -384,7 +393,7 @@ export function LayersPanel({(e: React.MouseEvent, id: string, isGroup: boolean) => {if (e.button !== 0) return;const vIdx = visualRows.findIndex((r) => {- if (r.kind === "video") return false;+ if (r.kind === "video") return id === VIDEO_SENTINEL;if (r.kind === "element") return r.id === id;if (r.kind === "group") return `group:${r.groupId}` === id;return false;@@ -441,10 +450,19 @@ export function LayersPanel({if (node) rowRefs.current.set("video-layer", node);else rowRefs.current.delete("video-layer");}}+ onMouseDown={(e) => {+ if ((e.target as HTMLElement).closest("button")) return;+ startPointerDrag(e, VIDEO_SENTINEL, false);+ }}onClick={() => {if (pointerDragRef.current?.active) return;onVideoLayerSelect?.();}}+ onContextMenu={(e) => {+ e.preventDefault();+ onVideoLayerSelect?.();+ setVideoCtxMenu({ x: e.clientX, y: e.clientY });+ }}data-layer-row="video-layer"className={["group relative flex items-center gap-1.5 h-7 px-2 rounded-md cursor-pointer select-none transition-all duration-100",@@ -458,8 +476,8 @@ export function LayersPanel({)}<div className="shrink-0 w-3 opacity-0" /><Icon- icon={TYPE_ICON.video}- className={`size-3.5 shrink-0 ${isSelected ? "text-[#00A3FF]" : "text-neutral-500"}`}+ icon={mediaType === "video" ? TYPE_ICON.video : TYPE_ICON.image}+ className={`size-4.5 shrink-0 ${isSelected ? "text-[#00A3FF]" : "text-neutral-500"}`}aria-hidden="true"/><span className="flex-1 text-[11px] truncate">@@ -532,11 +550,11 @@ export function LayersPanel({className={`shrink-0 cursor-grab active:cursor-grabbing transition-opacity opacity-0 group-hover:opacity-100 ${isLocked ? "invisible" : ""}`}>- <Icon icon="icon-park-outline:drag" className="size-3 text-neutral-500" />+ <Icon icon="icon-park-outline:drag" className="size-4 text-neutral-500" /></div><Iconicon={TYPE_ICON[el.type]}- className={`size-3.5 shrink-0 ${isSelected ? "text-[#00A3FF]" : "text-neutral-500"}`}+ className={`size-4.5 shrink-0 ${isSelected ? "text-[#00A3FF]" : "text-neutral-500"}`}/><spanclassName={`flex-1 text-[11px] truncate ${isVisible ? "" : "opacity-40 line-through"@@ -556,7 +574,7 @@ export function LayersPanel({><Iconicon={isVisible ? "solar:eye-bold" : "solar:eye-closed-bold"}- className="size-3"+ className="size-4"aria-hidden="true"/></button>@@ -573,7 +591,7 @@ export function LayersPanel({><Iconicon={isLocked ? "gravity-ui:lock-fill" : "icon-park-solid:unlock"}- className="size-3"+ className="size-4"aria-hidden="true"/></button>@@ -589,21 +607,21 @@ export function LayersPanel({className="flex items-center justify-center w-5 h-5 rounded hover:bg-red-500/20"aria-label={t("layerPanel.tooltips.delete")}>- <Icon icon="solar:trash-bin-trash-bold" className="size-3 hover:text-red-400" aria-hidden="true" />+ <Icon icon="ic:baseline-delete" className="size-4 hover:text-red-400" aria-hidden="true" /></button></TooltipAction></div>{!isVisible && (<Iconicon="solar:eye-closed-bold"- className="size-3 text-neutral-500 shrink-0 group-hover:hidden"+ className="size-4 text-neutral-500 shrink-0 group-hover:hidden"aria-hidden="true"/>)}{isLocked && (<Iconicon="solar:lock-bold"- className="size-3 text-neutral-500 shrink-0 group-hover:hidden"+ className="size-4 text-neutral-500 shrink-0 group-hover:hidden"aria-hidden="true"/>)}@@ -634,7 +652,7 @@ export function LayersPanel({onClick={() => setIsOpen(true)}className="flex items-center justify-center w-6 h-6 rounded hover:bg-white/10 transition-colors text-neutral-500 hover:text-neutral-200">- <Icon icon="solar:layers-minimalistic-bold" className="size-3.5" />+ <Icon icon="solar:layers-minimalistic-bold" className="size-4.5" /></button></TooltipAction><span className="text-[9px] text-neutral-500 [writing-mode:vertical-rl] rotate-180 mt-1 tracking-widest uppercase">@@ -659,7 +677,7 @@ export function LayersPanel({onClick={() => setIsOpen(false)}className="flex items-center justify-center w-5 h-5 rounded hover:bg-white/10 transition-colors text-neutral-500 hover:text-neutral-200">- <Icon icon="solar:sidebar-minimalistic-bold" className="size-3.5" />+ <Icon icon="solar:sidebar-minimalistic-bold" className="size-4.5" /></button></TooltipAction></div>@@ -684,16 +702,14 @@ export function LayersPanel({const rows: React.ReactNode[] = [];let groupCounter = 0;let vIdx = 0;- let videoInserted = false;for (const id of displayOrder) {- const el = elementsById[id];- if (!el) continue;-- if (!videoInserted && videoLayerVisible && el.zIndex >= 1000) {+ if (id === VIDEO_SENTINEL) {rows.push(renderVideoRow(vIdx++));- videoInserted = true;+ continue;}+ const el = elementsById[id];+ if (!el) continue;if (el.groupId) {if (renderedGroupIds.has(el.groupId)) {@@ -731,6 +747,15 @@ export function LayersPanel({onMultiSelect?.(memberIds);if (memberIds.length > 0) onSelect(memberIds[0]);}}+ onContextMenu={(e) => {+ e.preventDefault();+ e.stopPropagation();+ const memberIds = groupMembers.map((m) => m.id);+ setSelectedIds(memberIds);+ onMultiSelect?.(memberIds);+ if (memberIds.length > 0) onSelect(memberIds[0]);+ setGroupCtxMenu({ x: e.clientX, y: e.clientY, groupId: gid });+ }}data-layer-row={groupKey}className={["group relative flex items-center gap-1.5 h-7 px-2 rounded-md cursor-pointer select-none transition-all duration-100 text-neutral-400 hover:bg-white/5 hover:text-neutral-200",@@ -744,7 +769,7 @@ export function LayersPanel({<div className="absolute -top-px left-0 right-0 h-0.5 rounded-full bg-blue-400 pointer-events-none z-10" />)}<div className="shrink-0 cursor-grab active:cursor-grabbing transition-opacity opacity-0 group-hover:opacity-100">- <Icon icon="icon-park-outline:drag" className="size-3 text-neutral-500" />+ <Icon icon="icon-park-outline:drag" className="size-4 text-neutral-500" /></div><buttononClick={(e) => {@@ -760,10 +785,10 @@ export function LayersPanel({><Iconicon={isCollapsed ? "solar:alt-arrow-right-bold" : "solar:alt-arrow-down-bold"}- className="size-3 text-neutral-500"+ className="size-4 text-neutral-500"/></button>- <Icon icon="solar:folder-bold" className="size-3.5 shrink-0 text-yellow-500/70" />+ <Icon icon="solar:folder-bold" className="size-4.5 shrink-0 text-yellow-500/70" /><span className="flex-1 text-[11px] truncate">{t("layerPanel.group")} {thisGroupNum}</span>@@ -777,7 +802,7 @@ export function LayersPanel({}}className="flex items-center justify-center w-5 h-5 rounded hover:bg-red-500/20">- <Icon icon="solar:trash-bin-trash-bold" className="size-3 hover:text-red-400" />+ <Icon icon="solar:trash-bin-trash-bold" className="size-4 hover:text-red-400" /></button></TooltipAction></div>@@ -799,10 +824,6 @@ export function LayersPanel({}}- if (!videoInserted && videoLayerVisible) {- rows.push(renderVideoRow(vIdx++));- }-if (pointerDrag?.active && pointerDrag.dropIndex === visualRows.length) {rows.push(<div key="drop-indicator-bottom" className="relative">@@ -826,7 +847,7 @@ export function LayersPanel({onClick={() => onGroup(selectedIds)}className="flex items-center gap-1 px-1.5 py-0.5 text-[10px] text-neutral-400 hover:text-white hover:bg-white/10 rounded transition-colors">- <Icon icon="solar:layers-minimalistic-bold" className="size-3" /> {t("layerPanel.groupAction")}+ <Icon icon="solar:layers-minimalistic-bold" className="size-4" /> {t("layerPanel.groupAction")}</button></TooltipAction>)}@@ -836,13 +857,80 @@ export function LayersPanel({onClick={() => onUngroup(selectedIds)}className="flex items-center gap-1 px-1.5 py-0.5 text-[10px] text-neutral-400 hover:text-white hover:bg-white/10 rounded transition-colors">- <Icon icon="solar:layers-bold" className="size-3" /> {t("layerPanel.ungroupAction")}+ <Icon icon="solar:layers-bold" className="size-4" /> {t("layerPanel.ungroupAction")}</button></TooltipAction>)}</div>)}+ {videoCtxMenu && (+ <div+ data-ctx-menu+ className="fixed z-[9999] bg-[#1c1c1f] border border-white/10 rounded-lg shadow-2xl py-1 min-w-40 overflow-hidden"+ style={{ left: videoCtxMenu.x, top: videoCtxMenu.y }}+ onPointerDown={(e) => e.stopPropagation()}+ >+ <button+ className="w-full flex items-center gap-2 px-3 py-1.5 text-[11px] text-neutral-300 hover:bg-white/6 text-left"+ onClick={() => {+ onReorder([], elements.map((e) => e.id));+ setVideoCtxMenu(null);+ }}+ >+ <Icon icon="qlementine-icons:bring-to-front-16" className="size-4.5 opacity-70" />+ {tActions("actions.bringToFront")}+ </button>+ <button+ className="w-full flex items-center gap-2 px-3 py-1.5 text-[11px] text-neutral-300 hover:bg-white/6 text-left"+ onClick={() => {+ onReorder(elements.map((e) => e.id), []);+ setVideoCtxMenu(null);+ }}+ >+ <Icon icon="qlementine-icons:bring-to-back-16" className="size-4.5 opacity-70" />+ {tActions("actions.sendToBack")}+ </button>+ </div>+ )}++ {groupCtxMenu && (+ <div+ data-ctx-menu+ className="fixed z-[9999] bg-[#1c1c1f] border border-white/10 rounded-lg shadow-2xl py-1 min-w-40 overflow-hidden"+ style={{ left: groupCtxMenu.x, top: groupCtxMenu.y }}+ onPointerDown={(e) => e.stopPropagation()}+ >+ <button+ className="w-full flex items-center gap-2 px-3 py-1.5 text-[11px] text-neutral-300 hover:bg-white/6 text-left"+ onClick={() => {+ const memberIds = elements+ .filter((e) => e.groupId === groupCtxMenu.groupId)+ .map((e) => e.id);+ onUngroup?.(memberIds);+ setGroupCtxMenu(null);+ }}+ >+ <Icon icon="solar:layers-bold" className="size-4 opacity-70" />+ {t("layerPanel.ungroupAction")}+ </button>+ <button+ className="w-full flex items-center gap-2 px-3 py-1.5 text-[11px] text-red-400 hover:bg-red-500/10 text-left"+ onClick={() => {+ const memberIds = elements+ .filter((e) => e.groupId === groupCtxMenu.groupId)+ .map((e) => e.id);+ onDelete(memberIds);+ setSelectedIds((p) => p.filter((x) => !memberIds.includes(x)));+ setGroupCtxMenu(null);+ }}+ >+ <Icon icon="solar:trash-bin-trash-bold" className="size-4 opacity-70" />+ {t("layerPanel.tooltips.deleteGroup")}+ </button>+ </div>+ )}+{ctxMenu &&(() => {const allInSameGroup =@@ -896,6 +984,9 @@ export function LayersPanel({const gNum = groupNumbers.get(gid);ghostLabel = `${t("layerPanel.group")} ${gNum ?? ""}`;ghostIcon = "solar:folder-bold";+ } else if (pointerDrag.id === VIDEO_SENTINEL) {+ ghostLabel = mediaType === "video" ? t("layerPanel.videoLayer") : t("layerPanel.imageLayer");+ ghostIcon = mediaType === "video" ? TYPE_ICON.video : TYPE_ICON.image;} else {const dragEl = elementsById[pointerDrag.id];if (dragEl) {@@ -913,7 +1004,7 @@ export function LayersPanel({}}><div className="flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-[#1c1c1f]/90 border border-white/10 shadow-2xl backdrop-blur-sm">- <Icon icon={ghostIcon} className="size-3.5 text-[#00A3FF]" />+ <Icon icon={ghostIcon} className="size-4.5 text-[#00A3FF]" /><span className="text-[11px] text-white font-medium max-w-30 truncate">{ghostLabel}</span>diff --git a/app/components/ui/editor/PhotoEditorPlaceholder.tsx b/app/components/ui/editor/PhotoEditorPlaceholder.tsxindex 48f2b4e..47e4392 100644--- a/app/components/ui/editor/PhotoEditorPlaceholder.tsx+++ b/app/components/ui/editor/PhotoEditorPlaceholder.tsx@@ -202,14 +202,14 @@ export function PhotoEditorPlaceholder({{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">+ <div className="size-8 rounded-full bg-white/5 border border-white/5 flex items-center justify-center"><Iconicon="mdi:tune-variant"- width={14}+ width={16}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">+ <span className="text-[11px] font-semibold text-white/50 group-hover:text-white/80 transition-colors">{t("photoPreview.custom.customize")}</span></div>diff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsxindex 01e7e28..315a9eb 100644--- a/app/components/ui/editor/VideoCanvas.tsx+++ b/app/components/ui/editor/VideoCanvas.tsx@@ -29,6 +29,7 @@ import { Viewer3DControls } from "@/lib/viewer-controls3d";import { ControlsPopup } from "@/components/ui/ControlsPopup";import { CanvasContextMenu } from "@/components/ui/CanvasContextMenu";import { Viewer3DControlsBridge } from "@/components/ui/Viewer3DControlsBridge";+import { applyGradientMaskToRegion, GetMediaMaskStyles } from "@/lib/media-mask.utils";export type { VideoCanvasHandle, VideoCanvasProps };@@ -155,7 +156,12 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioconst ctrlScrollWheelRef = useRef<((e: WheelEvent) => void) | null>(null);// WebGL canvas from image phone Phone3DViewer, captured via onMount prop for exportconst imagePhoneCanvasRef = useRef<HTMLCanvasElement | null>(null);- const imagePhoneApiRef = useRef<{ renderAt: (w: number, h: number) => void; restorePreview: () => void; hasBuiltInShadow?: boolean } | null>(null);+ const imagePhoneApiRef = useRef<{+ renderAt: (w: number, h: number) => void;+ restorePreview: () => void;+ hasBuiltInShadow?: boolean;+ getVisualSize?: () => { width: number; height: number } | null;+ } | null>(null);const [activePhoneDevice, setActivePhoneDevice] = useState<string | null>(null);const [phoneTransitioning, setPhoneTransitioning] = useState(false);const rafDragRef = useRef<number | null>(null);@@ -257,30 +263,6 @@ 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(() => {@@ -490,7 +472,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functio// Multi-select and canvas right-click context menuconst [canvasSelectedIds, setCanvasSelectedIds] = useState<string[]>([]);- const [canvasCtxMenu, setCanvasCtxMenu] = useState<{ x: number; y: number } | null>(null);+ const [canvasCtxMenu, setCanvasCtxMenu] = useState<{ x: number; y: number; isVideo?: boolean } | null>(null);useEffect(() => {if (!canvasCtxMenu) return;@@ -504,37 +486,14 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioconst maskStyles = useMemo(() => {const config = mediaType === "video" ? videoMaskConfig : imageMaskConfig;- if (!config || !config.enabled) return {};-- const masks = [];- if (config.top) {- masks.push(`linear-gradient(180deg, transparent ${config.top.from}%, black ${config.top.to ?? 100}%)`);- }- if (config.bottom) {- masks.push(`linear-gradient(0deg, transparent ${config.bottom.from}%, black ${config.bottom.to ?? 100}%)`);- }- if (config.left) {- masks.push(`linear-gradient(90deg, transparent ${config.left.from}%, black ${config.left.to ?? 100}%)`);- }- if (config.right) {- masks.push(`linear-gradient(270deg, transparent ${config.right.from}%, black ${config.right.to ?? 100}%)`);- }- if (config.angle !== undefined) {- masks.push(`linear-gradient(${config.angle}deg, transparent ${config.angleFrom ?? 0}%, black ${config.angleTo ?? 100}%)`);- }-- if (masks.length === 0) return {};-- return {- WebkitMaskImage: masks.join(', '),- WebkitMaskComposite: 'source-in',- maskImage: masks.join(', '),- maskComposite: 'intersect'- };+ return GetMediaMaskStyles(config);}, [mediaType, videoMaskConfig, imageMaskConfig]);const hasMask = Object.keys(maskStyles).length > 0;const hasMockup = mockupId && mockupId !== "none";+ const effectivePhoneMaskConfig = useMemo(() => {+ return mediaType === "video" ? videoMaskConfig : imageMaskConfig;+ }, [mediaType, videoMaskConfig, imageMaskConfig]);const elementImagesRef = useRef<Map<string, HTMLImageElement>>(new Map());const svgImageCacheRef = useRef<Map<string, HTMLImageElement>>(new Map());@@ -574,7 +533,6 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functio}}, [imageUrlToLoad]);-useEffect(() => {if (!imagePhoneActive) {setActivePhoneDevice(null);@@ -1290,7 +1248,8 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioconst phoneCx = canvasWidth / 2 + imagePhoneX * pxScale;const phoneCy = canvasHeight / 2 + imagePhoneY * pxScale;// Use device-specific dimensions instead of generic PHONE_W/H- const deviceDims = DEVICE_3D_DIMENSIONS[imagePhoneDevice] ?? { width: PHONE_W, height: PHONE_H };+ const measuredDims = imagePhoneApiRef.current?.getVisualSize?.();+ const deviceDims = measuredDims ?? DEVICE_3D_DIMENSIONS[imagePhoneDevice] ?? { width: PHONE_W, height: PHONE_H };const drawW = deviceDims.width * imagePhoneScale * pxScale;const drawH = deviceDims.height * imagePhoneScale * pxScale;// Paint CSS-shadow replica as a 2D radial gradient underneath the model,@@ -1313,16 +1272,15 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioctx.restore();}if (highQuality) {- // Solo para exportación real — redimensionar el canvas WebGL EN VIVO- // causa una carrera con el compositor del navegador.imagePhoneApiRef.current?.renderAt(drawW, drawH);ctx.drawImage(phoneGL, phoneCx - drawW / 2, phoneCy - drawH / 2, drawW, drawH);imagePhoneApiRef.current?.restorePreview();} else {- // Liviano: escala lo que ya está renderizado en el canvas en vivo.- // Nunca toca la resolución del canvas visible.ctx.drawImage(phoneGL, phoneCx - drawW / 2, phoneCy - drawH / 2, drawW, drawH);}+ if (effectivePhoneMaskConfig?.enabled) {+ applyGradientMaskToRegion(ctx, phoneCx - drawW / 2, phoneCy - drawH / 2, drawW, drawH, effectivePhoneMaskConfig);+ }}ctx.restore();return;@@ -1410,7 +1368,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiodrawMockupAndMedia(fgCtx, containerX, containerY, containerWidth, containerHeight, video!, false);}if (imagePhoneActive && imagePhoneCanvasRef.current) {- drawPhone3DCompositeWithZoom(ctx, canvasWidth, canvasHeight, frameTime, zoomState, highQuality);+ drawPhone3DCompositeWithZoom(ctx, canvasWidth, canvasHeight, frameTime, zoomState, highQuality, pivotX, pivotY);}fgCtx.restore();@@ -1497,7 +1455,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioctx.restore();}if (imagePhoneActive && imagePhoneCanvasRef.current) {- drawPhone3DCompositeWithZoom(ctx, canvasWidth, canvasHeight, frameTime, zoomState, highQuality);+ drawPhone3DCompositeWithZoom(ctx, canvasWidth, canvasHeight, frameTime, zoomState, highQuality, pivotX, pivotY);}@@ -1510,7 +1468,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioctx.restore();if (imagePhoneActive && imagePhoneCanvasRef.current) {- drawPhone3DCompositeWithZoom(ctx, canvasWidth, canvasHeight, frameTime, zoomState, highQuality);+ drawPhone3DCompositeWithZoom(ctx, canvasWidth, canvasHeight, frameTime, zoomState, highQuality, pivotX, pivotY);}}@@ -1531,24 +1489,24 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functio_frameTime: number,zs: { scale: number; focusX: number; focusY: number },highQuality: boolean,+ pivotX: number,+ pivotY: number,) => {const phoneGL = imagePhoneCanvasRef.current!;const domW = canvasDimensions?.width ?? canvasWidth;const pxScale = canvasWidth / domW;-const zScale = zs.scale;- const focusPxX = (zs.focusX / 100) * canvasWidth;- const focusPxY = (zs.focusY / 100) * canvasHeight;const centerX = canvasWidth / 2;const centerY = canvasHeight / 2;-const baseCx = centerX + imagePhoneX * pxScale;const baseCy = centerY + imagePhoneY * pxScale;- const phoneCx = (baseCx - focusPxX) * zScale + centerX;- const phoneCy = (baseCy - focusPxY) * zScale + centerY;+ const phoneCx = pivotX + zScale * (baseCx - pivotX);+ const phoneCy = pivotY + zScale * (baseCy - pivotY);++ const measuredDims = imagePhoneApiRef.current?.getVisualSize?.();+ const deviceDims = measuredDims ?? DEVICE_3D_DIMENSIONS[imagePhoneDevice] ?? { width: PHONE_W, height: PHONE_H };- const deviceDims = DEVICE_3D_DIMENSIONS[imagePhoneDevice] ?? { width: PHONE_W, height: PHONE_H };const drawW = deviceDims.width * imagePhoneScale * pxScale * zScale;const drawH = deviceDims.height * imagePhoneScale * pxScale * zScale;@@ -1580,6 +1538,10 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functio} else {c.drawImage(phoneGL, phoneCx - drawW / 2, phoneCy - drawH / 2, drawW, drawH);}++ if (effectivePhoneMaskConfig?.enabled) {+ applyGradientMaskToRegion(c, phoneCx - drawW / 2, phoneCy - drawH / 2, drawW, drawH, effectivePhoneMaskConfig);+ }};const drawCameraOverlay = async (@@ -1718,11 +1680,21 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioonDragLeave={handleDragLeave}onDrop={handleDrop}onContextMenu={(e) => {- if (canvasElements.length === 0) return;const target = e.target as HTMLElement;- if (!target.closest('[data-canvas-element]')) return;+ const isElementTarget = !!target.closest('[data-canvas-element]');+ const isVideoTarget = !isElementTarget && (+ !!target.closest('[data-video-container]') || !!target.closest('[data-image-phone-overlay]')+ );+ if (isElementTarget && canvasElements.length === 0) return;+ if (!isElementTarget && !isVideoTarget) return;+e.preventDefault();- setCanvasCtxMenu({ x: e.clientX, y: e.clientY });+ if (isVideoTarget) {+ setIsVideoSelected(true);+ if (onElementSelect) onElementSelect(null);+ setCanvasSelectedIds([]);+ }+ setCanvasCtxMenu({ x: e.clientX, y: e.clientY, isVideo: isVideoTarget });}}>{mediaType === "image" && isDraggingOver && (@@ -1740,6 +1712,17 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioonElementDelete={onElementDelete}setCanvasCtxMenu={setCanvasCtxMenu}setCanvasSelectedIds={setCanvasSelectedIds}+ isVideoTarget={canvasCtxMenu?.isVideo}+ onVideoBringToFront={() => {+ canvasElements.forEach((el, i) => {+ if (onElementUpdate) onElementUpdate(el.id, { zIndex: Math.max(1, VIDEO_Z_INDEX - 1 - i) });+ });+ }}+ onVideoSendToBack={() => {+ canvasElements.forEach((el, i) => {+ if (onElementUpdate) onElementUpdate(el.id, { zIndex: VIDEO_Z_INDEX + canvasElements.length - i });+ });+ }}/>)}@@ -1854,10 +1837,11 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiotransition: `transform ${zoomTransform.transitionMs}ms ${ZOOM_EASING}`,willChange: zoomTransform.perspective > 0 ? 'transform' : 'auto',transformStyle: 'preserve-3d',- zIndex: isVideoSelected ? 101 : 2,+ zIndex: 2,pointerEvents: 'none',// Allow the 3D phone overlay to overflow when in image-phone modeoverflow: 'hidden',+}}>{/* Capa 2B: Video con padding, esquinas redondeadas y sombras */}@@ -1865,7 +1849,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioclassName="absolute inset-0 flex items-center justify-center transition-all duration-200"style={{padding: `${padding * 0.5}%`,- zIndex: isVideoSelected ? 101 : 2,+ zIndex: 2,pointerEvents: 'none',// Hide the video layer while a motion template is active;// the video element stays in the DOM so playback/timing continues.@@ -1915,6 +1899,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioe.preventDefault();setIsVideoSelected(true);if (onElementSelect) onElementSelect(null);+ setCanvasSelectedIds([]);setVideoHoverCorner(getNearestCorner(e, videoTransform.rotation));setIsDraggingVideo(true);dragStartPos.current = {@@ -2069,7 +2054,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiotransformStyle: mediaType === "image" && !apply3DToBackground ? 'preserve-3d' : undefined,}}>- <EditorHoverTooltip show={isVideoHovered && !imagePhoneActive} />+ <EditorHoverTooltip show={isVideoHovered && !imagePhoneActive && mediaType === "image"} /></div></div></div>@@ -2170,19 +2155,21 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiopointerEvents: "none",}}>- <EditorHoverTooltip show={isVideoHovered} />+ <EditorHoverTooltip show={isVideoHovered && mediaType === "image"} /></div></div>- {/* Mockup layer: SÍ se escala */}<divclassName="absolute animate-in fade-in zoom-in-95 duration-300"data-image-phone-overlayonMouseEnter={() => setIsVideoHovered(true)}onMouseLeave={() => setIsVideoHovered(false)}onPointerDown={(e) => {- if (!onMockupClick) return;if (!imagePhoneActive) return;+ setIsVideoSelected(true);+ if (onElementSelect) onElementSelect(null);+ setCanvasSelectedIds([]);+ if (!onMockupClick) return;clickStartPosRef.current = { x: e.clientX, y: e.clientY };}}onClick={(e) => {@@ -2223,7 +2210,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioimageUrl={imageUrl}videoElement={mediaType === "video" ? videoRef.current : undefined}openingProgress={imagePhoneOpening}- imageMaskConfig={imageMaskConfig}+ imageMaskConfig={effectivePhoneMaskConfig}cropArea={cropArea}initialRotationX={imagePhoneRotX}initialRotationY={imagePhoneRotY}@@ -2239,13 +2226,15 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiorotationSpeed={viewer3D.rotationSpeed}glow={viewer3D.glow}environment={viewer3D.environment}+ isSelected={isVideoSelected}+ isHovered={isVideoHovered}/>) : activePhoneDevice === "iphone-13-pro-max" ? (<IPhone13ProMax3DViewerkey="iphone-13-pro-max"imageUrl={imageUrl}videoElement={mediaType === "video" ? videoRef.current : undefined}- imageMaskConfig={imageMaskConfig}+ imageMaskConfig={effectivePhoneMaskConfig}cropArea={cropArea}initialRotationX={imagePhoneRotX}initialRotationY={imagePhoneRotY}@@ -2261,13 +2250,15 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiorotationSpeed={viewer3D.rotationSpeed}glow={viewer3D.glow}environment={viewer3D.environment}+ isSelected={isVideoSelected}+ isHovered={isVideoHovered}/>) : activePhoneDevice === "iphone-17-pro-max" ? (<IPhone17ProMax3DViewerkey="iphone-17-pro-max"imageUrl={imageUrl}videoElement={mediaType === "video" ? videoRef.current : undefined}- imageMaskConfig={imageMaskConfig}+ imageMaskConfig={effectivePhoneMaskConfig}cropArea={cropArea}initialRotationX={imagePhoneRotX}initialRotationY={imagePhoneRotY}@@ -2283,13 +2274,15 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiorotationSpeed={viewer3D.rotationSpeed}glow={viewer3D.glow}environment={viewer3D.environment}+ isSelected={isVideoSelected}+ isHovered={isVideoHovered}/>) : activePhoneDevice === "double_iphone_13_pro" ? (<DoubleIPhone3DViewerkey="double_iphone_13_pro"imageUrl={imageUrl}videoElement={mediaType === "video" ? videoRef.current : undefined}- imageMaskConfig={imageMaskConfig}+ imageMaskConfig={effectivePhoneMaskConfig}cropArea={cropArea}initialRotationX={imagePhoneRotX}initialRotationY={imagePhoneRotY}@@ -2304,13 +2297,15 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiorotationSpeed={viewer3D.rotationSpeed}glow={viewer3D.glow}environment={viewer3D.environment}+ isSelected={isVideoSelected}+ isHovered={isVideoHovered}/>) : activePhoneDevice === "ipad_mini_6_2021" ? (<IPadMini63DViewerkey="ipad_mini_6_2021"imageUrl={imageUrl}videoElement={mediaType === "video" ? videoRef.current : undefined}- imageMaskConfig={imageMaskConfig}+ imageMaskConfig={effectivePhoneMaskConfig}cropArea={cropArea}initialRotationX={imagePhoneRotX}initialRotationY={imagePhoneRotY}@@ -2325,6 +2320,8 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiorotationSpeed={viewer3D.rotationSpeed}glow={viewer3D.glow}environment={viewer3D.environment}+ isSelected={isVideoSelected}+ isHovered={isVideoHovered}/>) : (@@ -2332,7 +2329,7 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiokey={imagePhoneDevice}imageUrl={imageUrl}videoElement={mediaType === "video" ? videoRef.current : undefined}- imageMaskConfig={imageMaskConfig}+ imageMaskConfig={effectivePhoneMaskConfig}cropArea={cropArea}initialRotationX={imagePhoneRotX}initialRotationY={imagePhoneRotY}@@ -2349,6 +2346,8 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functiorotationSpeed={viewer3D.rotationSpeed}glow={viewer3D.glow}environment={viewer3D.environment}+ isSelected={isVideoSelected}+ isHovered={isVideoHovered}/>)}</div>@@ -2511,7 +2510,6 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functio</div></div></div>- {/* ── Layers panel — pegado al lado derecho del canvas ── */}<div className="flex-shrink-0 self-stretch flex items-stretch z-10"><LayersPanelelements={canvasElements}@@ -2524,9 +2522,12 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functioelse if (ids.length === 0) handleElementSelect(null);}}onDelete={(idOrIds) => { if (onElementDelete) onElementDelete(idOrIds); }}- onReorder={(orderedIds) => {- orderedIds.forEach((id, pos) => {- if (onElementUpdate) onElementUpdate(id, { zIndex: VIDEO_Z_INDEX + 500 - pos });+ onReorder={(frontIds, backIds) => {+ frontIds.forEach((id, pos) => {+ if (onElementUpdate) onElementUpdate(id, { zIndex: VIDEO_Z_INDEX + frontIds.length - pos });+ });+ backIds.forEach((id, pos) => {+ if (onElementUpdate) onElementUpdate(id, { zIndex: Math.max(1, VIDEO_Z_INDEX - 1 - pos) });});}}onSetGroupId={(id, groupId) => {@@ -2566,10 +2567,11 @@ const VideoCanvasInner = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functio}}toolbar={layersPanelToolbar}videoLayerVisible={!!(videoUrl || imageUrl)}- isVideoLayerSelected={selectedElementId === null && canvasSelectedIds.length === 0}+ isVideoLayerSelected={isVideoSelected}onVideoLayerSelect={() => {handleElementSelect(null);setCanvasSelectedIds([]);+ setIsVideoSelected(true);}}mediaType={mediaType}hoveredElementId={hoveredElementId}diff --git a/components/ui/CanvasContextMenu.tsx b/components/ui/CanvasContextMenu.tsxindex bb1efc4..49511b7 100644--- a/components/ui/CanvasContextMenu.tsx+++ b/components/ui/CanvasContextMenu.tsx@@ -17,6 +17,9 @@ interface CanvasContextMenuProps {onElementDelete?: (ids: string | string[]) => void;setCanvasCtxMenu: (menu: { x: number; y: number } | null) => void;setCanvasSelectedIds: (ids: string[]) => void;+ isVideoTarget?: boolean;+ onVideoBringToFront?: () => void;+ onVideoSendToBack?: () => void;}export function CanvasContextMenu({@@ -29,11 +32,49 @@ export function CanvasContextMenu({onElementDelete,setCanvasCtxMenu,setCanvasSelectedIds,+ isVideoTarget = false,+ onVideoBringToFront,+ onVideoSendToBack,}: CanvasContextMenuProps) {const t = useTranslations("elementsMenu");if (!canvasCtxMenu) return null;+ if (isVideoTarget) {+ return (+ <div+ data-canvas-ctx-menu+ className="fixed z-[9999] bg-black border border-white/15 rounded-xl shadow-2xl py-1 min-w-45 overflow-hidden"+ style={{+ left: Math.min(canvasCtxMenu.x, window.innerWidth - 196),+ top: Math.min(canvasCtxMenu.y, window.innerHeight - 96),+ }}+ onPointerDown={(e) => e.stopPropagation()}+ >+ <button+ className="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={() => {+ onVideoBringToFront?.();+ setCanvasCtxMenu(null);+ }}+ >+ <Icon icon="qlementine-icons:bring-to-front-16" className="size-3.5 shrink-0 opacity-70" />+ {t("actions.bringToFront")}+ </button>+ <button+ className="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={() => {+ onVideoSendToBack?.();+ setCanvasCtxMenu(null);+ }}+ >+ <Icon icon="qlementine-icons:bring-to-back-16" className="size-3.5 shrink-0 opacity-70" />+ {t("actions.sendToBack")}+ </button>+ </div>+ );+ }+const ids = canvasSelectedIds.length > 0 ? canvasSelectedIds : selectedElementId ? [selectedElementId] : [];const isMulti = ids.length > 1;const singleId = ids[0] ?? null;