Create professional demos and 3D mockups in seconds, directly in your browser
feat: add AudioTrimModal component for audio trimming functionality
CristianOlivera17941d27ae0da
diff --git a/app/components/ui/AspectRatioSelect.tsx b/app/components/ui/AspectRatioSelect.tsxindex 027671f..b042d95 100644--- a/app/components/ui/AspectRatioSelect.tsx+++ b/app/components/ui/AspectRatioSelect.tsx@@ -6,6 +6,7 @@ import {} from "@/components/ui/popover";import { Icon } from "@iconify/react";import type { AspectRatio } from "@/types";+import { TooltipAction } from "@/components/ui/tooltip-action";interface AspectRatioSelectProps {value: AspectRatio;@@ -65,16 +66,17 @@ export function AspectRatioSelect({ value, onChange, customDimensions, onCustomDreturn (<Popover open={isOpen} onOpenChange={handleOpenChange}>- <PopoverTrigger asChild>- <button- className="flex items-center gap-2 h-8 px-3 text-xs font-medium border border-input bg-background rounded-md hover:bg-accent hover:text-accent-foreground transition-colors w-full sm:w-auto"- title="Seleccionar proporción de aspecto"- >- <Icon icon="mynaui:layout" width="16" className="shrink-0" />- <span className="truncate">{displayLabel}</span>- <Icon icon="lucide:chevron-down" width="14" className="ml-auto opacity-50 shrink-0" />- </button>- </PopoverTrigger>+ <TooltipAction label="Seleccionar proporción de aspecto">+ <PopoverTrigger asChild>+ <button+ className="flex items-center gap-2 h-8 px-3 text-xs font-medium border border-input bg-background rounded-md hover:bg-accent hover:text-accent-foreground transition-colors w-full sm:w-auto"+ >+ <Icon icon="mynaui:layout" width="16" className="shrink-0" />+ <span className="truncate">{displayLabel}</span>+ <Icon icon="lucide:chevron-down" width="14" className="ml-auto opacity-50 shrink-0" />+ </button>+ </PopoverTrigger>+ </TooltipAction><PopoverContent className="w-64 p-2" align="start"><div className="flex flex-col gap-1">diff --git a/app/components/ui/BackgroundColorEditor.tsx b/app/components/ui/BackgroundColorEditor.tsxindex 3201f1f..b86db86 100644--- a/app/components/ui/BackgroundColorEditor.tsx+++ b/app/components/ui/BackgroundColorEditor.tsx@@ -10,6 +10,7 @@ import type {} from "@/types";import { gradientToCss, PRESET_SOLID_COLORS, PRESET_LINEAR_GRADIENTS, PRESET_RADIAL_GRADIENTS, PRESET_CONIC_GRADIENTS } from "@/types";import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";+import { TooltipAction } from "@/components/ui/tooltip-action";interface BackgroundColorEditorProps {value: BackgroundColorConfig | null;@@ -383,7 +384,6 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditorreturn (<div className="space-y-6">- {/* Mode toggle */}<div className="flex bg-[#09090B] squircle-element p-1 text-xs font-medium"><buttonclassName={`flex-1 py-1.5 rounded transition ${mode === "gradient" ? "bg-white/10 text-white" : "text-white/60 hover:text-white"}`}@@ -399,7 +399,6 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor</button></div>- {/* ── Solid mode ── */}{mode === "solid" && (<div className="space-y-4"><div>@@ -414,18 +413,19 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor/>))}<Popover>- <PopoverTrigger asChild>- <button- className="aspect-square squircle-element border border-dashed border-white/30 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"- title="Ver más colores"- >- <Icon- icon="ph:plus-bold"- width="16"- className="text-blue-400 group-hover:text-blue-300 transition-colors"- />- </button>- </PopoverTrigger>+ <TooltipAction label="Ver más colores">+ <PopoverTrigger asChild>+ <button+ className="aspect-square squircle-element border border-dashed border-white/30 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"+ >+ <Icon+ icon="ph:plus-bold"+ width="16"+ className="text-blue-400 group-hover:text-blue-300 transition-colors"+ />+ </button>+ </PopoverTrigger>+ </TooltipAction><PopoverContent side="right" align="start" sideOffset={12} className="w-72 p-0 border-0 shadow-2xl"><div className="flex flex-col bg-[#111113] border border-white/10 rounded-xl overflow-hidden shadow-2xl"><div className="flex items-center gap-2 px-4 py-3 border-b border-white/10 bg-white/2">@@ -433,11 +433,11 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor<span className="text-[10px] font-medium uppercase tracking-[0.15em] text-white/50">Más colores</span><span className="ml-auto text-[10px] text-white/60">{PRESET_SOLID_COLORS.length} total</span></div>- <div className="p-3 grid grid-cols-5 gap-2 max-h-80 overflow-y-auto custom-scrollbar">+ <div className="p-3 grid grid-cols-6 gap-2 max-h-80 overflow-y-auto custom-scrollbar">{PRESET_SOLID_COLORS.slice(23).map((color, idx) => (<buttonkey={`extra-${idx}-${color}`}- className={`aspect-square rounded-lg cursor-pointer hover:ring-2 transition border shadow-sm ${value?.type === "solid" && value.config.color === color ? "ring-2 ring-white/90 shadow-lg shadow-white" : "border-white/10 ring-white/60"}`}+ className={`aspect-square squircle-element cursor-pointer hover:ring-2 transition border shadow-sm ${value?.type === "solid" && value.config.color === color ? "ring-2 ring-white/90 shadow-lg shadow-white" : "border-white/10 ring-white/60"}`}style={{ backgroundColor: color }}onClick={() => handleSolidColorSelect(color)}/>@@ -467,7 +467,6 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor</div>)}- {/* ── Gradient mode ── */}{mode === "gradient" && (<div className="space-y-4"><div>@@ -486,18 +485,19 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor);})}<Popover>- <PopoverTrigger asChild>- <button- className="aspect-square squircle-element border border-dashed border-white/30 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"- title="Ver más gradientes"- >- <Icon- icon="ph:plus-bold"- width="16"- className="text-blue-400 group-hover:text-blue-300 transition-colors"- />- </button>- </PopoverTrigger>+ <TooltipAction label="Ver más gradientes">+ <PopoverTrigger asChild>+ <button+ className="aspect-square squircle-element border border-dashed border-white/30 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"+ >+ <Icon+ icon="ph:plus-bold"+ width="16"+ className="text-blue-400 group-hover:text-blue-300 transition-colors"+ />+ </button>+ </PopoverTrigger>+ </TooltipAction><PopoverContent side="right" align="start" sideOffset={12} className="w-72 p-0 border-0 shadow-2xl"><div className="flex flex-col bg-[#111113] border border-white/10 rounded-xl overflow-hidden shadow-2xl"><div className="flex items-center gap-2 px-4 py-3 border-b border-white/10 bg-white/2">@@ -505,7 +505,7 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor<span className="text-[10px] font-medium uppercase tracking-[0.15em] text-white/50">Más gradientes {currentGradient.type}</span><span className="ml-auto text-[10px] text-white/60">{currentPresetGradients.length} total</span></div>- <div className="p-3 grid grid-cols-4 gap-2 max-h-80 overflow-y-auto custom-scrollbar">+ <div className="p-3 grid grid-cols-6 gap-2 max-h-80 overflow-y-auto custom-scrollbar">{currentPresetGradients.slice(23).map((gradient, i) => {const gradientCss = gradientToCss(gradient);const isSelected = value?.type === "gradient" && gradientCss === gradientToCss(value.config);@@ -514,7 +514,7 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditorkey={`extra-gradient-${i}`}onClick={() => handleGradientSelect(gradient)}style={{ background: gradientCss }}- className={`aspect-square rounded-lg cursor-pointer transition-all duration-200 border shadow-sm hover:scale-105 active:scale-95 ${isSelected ? "ring-2 ring-white/90 shadow-lg shadow-white" : "border-white/10 ring-white/60"}`}+ className={`aspect-square squircle-element cursor-pointer transition-all duration-200 border shadow-sm hover:scale-105 active:scale-95 ${isSelected ? "ring-2 ring-white/90 shadow-lg shadow-white" : "border-white/10 ring-white/60"}`}/>);})}@@ -528,7 +528,6 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor<div className="space-y-4"><div className="text-[10px] uppercase tracking-widest text-white/60 font-bold">Personalizar</div>- {/* Gradient type */}<div className="space-y-2"><div className="text-[10px] text-white/60 font-medium">Tipo</div><div className="flex gap-2">@@ -545,7 +544,6 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor</div></div>- {/* Angle */}{(currentGradient.type === "linear" || currentGradient.type === "conic") && (<div className="space-y-2"><div className="flex justify-between items-center text-[10px] text-white/60 font-medium">@@ -559,7 +557,6 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor</div>)}- {/* Conic origin */}{currentGradient.type === "conic" && (<div className="space-y-3">{(["X", "Y"] as const).map((axis) => {@@ -584,7 +581,6 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor</div>)}- {/* Color stops */}<div className="space-y-2"><div className="flex justify-between items-center"><div className="text-[10px] text-white/60 font-medium">Colores ({currentGradient.stops.length})</div>@@ -604,7 +600,6 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor/></div>- {/* Preview */}<div className="pt-2"><div className="w-full h-20 squircle-element border border-white/10" style={{ background: gradientToCss(currentGradient) }} /></div>diff --git a/app/components/ui/EditorPreview.tsx b/app/components/ui/EditorPreview.tsxindex ae7e0b9..766ee26 100644--- a/app/components/ui/EditorPreview.tsx+++ b/app/components/ui/EditorPreview.tsx@@ -1,173 +1,15 @@-import {Icon} from "@iconify/react";-export default function EditorPreview() {return (<div className="relative max-w-6xl mx-auto">- <div className="absolute -inset-1 bg-gradient-to-b from-neutral-700/20 to-transparent rounded-2xl blur-sm -z-10"></div>- <div className="bg-[#0A0A0A] border border-white/10 rounded-xl overflow-hidden shadow-2xl shadow-black/50 flex flex-col md:flex-row h-[600px] text-left">-- <div className="w-full md:w-64 bg-[#0F0F0F] border-r border-white/10 flex flex-col shrink-0">- <div className="p-4 border-b border-white/10 flex items-center justify-between">- <span className="text-xs font-medium text-neutral-400 uppercase tracking-wider">Properties</span>- <Icon icon="solar:settings-linear" className="text-neutral-500" />- </div>-- <div className="p-5 space-y-6 overflow-y-auto editor-scroll">- <div className="space-y-3">- <label className="text-sm text-neutral-300 font-medium flex items-center gap-2">- <Icon icon="solar:gallery-wide-linear" width="16" />- Background- </label>- <div className="grid grid-cols-4 gap-2">- <div className="aspect-square rounded border border-white/20 bg-gradient-to-br from-purple-900 to-indigo-900 cursor-pointer ring-2 ring-white/20"></div>- <div className="aspect-square rounded border border-white/10 bg-gradient-to-br from-neutral-800 to-neutral-900 cursor-pointer hover:border-white/20"></div>- <div className="aspect-square rounded border border-white/10 bg-[#1a1a1a] cursor-pointer hover:border-white/20"></div>- <div className="aspect-square rounded border border-white/10 relative overflow-hidden cursor-pointer hover:border-white/20 group">- <div className="absolute inset-0 flex items-center justify-center bg-neutral-800 text-white/50 group-hover:text-white transition-colors">- <Icon icon="solar:add-circle-linear" width="20" />- </div>- </div>- </div>- </div>-- <div className="space-y-3">- <div className="flex justify-between">- <label className="text-sm text-neutral-300 font-medium">Padding</label>- <span className="text-xs text-neutral-500">64px</span>- </div>- <input type="range" min="0" max="100" defaultValue="64" className="w-full" />- </div>-- <div className="space-y-3">- <div className="flex justify-between">- <label className="text-sm text-neutral-300 font-medium">Roundness</label>- <span className="text-xs text-neutral-500">12px</span>- </div>- <input type="range" min="0" max="24" defaultValue="12" className="w-full" />- </div>-- <div className="h-px bg-white/5 my-2"></div>-- <div className="space-y-4">- <label className="flex items-center justify-between cursor-pointer group">- <span className="text-sm text-neutral-300 group-hover:text-white transition-colors flex items-center gap-2">- <Icon icon="solar:cursor-square-linear" className="text-neutral-500" />- Show Cursor- </span>- <div className="relative inline-flex items-center cursor-pointer">- <input type="checkbox" defaultValue="" className="sr-only peer" />- <div className="w-9 h-5 bg-neutral-800 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-neutral-200"></div>- </div>- </label>- <label className="flex items-center justify-between cursor-pointer group">- <span className="text-sm text-neutral-300 group-hover:text-white transition-colors flex items-center gap-2">- <Icon icon="solar:box-minimalistic-linear" className="text-neutral-500" />- Shadow- </span>- <div className="relative inline-flex items-center cursor-pointer">- <input type="checkbox" defaultValue="" className="sr-only peer" />- <div className="w-9 h-5 bg-neutral-800 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-neutral-200"></div>- </div>- </label>- </div>- </div>-- <div className="mt-auto p-4 border-t border-white/10">- <button className="w-full py-2 bg-neutral-100 hover:bg-white text-black text-sm font-medium rounded transition-colors flex items-center justify-center gap-2">- Export Video- <Icon icon="solar:export-linear" width="16" />- </button>- </div>- </div>-- <div className="flex-1 bg-[#141414] relative flex flex-col">- <div className="h-12 border-b border-white/10 flex items-center justify-center gap-1 px-4">- <button className="p-2 hover:bg-white/5 rounded text-neutral-400 hover:text-white transition-colors">- <Icon icon="solar:scissors-linear" width="18" />- </button>- <button className="p-2 hover:bg-white/5 rounded text-neutral-400 hover:text-white transition-colors">- <Icon icon="solar:magnifier-zoom-in-linear" width="18" />- </button>- <div className="w-px h-4 bg-white/10 mx-2"></div>- <span className="text-xs font-mono text-neutral-500">00:04 / 00:15</span>- </div>-- <div className="flex-1 flex items-center justify-center p-8 overflow-hidden relative">- <div className="absolute inset-0 bg-gradient-to-br from-purple-900/40 to-indigo-900/40 backdrop-blur-3xl"></div>- <div className="w-full h-full absolute inset-0 opacity-20" style={{- backgroundImage: "radial-gradient(#ffffff 1px, transparent 1px)",- backgroundSize: "20px 20px",- }}- ></div>-- <div className="relative w-[80%] aspect-video bg-[#1a1a1a] rounded-lg shadow-2xl border border-white/10 overflow-hidden transform transition-transform duration-700 hover:scale-[1.02]">- <div className="h-8 bg-[#252525] flex items-center px-3 border-b border-white/10">- <div className="flex gap-1.5">- <div className="w-2.5 h-2.5 rounded-full bg-[#FF5F57]"></div>- <div className="w-2.5 h-2.5 rounded-full bg-[#FEBC2E]"></div>- <div className="w-2.5 h-2.5 rounded-full bg-[#28C840]"></div>- </div>- <div className="flex-1 text-center">- <div className="inline-block px-3 py-0.5 rounded bg-black/20 text-[10px] text-neutral-500 font-mono">openvid.app</div>- </div>- </div>- <div className="p-6 relative h-full">- <div className="flex gap-4">- <div className="w-16 h-16 rounded-full bg-neutral-800 animate-pulse"></div>- <div className="flex-1 space-y-3 py-2">- <div className="h-2 bg-neutral-800 rounded w-1/4"></div>- <div className="h-2 bg-neutral-800 rounded w-3/4"></div>- <div className="h-2 bg-neutral-800 rounded w-1/2"></div>- </div>- </div>- <div className="absolute top-1/2 left-1/3 w-32 h-32 border-2 border-indigo-500 rounded-lg shadow-[0_0_30px_rgba(99,102,241,0.3)] pointer-events-none flex items-start justify-start">- <div className="bg-indigo-500 text-white text-[9px] px-1.5 py-0.5 rounded-tl-sm font-bold">ZOOM 2x</div>- </div>- <div className="absolute top-[60%] left-[40%] text-white drop-shadow-md">- <Icon icon="solar:cursor-bold" width="24" />- </div>- </div>- </div>- </div>-- <div className="h-32 bg-[#0F0F0F] border-t border-white/10 flex flex-col">- <div className="h-6 border-b border-white/10 flex items-end px-2">- <div className="flex w-full justify-between text-[10px] text-neutral-600 font-mono pb-1">- <span>00:00</span>- <span>00:05</span>- <span>00:10</span>- <span>00:15</span>- </div>- </div>- <div className="flex-1 p-3 relative overflow-hidden">- <div className="space-y-2">- <div className="h-8 bg-neutral-800/50 rounded flex items-center overflow-hidden border border-white/10 relative">- <div className="absolute left-0 w-[40%] h-full bg-indigo-500/20 border-r border-indigo-500/50"></div>- <div className="flex gap-1 w-full px-1 opacity-20">- <div className="h-full w-8 bg-neutral-600 rounded-sm"></div>- <div className="h-full w-8 bg-neutral-600 rounded-sm"></div>- <div className="h-full w-8 bg-neutral-600 rounded-sm"></div>- <div className="h-full w-8 bg-neutral-600 rounded-sm"></div>- </div>- </div>- <div className="h-6 bg-neutral-800/30 rounded flex items-center px-2 overflow-hidden border border-white/10">- <div className="flex items-center gap-0.5 w-full">- <div className="w-1 h-2 bg-neutral-600 rounded-full"></div>- <div className="w-1 h-3 bg-neutral-600 rounded-full"></div>- <div className="w-1 h-4 bg-neutral-600 rounded-full"></div>- <div className="w-1 h-2 bg-neutral-600 rounded-full"></div>- <div className="w-1 h-3 bg-neutral-600 rounded-full"></div>- </div>- </div>- </div>- <div className="absolute top-0 left-[40%] h-full w-px bg-red-500 z-10">- <div className="absolute -top-1 -left-[5px] text-red-500">- <Icon icon="solar:polygon-down-bold" width="12" />- </div>- </div>- </div>- </div>- </div>+ <div className="absolute -inset-1 bg-gradient-to-b from-neutral-700/10 to-transparent rounded-2xl blur-md -z-10"></div>++ <div>+ <img+ src="/images/pages/openvid.webp"+ alt="OpenVidShot Editor Preview"+ className="w-full h-auto object-cover"+ loading="lazy"+ /></div></div>);diff --git a/app/components/ui/ExportDropdown.tsx b/app/components/ui/ExportDropdown.tsxindex e7c986e..8248f24 100644--- a/app/components/ui/ExportDropdown.tsx+++ b/app/components/ui/ExportDropdown.tsx@@ -106,13 +106,12 @@ export function ExportDropdown({ onExport, exportProgress, hasTransparentBackgro</span></button>- {/* BOTÓN 1080p */}<button- className={`group flex flex-col items-start gap-1.5 p-4 transition-all text-left border-b border-white/10 ${isTransparent ? "hover:bg-cyan-500/5" : "hover:bg-white/5"}`}+ className={`group flex flex-col items-start gap-1.5 p-4 transition-all text-left border-b border-white/10 ${isTransparent ? "hover:bg-cyan-500/10" : "hover:bg-cyan-500/10"}`}onClick={() => handleExport("1080p")}><div className="flex items-center justify-between w-full">- <span className="text-sm font-medium transition-colors text-white group-hover:text-white/80">+ <span className="text-sm font-medium transition-colors text-white group-hover:text-blue-400">{isTransparent ? (<>1080p WebM · <span className="text-cyan-400 group-hover:text-cyan-300">sin fondo</span></>) : (@@ -134,7 +133,6 @@ export function ExportDropdown({ onExport, exportProgress, hasTransparentBackgro</button>- {/* BOTÓN 720p */}<buttonclassName={`group flex flex-col items-start gap-1.5 p-4 transition-all text-left border-b border-white/10 ${isTransparent ? "hover:bg-cyan-500/5" : "hover:bg-white/5"}`}onClick={() => handleExport("720p")}diff --git a/app/components/ui/Hero.tsx b/app/components/ui/Hero.tsxindex 52e4ff9..e34e177 100644--- a/app/components/ui/Hero.tsx+++ b/app/components/ui/Hero.tsx@@ -1,42 +1,152 @@+"use client";+import { Button } from "@/components/ui/button";import { Icon } from "@iconify/react";-import Link from "next/link";+import { useRef, useState, useCallback } from "react";+import { useRouter } from "next/navigation";+import { saveUploadedVideo } from "@/lib/video-upload-cache";++interface HeroProps {+ onVideoUpload?: (file: File) => void;+}++export default function Hero({ onVideoUpload }: HeroProps) {+ const fileInputRef = useRef<HTMLInputElement>(null);+ const [isDragging, setIsDragging] = useState(false);+ const [isUploading, setIsUploading] = useState(false);+ const router = useRouter();++ const handleFile = useCallback(async (file: File) => {+ if (!file.type.startsWith("video/")) return;+ setIsUploading(true);+ try {+ // Save video to IndexedDB before navigating+ await saveUploadedVideo(file);++ if (onVideoUpload) {+ onVideoUpload(file);+ }++ // Navigate to editor after saving+ router.push("/editor");+ } catch (error) {+ console.error("Error uploading video:", error);+ setIsUploading(false);+ }+ }, [onVideoUpload, router]);++ const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {+ const file = e.target.files?.[0];+ if (file) handleFile(file);+ e.target.value = "";+ };++ const handleDragOver = (e: React.DragEvent) => {+ e.preventDefault();+ e.stopPropagation();+ setIsDragging(true);+ };++ const handleDragLeave = (e: React.DragEvent) => {+ e.preventDefault();+ e.stopPropagation();+ // Evitamos que el leave se dispare si estamos dentro del mismo contenedor+ setIsDragging(false);+ };++ const handleDrop = (e: React.DragEvent) => {+ e.preventDefault();+ e.stopPropagation();+ setIsDragging(false);+ const file = e.dataTransfer.files?.[0];+ if (file) handleFile(file);+ };-export default function Hero() {return (<>- <h1 className="text-5xl md:text-7xl font-semibold text-white tracking-tight mb-6 leading-[1.1] drop-shadow-[1.2px_1.2px_100.2px_rgba(183,203,248,1)]">- Grabación de{" "}+ <h1 className="animate-reveal text-5xl md:text-7xl font-semibold text-white tracking-tight mb-6 leading-[1.1] drop-shadow-[1.2px_1.2px_100.2px_rgba(183,203,248,1)]">+ Grabación de {" "}<span className="relative inline-flex items-center"><imgsrc="/svg/pantalla.svg"alt="Pantalla"className="inline-block h-[1.6em] w-auto align-middle translate-y-[0.1em] sm:translate-y-[0.3em]"/>-<imgsrc="/svg/cursor-animate.svg"- className="absolute -top-30 -right-30 h-[4em] w-auto"+ className="absolute -top-18 sm:-top-25 -right-28 sm:-right-30 h-[4em] w-auto"alt="Decoración"/></span><br /><span className="text-transparent bg-clip-text bg-linear-to-r from-neutral-200 via-neutral-400 to-[#003780]">- edición rápida+ edita en segundos</span></h1>- <p className="text-lg md:text-xl text-neutral-400 max-w-2xl mx-auto mb-10 font-light leading-relaxed">- Graba tu navegador, añade zooms suaves y personaliza fondos en segundos. Crea demos profesionales sin el editor de video complejo.+ <p className="animate-reveal [animation-delay:150ms] text-lg md:text-xl text-neutral-400 max-w-2xl mx-auto mb-10 font-light leading-relaxed">+ Añade zooms suaves, mockups, personaliza fondos y exporta demos profesionales sin editores complejos.</p>- <div className="flex flex-col sm:flex-row items-center justify-center gap-4 mb-20">- <Button asChild variant="primary" size="xl" className="text-xl">- <Link href="/editor"><div className="size-9 rounded-full bg-white flex items-center justify-center">- <Icon icon="fluent:screenshot-record-16-regular" className="size-7 text-red-500" />+ <div className="animate-reveal [animation-delay:300ms] flex flex-col sm:flex-row items-center justify-center gap-3">+ <div+ onDragOver={handleDragOver}+ onDragLeave={handleDragLeave}+ onDrop={handleDrop}+ onClick={() => !isUploading && fileInputRef.current?.click()}+ className={`+ relative flex items-center justify-center px-5 squircle-element border-2 border-dashed cursor-pointer+ transition-all duration-200 text-sm font-medium+ w-full sm:w-70 h-13+ ${isDragging+ ? "border-blue-400/70 bg-blue-500/10 text-blue-300 scale-[1.02]"+ : isUploading+ ? "border-white/20 bg-white/5 text-white/40 cursor-not-allowed"+ : "border-white/20 bg-white/5 text-white/90 hover:border-white/40 hover:bg-white/10 hover:text-white/80"+ }+ `}+ >+ <div className="flex items-center justify-center gap-3 pointer-events-none w-full">+ {isUploading ? (+ <>+ <Icon icon="svg-spinners:ring-resize" width="18" className="text-blue-400 shrink-0" />+ <span>Cargando video...</span>+ </>+ ) : isDragging ? (+ <>+ <Icon icon="ph:arrow-fat-down-bold" width="18" className="text-blue-400 shrink-0" />+ <span>Suelta el video aquí</span>+ </>+ ) : (+ <>+ <Icon icon="mage:video-upload" width="20" className="shrink-0" />+ <span>Subir video</span>+ <span className="text-white/40 text-xs">MP4, WebM, MOV</span>+ </>+ )}</div>- Empezar a grabar</Link>++ {isDragging && (+ <div className="absolute inset-0 rounded-2xl bg-blue-500/5 blur-sm pointer-events-none" />+ )}+ </div>++ <Button asChild variant="primary" size="lg" className="text-[14px] p-6 w-full sm:w-70 h-13">+ <a href="#docs">+ <div className="size-7 rounded-full bg-white flex items-center justify-center shrink-0">+ <Icon icon="fluent:screenshot-record-16-regular" className="size-5 text-red-500" />+ </div>+ Grabar pantalla+ </a></Button>++ <input+ ref={fileInputRef}+ type="file"+ accept="video/mp4,video/webm,video/quicktime,video/x-matroska"+ className="hidden"+ onChange={handleFileChange}+ /></div></>);diff --git a/app/components/ui/UnsplashPickerPopover.tsx b/app/components/ui/PhotoPickerPopover.tsxsimilarity index 67%rename from app/components/ui/UnsplashPickerPopover.tsxrename to app/components/ui/PhotoPickerPopover.tsxindex 73e138b..73e4279 100644--- a/app/components/ui/UnsplashPickerPopover.tsx+++ b/app/components/ui/PhotoPickerPopover.tsx@@ -3,91 +3,19 @@import { useState, useEffect, useRef, useCallback } from "react";import { Icon } from "@iconify/react";import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";-import { env } from "@/app/config/env";+import { fetchPhotosWithCache, fetchDiscoveryPhotos, type UnifiedPhoto } from "@/lib/photo-providers";+import { TooltipAction } from "@/components/ui/tooltip-action";const SUGGESTION_BADGES = ["blur gradient", "dark wallpaper", "minimal abstract", "neon city",- "nature landscape", "geometric pattern", "bokeh light", "ocean wave",- "forest mist", "sunset sky", "concrete texture", "aurora borealis",+ "nature landscape", "aurora borealis", "gradient wallpaper"];-const DISCOVERY_QUERIES = [- "blur gradient", "mesh gradient", "dark minimal wallpaper", "neon city night",- "abstract wave dark", "geometric dark background", "bokeh light",- "deep space stars", "forest mist", "ocean sunset", "smoke abstract",- "aurora sky", "city lights night", "minimal texture dark",-];--interface UnsplashPhoto {- id: string;- urls: { regular: string; small: string };- alt_description: string | null;- user: { name: string };- color: string;- width: number;- height: number;-}--interface UnsplashPickerPopoverProps {+interface PhotoPickerPopoverProps {onSelect: (imageUrl: string) => void;}-const searchCache = new Map<string, UnsplashPhoto[]>();-const discoveryCache: { photos: UnsplashPhoto[]; timestamp: number } = {- photos: [],- timestamp: 0,-};-const DISCOVERY_TTL = 5 * 60 * 1000; // 5 min — re-fetch only if stale--// In-flight deduplication: avoids double-fetching the same key concurrently-const inFlight = new Map<string, Promise<UnsplashPhoto[]>>();--async function fetchUnsplash(query: string, page = 1, perPage = 20): Promise<UnsplashPhoto[]> {- const cacheKey = `${query}::${page}::${perPage}`;-- if (searchCache.has(cacheKey)) return searchCache.get(cacheKey)!;-- if (inFlight.has(cacheKey)) return inFlight.get(cacheKey)!;-- const promise = (async () => {- const url = `https://api.unsplash.com/search/photos?query=${encodeURIComponent(query)}&page=${page}&per_page=${perPage}&orientation=landscape`;- try {- const res = await fetch(url, {- headers: { Authorization: `Client-ID ${env.unsplash.accessKey}` },- });- if (!res.ok) return [];- const data = await res.json();- const results: UnsplashPhoto[] = data.results ?? [];- searchCache.set(cacheKey, results);- return results;- } catch {- return [];- } finally {- inFlight.delete(cacheKey);- }- })();-- inFlight.set(cacheKey, promise);- return promise;-}--async function fetchDiscovery(): Promise<UnsplashPhoto[]> {- if (- discoveryCache.photos.length > 0 &&- Date.now() - discoveryCache.timestamp < DISCOVERY_TTL- ) {- return [...discoveryCache.photos].sort(() => Math.random() - 0.5);- }-- const query = DISCOVERY_QUERIES[Math.floor(Math.random() * DISCOVERY_QUERIES.length)];- const results = await fetchUnsplash(query, 1, 20);-- discoveryCache.photos = results;- discoveryCache.timestamp = Date.now();- return [...results].sort(() => Math.random() - 0.5);-}--function ProgressiveImage({ photo }: { photo: UnsplashPhoto }) {+function ProgressiveImage({ photo }: { photo: UnifiedPhoto }) {const [isLoaded, setIsLoaded] = useState(false);return (@@ -100,17 +28,17 @@ function ProgressiveImage({ photo }: { photo: UnsplashPhoto }) {><imgsrc={photo.urls.small}- alt={photo.alt_description ?? ""}+ alt={photo.alt}decoding="async"loading="lazy"+ crossOrigin="anonymous"onLoad={() => setIsLoaded(true)}- className={`w-full h-full object-cover transition-all duration-500 ease-out group-hover:scale-105 ${- isLoaded ? "opacity-100 blur-none" : "opacity-0 blur-sm"- }`}+ className={`w-full h-full object-cover transition-all duration-500 ease-out group-hover:scale-105 ${isLoaded ? "opacity-100 blur-none" : "opacity-0 blur-sm"+ }`}/><div className="absolute inset-0 bg-linear-to-t from-black/60 via-black/0 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex items-end p-2 pointer-events-none"><span className="text-[10px] text-white truncate font-medium drop-shadow-md">- {photo.user.name}+ {photo.photographer}</span></div></div>@@ -122,7 +50,7 @@ function MasonryGrid({onSelect,loading,}: {- photos: UnsplashPhoto[];+ photos: UnifiedPhoto[];onSelect: (url: string) => void;loading: boolean;}) {@@ -168,7 +96,7 @@ function MasonryGrid({<buttonkey={photo.id}onClick={() => onSelect(photo.urls.regular)}- className="w-full relative text-left cursor-pointer focus:outline-none focus:ring-2 focus:ring-white/50 rounded-lg block"+ className="w-full relative text-left cursor-pointer focus:outline-none focus:ring-2 focus:ring-white/80 rounded-lg block"><ProgressiveImage photo={photo} /></button>@@ -179,11 +107,11 @@ function MasonryGrid({);}-export function UnsplashPickerPopover({ onSelect }: UnsplashPickerPopoverProps) {+export function PhotoPickerPopover({ onSelect }: PhotoPickerPopoverProps) {const [open, setOpen] = useState(false);const [inputValue, setInputValue] = useState("");const [activeQuery, setActiveQuery] = useState("");- const [photos, setPhotos] = useState<UnsplashPhoto[]>([]);+ const [photos, setPhotos] = useState<UnifiedPhoto[]>([]);const [loading, setLoading] = useState(false);const [page, setPage] = useState(1);const [hasMore, setHasMore] = useState(true);@@ -203,12 +131,8 @@ export function UnsplashPickerPopover({ onSelect }: UnsplashPickerPopoverProps)setIsSearchMode(false);setPage(1);setHasMore(true);- if (discoveryCache.photos.length > 0) {- setPhotos([...discoveryCache.photos].sort(() => Math.random() - 0.5));- } else {- setLoading(true);- }- fetchDiscovery().then((results) => {+ setLoading(true);+ fetchDiscoveryPhotos().then((results) => {setPhotos(results);setLoading(false);});@@ -218,24 +142,16 @@ export function UnsplashPickerPopover({ onSelect }: UnsplashPickerPopoverProps)useEffect(() => {if (!activeQuery) return;- const cacheKey = `${activeQuery}::1::20`;- const cached = searchCache.get(cacheKey);const t = setTimeout(() => {setIsSearchMode(true);setPage(1);- if (cached) {- setPhotos(cached);- setHasMore(cached.length === 20);+ setLoading(true);+ fetchPhotosWithCache(activeQuery, 1, 20).then((results) => {+ setPhotos(results);+ setHasMore(results.length === 20);setLoading(false);- } else {- setLoading(true);- fetchUnsplash(activeQuery, 1).then((results) => {- setPhotos(results);- setHasMore(results.length === 20);- setLoading(false);- });- }+ });}, 0);return () => clearTimeout(t);}, [activeQuery]);@@ -247,7 +163,7 @@ export function UnsplashPickerPopover({ onSelect }: UnsplashPickerPopoverProps)const nextPage = page + 1;setPage(nextPage);setLoading(true);- fetchUnsplash(activeQuery, nextPage).then((results) => {+ fetchPhotosWithCache(activeQuery, nextPage, 20).then((results) => {setPhotos((prev) => {const seen = new Set(prev.map((p) => p.id));return [...prev, ...results.filter((p) => !seen.has(p.id))];@@ -280,35 +196,36 @@ export function UnsplashPickerPopover({ onSelect }: UnsplashPickerPopoverProps)setInputValue("");setActiveQuery("");setIsSearchMode(false);- if (discoveryCache.photos.length > 0) {- setPhotos([...discoveryCache.photos].sort(() => Math.random() - 0.5));- }+ setLoading(true);+ fetchDiscoveryPhotos().then((results) => {+ setPhotos(results);+ setLoading(false);+ });};const handleSelect = (url: string) => {onSelect(url);- setOpen(false);};return (<Popover open={open} onOpenChange={setOpen}>- <PopoverTrigger asChild>- <button- className="aspect-square squircle-element border border-white/10 bg-white flex items-center justify-center hover:bg-white/80 transition group"- title="Buscar en Unsplash"- >- <Icon icon="ri:unsplash-fill" className="text-black" width="18" />- </button>- </PopoverTrigger>+ <TooltipAction label="Buscar fondos (Unsplash + Pexels + Pixabay)">+ <PopoverTrigger asChild>+ <button+ className="aspect-square squircle-element bg-gray-100 border border-white/10 bg-linear-to-br from-indigo-500 via-purple-500 to-pink-500 bg-[url('/svg/ppu.svg')] bg-cover bg-center flex items-center justify-center hover:opacity-80 transition group relative overflow-hidden"+ >+ </button>+ </PopoverTrigger>+ </TooltipAction><PopoverContent side="right" align="start" sideOffset={12} className="w-115 p-0 border-0 shadow-2xl"><div className="flex flex-col bg-black border border-white/10 rounded-xl overflow-hidden shadow-2xl max-h-150"><div className="px-4 py-3 border-b border-white/10 bg-white/5 shrink-0"><div className="flex items-center gap-2">- <Icon icon="ri:unsplash-fill" width="13" className="text-white/50" />+ <Icon icon="ph:images-bold" width="13" className="text-white/50" /><span className="text-[10px] font-medium uppercase tracking-[0.15em] text-white/50">- Unsplash+ Fondos</span><span className="ml-auto text-[10px] text-white/30">{isSearchMode ? `"${activeQuery}"` : "Descubriendo"}@@ -341,11 +258,10 @@ export function UnsplashPickerPopover({ onSelect }: UnsplashPickerPopoverProps)<buttonkey={badge}onClick={() => handleBadgeClick(badge)}- className={`px-2.5 py-0.5 rounded-full text-[11px] transition-all border ${- activeQuery === badge- ? "bg-white/15 border-white/30 text-white/90"- : "bg-white/5 border-white/10 text-white/50 hover:text-white/70 hover:border-white/20"- }`}+ className={`px-2.5 py-0.5 rounded-full text-[11px] transition-all border ${activeQuery === badge+ ? "bg-white/15 border-white/30 text-white/90"+ : "bg-white/5 border-white/10 text-white/50 hover:text-white/70 hover:border-white/20"+ }`}>{badge}</button>@@ -384,6 +300,24 @@ export function UnsplashPickerPopover({ onSelect }: UnsplashPickerPopoverProps)>Unsplash</a>+ {", "}+ <a+ href="https://www.pexels.com"+ target="_blank"+ rel="noopener noreferrer"+ className="underline hover:text-white/50 transition-colors"+ >+ Pexels+ </a>+ {" y "}+ <a+ href="https://pixabay.com"+ target="_blank"+ rel="noopener noreferrer"+ className="underline hover:text-white/50 transition-colors"+ >+ Pixabay+ </a></span></div></div>diff --git a/app/components/ui/PlaceholderEditor.tsx b/app/components/ui/PlaceholderEditor.tsxindex 0ae94da..7630dcb 100644--- a/app/components/ui/PlaceholderEditor.tsx+++ b/app/components/ui/PlaceholderEditor.tsx@@ -162,7 +162,6 @@ export default function PlaceholderEditor({ onVideoUpload, isUploading = false }{onVideoUpload && (<Buttonvariant="outline"- onClick={handleUploadClick}disabled={isUploading}className="border-zinc-700 hover:bg-zinc-800 hover:text-white">diff --git a/app/components/ui/RecordingOverlay.tsx b/app/components/ui/RecordingOverlay.tsxindex aa00d90..9c9dbba 100644--- a/app/components/ui/RecordingOverlay.tsx+++ b/app/components/ui/RecordingOverlay.tsx@@ -1,9 +1,9 @@"use client";-import { useScreenRecording } from "@/hooks/useScreenRecording";+import { useRecording } from "@/hooks/RecordingContext";export default function RecordingOverlay() {- const { state, countdown, recordingTime, stopRecording, isCountdown, isRecording, isProcessing } = useScreenRecording();+ const { state, countdown, recordingTime, stopRecording, isCountdown, isRecording, isProcessing } = useRecording();if (state === "idle") return null;@@ -16,16 +16,12 @@ export default function RecordingOverlay() {return (<div className="fixed inset-0 z-9999 pointer-events-none">{isCountdown && (- <div className="absolute inset-0 bg-[#000B13]/95 backdrop-blur-md flex items-center justify-center z-50">+ <div className="absolute inset-0 bg-[#000B13]/95 backdrop-blur-md flex items-center justify-center z-50 pointer-events-auto"><div className="flex flex-col items-center scale-110">-<div className="relative w-44 h-44 flex items-center justify-center">-<div className="absolute inset-0 rounded-full bg-[#00A3FF]/30 animate-ping" /><div className="absolute inset-2 rounded-full bg-[#00A3FF]/20 animate-[ping_2s_linear_infinite]" />-<div className="relative w-40 h-40 rounded-full bg-gradient-primary p-1 shadow-[0_0_50px_rgba(0,163,255,0.3)]">-<div className="w-full h-full rounded-full bg-[#0E0E12] flex items-center justify-center"><span className="text-8xl font-bold text-white tabular-nums tracking-tighter">{countdown}@@ -47,9 +43,9 @@ export default function RecordingOverlay() {)}{isRecording && (- <div className="absolute top-4 left-1/2 -translate-x-1/2 pointer-events-auto">- <div className="flex items-center gap-4 bg-[#1E1E20] border border-white/10 rounded-full px-5 py-3 shadow-2xl">- <div className="flex items-center gap-3">+ <div className="absolute top-20 left-1/2 -translate-x-1/2 pointer-events-auto">+ <div className="flex items-center gap-4 bg-[#1E1E20] border border-white/10 rounded-full pl-5 pr-2 py-2 shadow-2xl">+ <div className="flex items-center gap-3 pr-2 border-r border-white/10"><div className="w-3 h-3 rounded-full bg-red-500 animate-pulse" /><span className="text-sm text-white font-medium">Grabando</span><span className="text-sm text-red-400 font-mono font-bold">@@ -58,10 +54,17 @@ export default function RecordingOverlay() {</div><buttononClick={stopRecording}- className="flex items-center gap-2 px-4 py-1.5 bg-red-500/20 hover:bg-red-500/30 border border-red-500/50 rounded-full text-red-400 text-sm font-medium transition-colors"+ className="group flex items-center gap-3 px-4 py-1.5 bg-red-500/10 hover:bg-red-500/20 border border-red-500/30 hover:border-red-500/50 rounded-full transition-all">- <div className="w-3 h-3 bg-red-500 rounded-sm" />- Detener+ <div className="flex items-center gap-2 text-red-400 text-sm font-medium">+ <div className="w-3 h-3 bg-red-500 rounded-sm group-hover:scale-110 transition-transform" />+ Detener+ </div>+ <div className="flex items-center gap-1 text-[10px] bg-red-500/10 text-red-300 px-1.5 py-0.5 rounded border border-red-500/20">+ <kbd>Alt</kbd>+ <span>+</span>+ <kbd>D</kbd>+ </div></button></div></div>@@ -72,9 +75,7 @@ export default function RecordingOverlay() {<div className="text-center"><div className="relative w-20 h-20 mb-8 mx-auto"><div className="absolute inset-0 rounded-full border-4 border-white/5" />-<div className="absolute inset-0 rounded-full border-4 border-transparent border-t-[#00A3FF] border-r-[#00A3FF]/30 animate-spin shadow-[0_0_20px_rgba(0,163,255,0.2)]" />-<div className="absolute inset-0 rounded-full bg-[#00A3FF]/5 blur-xl" /></div>@@ -91,4 +92,4 @@ export default function RecordingOverlay() {)}</div>);-}+}\ No newline at end of filediff --git a/app/components/ui/RecordingSteps.tsx b/app/components/ui/RecordingSteps.tsxindex 4d30350..7aa5ca1 100644--- a/app/components/ui/RecordingSteps.tsx+++ b/app/components/ui/RecordingSteps.tsx@@ -1,12 +1,27 @@"use client";+import { useState } from "react";import { Button } from "@/components/ui/button";import { Icon } from "@iconify/react";import StepRow from "./StepRow";import { useRecording } from "@/hooks/RecordingContext";+import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert";export default function InteractiveRecordingSteps() {const { startCountdown, stopRecording, isIdle, isRecording, isCountdown, isProcessing } = useRecording();+ const [showMobileAlert, setShowMobileAlert] = useState(false);++ const handleStartRecording = () => {+ const isMobile = typeof window !== "undefined" &&+ (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth < 768);++ if (isMobile) {+ setShowMobileAlert(true);+ setTimeout(() => setShowMobileAlert(false), 5000);+ } else {+ startCountdown();+ }+ };const getStartButtonContent = () => {if (isCountdown) {@@ -34,10 +49,15 @@ export default function InteractiveRecordingSteps() {);}return (- <>- <Icon icon="material-symbols:cast-outline-rounded" className="size-6 mr-2" />- Compartir pantalla- </>+ <div className="flex items-center gap-3">+ <Icon icon="material-symbols:cast-outline-rounded" className="size-6" />+ <span>Compartir pantalla</span>+ <div className="hidden sm:flex items-center gap-1 text-[10px] bg-white/10 text-neutral-300 px-1.5 py-0.5 rounded border border-white/5 ml-2">+ <kbd>Alt</kbd>+ <span>+</span>+ <kbd>S</kbd>+ </div>+ </div>);};@@ -52,31 +72,95 @@ export default function InteractiveRecordingSteps() {),isReversed: true,actionButton: (- <Button- variant="outline"- size="xl"- className={`text-lg ${isRecording ? 'border-red-500/50 text-red-400' : ''} ${!isIdle ? 'opacity-70 cursor-not-allowed' : ''}`}- onClick={startCountdown}- disabled={!isIdle}- >- {getStartButtonContent()}- </Button>+ <div className="flex flex-col items-center gap-4 w-full">+ <Button+ variant="outline"+ size="xl"+ className={`text-lg relative overflow-hidden ${isRecording ? 'border-red-500/50 text-red-400' : ''} ${!isIdle ? 'opacity-70 cursor-not-allowed' : ''}`}+ onClick={handleStartRecording}+ disabled={!isIdle}+ >+ {getStartButtonContent()}+ </Button>++ {showMobileAlert && (+ <Alert variant="warning" className="animate-in fade-in slide-in-from-top-2 duration-300 w-full max-w-sm text-left">+ <Icon icon="solar:laptop-minimalistic-broken" className="text-xl" />+ <AlertTitle>Usa una PC o Laptop</AlertTitle>+ <AlertDescription>+ La captura de pantalla no está soportada en celulares. Para grabar, por favor ingresa desde tu computadora.+ </AlertDescription>+ </Alert>+ )}+ </div>),visual: (- <div className="aspect-video bg-[#0A0A0A] border border-white/10 rounded-xl overflow-hidden flex items-center justify-center relative group shadow-2xl">- <div className="absolute inset-0 bg-[radial-gradient(#ffffff22_1px,transparent_1px)] [bg-size:16px_16px] opacity-10"></div>- <div className="bg-[#141414] border border-white/10 rounded-lg p-5 w-3/4 shadow-2xl relative z-10 flex flex-col">- <div className="flex gap-6 mb-4 border-b border-white/10 pb-3 text-sm text-neutral-500 font-medium">- <span className="text-white border-b border-white pb-3 -mb-3.25">Pestaña de Chrome</span>- <span>Ventana</span>- <span>Pantalla Completa</span>+ <div className="aspect-video bg-[#0A0A0A] border border-white/10 rounded-xl flex items-center justify-center relative group shadow-2xl">+ <div className="absolute inset-0 bg-[radial-linear(#ffffff22_1px,transparent_1px)] [bg-size:16px_16px] opacity-10"></div>++ <div className="bg-[#292A2D] rounded-xl w-full max-w-full shadow-2xl relative z-10 flex flex-col font-sans border border-white/5">++ <div className="flex justify-between px-4 pt-3 border-b border-white/10 text-[11px] font-medium">+ <div className="pb-2 text-neutral-400 hover:text-neutral-200 cursor-pointer flex-1 text-center transition-colors">+ Pestaña de Brave+ </div>+ <div className="pb-2 text-[#C0B4F0] border-b-2 border-[#C0B4F0] flex-1 text-center">+ Ventana+ </div>+ <div className="pb-2 text-neutral-400 hover:text-neutral-200 cursor-pointer flex-1 text-center transition-colors">+ Pantalla completa+ </div></div>- <div className="h-28 bg-white/5 rounded border border-white/10 flex items-center justify-center mb-4">- <Icon icon="solar:browser-minimalistic-linear" className="text-neutral-500 text-4xl" />++ <div className="p-5 flex gap-4 h-37.5">+ <div className="w-32.5 flex flex-col gap-2">+ <div className="w-full h-18.75 bg-[#141414] rounded-md border-2 border-[#C0B4F0] overflow-hidden shadow-inner relative transition-colors cursor-pointer">+ <div className="absolute top-2 left-2 w-full h-full bg-neutral-800 rounded-t-md border border-white/5"></div>+ </div>+ <div className="flex items-center gap-1.5 text-[10px] text-neutral-200">+ <Icon icon="logos:brave" width="12" className="shrink-0" />+ <span className="truncate">openvid - Crea tomas ci...</span>+ </div>+ </div>++ <div className="w-32.5 flex flex-col gap-2">+ <div className="w-full h-18.75 bg-[#141414] rounded-md border border-gray-500 overflow-hidden shadow-inner relative cursor-pointer">+ <div className="absolute top-1 left-1 w-[95%] h-[90%] bg-[#1E1E1E] rounded border border-white/5 flex flex-col">+ <div className="h-2 border-b border-white/5"></div>+ <div className="p-1.5 space-y-1">+ <div className="h-0.5 w-1/2 bg-blue-400/50 rounded"></div>+ <div className="h-0.5 w-3/4 bg-green-400/50 rounded"></div>+ <div className="h-0.5 w-1/3 bg-orange-400/50 rounded"></div>+ <div className="h-0.5 w-2/3 bg-blue-400/50 rounded"></div>+ </div>+ </div>+ </div>+ <div className="flex items-center gap-1.5 text-[10px] text-neutral-200">+ <Icon icon="logos:visual-studio-code" width="12" className="shrink-0" />+ <span className="truncate">RecordingSteps.tsx - op...</span>+ </div>+ </div></div>- <div className="flex justify-end gap-3 mt-auto">- <div className="px-4 py-1.5 border border-white/10 text-neutral-400 rounded text-sm">Cancelar</div>- <div className="px-4 py-1.5 bg-blue-600 text-white rounded text-sm">Compartir</div>++ <div className="px-5 pb-5">+ <div className="border-t border-white/10 pt-4 flex justify-between items-center mb-6">+ <div className="flex items-center gap-2 text-[11px] text-neutral-300">+ <Icon icon="solar:volume-loud-bold" width="14" className="text-neutral-400" />+ Compartir también el audio del sistema+ </div>+ <div className="w-7 h-4 bg-[#5F6368] rounded-full relative shadow-inner">+ <div className="absolute top-0.5 left-0.5 w-3 h-3 bg-neutral-300 rounded-full shadow"></div>+ </div>+ </div>++ <div className="flex justify-end gap-3">+ <button className="px-5 py-1.5 bg-[#3C3D3F] text-neutral-400 rounded-full text-[11px] font-medium cursor-not-allowed">+ Compartir+ </button>+ <button className="px-5 py-1.5 bg-[#292A2D] text-white rounded-full text-[11px] font-medium border border-[#C0B4F0] ring-1 ring-[#C0B4F0] ring-offset-2 ring-offset-[#292A2D] outline-none">+ Cancelar+ </button>+ </div></div></div></div>@@ -87,26 +171,41 @@ export default function InteractiveRecordingSteps() {title: "Oculta las distracciones",description: (<p>- Si decides compartir toda tu pantalla, tu navegador mostrará automáticamente una barra flotante avisando que la captura está activa. Haz clic en <strong>"Ocultar"</strong> para asegurarte de que no aparezca en tu video final.+ Al compartir tu pantalla, tu navegador mostrará automáticamente una barra flotante avisando que la captura está activa. Haz clic en <strong>"Ocultar"</strong> para asegurarte de que no aparezca en tu video final.</p>),isReversed: false,actionButton: null,visual: (<div className="aspect-video bg-[#0A0A0A] border border-white/10 rounded-xl overflow-hidden flex items-center justify-center relative group shadow-2xl">- <div className="absolute top-0 left-1/2 -translate-x-1/2 w-[300px] h-[150px] bg-blue-500/10 rounded-[100%] blur-3xl"></div>- <div className="bg-[#1E1E20] border border-white/10 rounded-full px-5 py-3 flex items-center gap-6 shadow-2xl z-10">+ <div className="absolute inset-0 bg-[radial-linear(#ffffff22_1px,transparent_1px)] [bg-size:16px_16px] opacity-10"></div>+ <div className="absolute top-0 left-1/2 -translate-x-1/2 w-75 h-37.5 bg-blue-500/5 rounded-[100%] blur-3xl"></div>++ <div className="bg-[#1C1A20] border border-white/5 rounded-full pl-4 pr-6 py-2 flex items-center gap-4 shadow-2xl z-10">+<div className="flex items-center gap-3">- <Icon icon="logos:chrome" className="text-xl" />- <span className="text-sm text-neutral-200">app.openvid.com está compartiendo tu pantalla.</span>- </div>- <div className="flex gap-4 border-l border-white/10 pl-4">- <span className="text-sm text-blue-400 font-medium cursor-pointer hover:text-blue-300">Dejar de compartir</span>- <span className="text-sm text-blue-400 font-medium cursor-pointer hover:text-white transition-colors relative group/btn">- Ocultar- <Icon icon="solar:cursor-default-bold" className="absolute -bottom-4 -right-2 text-white text-xl drop-shadow-md" />+ <Icon icon="ic:baseline-pause" className="text-white text-lg" />+ <span className="text-[11px] text-[#E8EAED]">+ https://openvid.dev está compartiendo una ventana.</span></div>++ <div className="flex items-center gap-4 ml-2">+ <button className="bg-[#B7BEF8] hover:bg-[#A6AEF7] text-[#141414] text-[11px] font-medium px-4 py-1.5 rounded-full transition-colors">+ Dejar de compartir+ </button>++ <div className="relative group/btn cursor-pointer">+ <span className="text-[#8AB4F8] text-[11px] font-medium hover:text-white transition-colors">+ Ocultar+ </span>+ <Icon+ icon="solar:cursor-default-bold"+ className="absolute -bottom-5 -right-3 text-white text-xl drop-shadow-[0_2px_4px_rgba(0,0,0,0.5)] z-20"+ />+ </div>+ </div>+</div></div>),@@ -116,21 +215,39 @@ export default function InteractiveRecordingSteps() {title: "Prepárate para la acción",description: (<p>- No hay prisa. Una vez que apruebes los permisos en el paso 1, iniciaremos una cuenta regresiva de 4 segundos. Verás el indicador en la pestaña del navegador para que sepas exactamente cuándo empezar a hablar o mover el mouse.+ No hay prisa. Una vez que apruebes los permisos en el paso 1, iniciaremos una cuenta regresiva de <strong className="text-gray-200">5 segundos</strong>. Verás el indicador en la pestaña del navegador para que sepas exactamente cuándo empezar a hablar o mover el mouse.</p>),isReversed: true,actionButton: null,visual: (- <div className="aspect-video bg-[#0A0A0A] border border-white/10 rounded-xl overflow-hidden flex flex-col items-center justify-center relative group shadow-2xl">- <div className="absolute inset-0 bg-linear-to-t from-red-500/5 via-transparent to-transparent"></div>- <div className="absolute top-6 left-6 right-6 h-10 bg-[#141414] border border-white/10 rounded-md flex items-center px-4 gap-3 shadow-lg">- <div className="w-2.5 h-2.5 rounded-full bg-red-500 animate-pulse"></div>- <span className="text-sm text-neutral-400 font-mono">🔴 Grabando en 4...</span>+ <div className="aspect-video bg-[#000B13] border border-white/10 rounded-xl overflow-hidden relative group shadow-2xl">+ <div className="absolute inset-0 bg-[#000B13]/95 backdrop-blur-md flex items-center justify-center z-10 p-6">++ <div className="flex flex-col items-center justify-center h-full w-full max-h-full">++ <div className="relative w-28 h-28 sm:w-32 sm:h-32 flex items-center justify-center shrink-0">+ <div className="absolute inset-0 rounded-full bg-[#00A3FF]/20 animate-pulse" />+ <div className="absolute inset-4 rounded-full bg-[#00A3FF]/10" />++ <div className="relative w-24 h-24 sm:w-28 sm:h-28 rounded-full bg-linear-to-br from-[#00A3FF] to-blue-800 p-0.5 shadow-[0_0_30px_rgba(0,163,255,0.2)]">+ <div className="w-full h-full rounded-full bg-[#0E0E12] flex items-center justify-center">+ <span className="text-5xl sm:text-6xl font-bold text-white tabular-nums tracking-tighter">+ 5+ </span>+ </div>+ </div>+ </div>+ <div className="text-center mt-4 sm:mt-6 flex flex-col gap-1 sm:gap-2">+ <h2 className="text-lg sm:text-xl md:text-2xl font-bold text-white tracking-tight leading-tight">+ ¡Cambia de pestaña ahora!+ </h2>+ <p className="text-xs sm:text-sm text-neutral-400 max-w-60 mx-auto leading-relaxed">+ La grabación iniciará en la pantalla que seleccionaste.+ </p>+ </div>+ </div></div>- <span className="text-[120px] font-light text-white tracking-tighter mt-12">- 4- </span></div>),},@@ -147,21 +264,45 @@ export default function InteractiveRecordingSteps() {<Buttonvariant="outline"size="xl"- className={`text-lg ${isRecording ? 'text-red-500 border-red-500/50 hover:bg-red-500/10' : 'text-neutral-500 border-neutral-500/50 cursor-not-allowed opacity-50'}`}+ className={`text-lg flex items-center ${isRecording ? 'text-red-500 border-red-500/50 hover:bg-red-500/10' : 'text-neutral-500 border-neutral-500/50 cursor-not-allowed opacity-50'}`}onClick={stopRecording}disabled={!isRecording}><div className={`w-4 h-4 rounded-sm mr-2 ${isRecording ? 'bg-red-500' : 'bg-neutral-500'}`}></div>Detener grabación+ <div className={`hidden sm:flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border ml-3 ${isRecording ? 'bg-red-500/10 text-red-300 border-red-500/20' : 'bg-neutral-500/10 text-neutral-400 border-neutral-500/20'}`}>+ <kbd>Alt</kbd>+ <span>+</span>+ <kbd>D</kbd>+ </div></Button>),visual: (- <div className="aspect-video bg-[#0A0A0A] border border-white/10 rounded-xl overflow-hidden flex items-center justify-center relative group shadow-2xl">- <div className="absolute top-1/2 left-0 w-full h-[1px] bg-white/5"></div>- <div className="absolute top-0 left-1/2 w-[1px] h-full bg-white/5"></div>- <div className="w-20 h-20 bg-red-500/10 border border-red-500/30 rounded-full flex items-center justify-center backdrop-blur-sm relative shadow-[0_0_40px_rgba(239,68,68,0.15)] z-10 group-hover:bg-red-500/20 transition-all duration-500">- <div className="absolute inset-0 rounded-full border border-red-500/50 animate-ping opacity-20"></div>- <div className="w-6 h-6 bg-red-500 rounded-sm"></div>+ <div className="aspect-video bg-[#0A0A0A] border border-white/10 rounded-xl overflow-hidden relative group shadow-2xl flex items-center justify-center">+ <div className="absolute top-1/2 left-0 w-full h-px bg-white/5"></div>+ <div className="absolute top-0 left-1/2 w-px h-full bg-white/5"></div>++ <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-auto scale-90 sm:scale-100">+ <div className="flex items-center gap-4 bg-[#1E1E20] border border-white/10 rounded-full pl-5 pr-2 py-2 shadow-2xl">+ <div className="flex items-center gap-3 pr-2 border-r border-white/10">+ <div className="w-3 h-3 rounded-full bg-red-500 animate-pulse" />+ <span className="text-[11px] text-white font-medium">Grabando</span>+ <span className="text-[11px] text-red-400 font-mono font-bold">+ 00:42+ </span>+ </div>+ <button className="group flex items-center gap-3 px-4 py-1.5 bg-red-500/10 hover:bg-red-500/20 border border-red-500/30 hover:border-red-500/50 rounded-full transition-all">+ <div className="flex items-center gap-2 text-red-400 text-sm font-medium">+ <div className="w-3 h-3 bg-red-500 rounded-sm group-hover:scale-110 transition-transform" />+ Detener+ </div>+ <div className="flex items-center gap-1 text-[10px] bg-red-500/10 text-red-300 px-1.5 py-0.5 rounded border border-red-500/20">+ <kbd>Alt</kbd>+ <span>+</span>+ <kbd>D</kbd>+ </div>+ </button>+ </div></div></div>),@@ -177,7 +318,7 @@ export default function InteractiveRecordingSteps() {cuatro sencillos pasos</span></h2>- <p className="text-lg md:text-xl text-neutral-400 font-light leading-relaxed">+ <p className="text-lg md:text-xl text-neutral-400 font-light leading-relaxed mb-8">Sigue estas instrucciones para capturar tu pantalla. Todo el proceso ocurre en tu navegador, sin necesidad de instalar nada.</p></div>diff --git a/app/components/ui/Skeleton.tsx b/app/components/ui/Skeleton.tsxindex 0312a45..78353dc 100644--- a/app/components/ui/Skeleton.tsx+++ b/app/components/ui/Skeleton.tsx@@ -399,4 +399,69 @@ export function TimelineSkeleton() {</div></div>);+}+++export function AudioMenuSkeleton() {+ return (+ <div className="p-4 flex flex-col gap-5">++ {/* Header "Audio" */}+ <div className="flex items-center gap-2">+ <Skeleton width={20} height={20} variant="circle" />+ <Skeleton height={14} width={50} />+ </div>++ {/* Audio original toggle */}+ <div className="bg-[#09090B] border border-white/5 squircle-element p-3">+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <Skeleton width={18} height={18} variant="circle" />+ <Skeleton height={12} width={90} />+ </div>+ <Skeleton height={20} width={56} variant="square" />+ </div>+ </div>++ {/* Volumen maestro slider */}+ <div className="flex items-center gap-3">+ <Skeleton width={16} height={16} variant="circle" />+ <Skeleton height={10} width={100} />+ <Skeleton height={6} className="flex-1" variant="default" />+ <Skeleton height={10} width={24} />+ </div>++ {/* Botón subir audio */}+ <div className="flex flex-col items-center gap-2">+ <Skeleton height={32} variant="square" className="w-full" />+ <Skeleton height={10} width={160} />+ </div>++ {/* Pistas skeleton (2 tracks como placeholder) */}+ <div className="flex flex-col gap-2">+ <div className="flex items-center gap-2">+ <Skeleton width={14} height={14} variant="circle" />+ <Skeleton height={10} width={140} />+ </div>+ {Array.from({ length: 2 }).map((_, i) => (+ <div+ key={i}+ className="bg-[#09090B] border border-white/5 squircle-element p-3 flex flex-col gap-2"+ >+ <div className="flex items-start justify-between gap-2">+ <div className="flex flex-col gap-1.5 flex-1 min-w-0">+ <Skeleton height={12} width="65%" />+ <Skeleton height={9} width="80%" />+ </div>+ <div className="flex items-center gap-1 shrink-0">+ <Skeleton width={28} height={28} variant="square" />+ <Skeleton width={28} height={28} variant="square" />+ </div>+ </div>+ </div>+ ))}+ </div>++ </div>+ );}\ No newline at end of filediff --git a/app/components/ui/SliderControl.tsx b/app/components/ui/SliderControl.tsxindex 1befc8e..56cede9 100644--- a/app/components/ui/SliderControl.tsx+++ b/app/components/ui/SliderControl.tsx@@ -11,9 +11,10 @@ interface SliderControlProps {max?: number;step?: number; // Step for decimal values (default: 1)onChange?: (value: number) => void;+ onChangeEnd?: () => void; // Called when dragging ends}-export function SliderControl({ icon, label, value, min = 0, max = 100, step = 1, onChange }: SliderControlProps) {+export function SliderControl({ icon, label, value, min = 0, max = 100, step = 1, onChange, onChangeEnd }: SliderControlProps) {const [isDragging, setIsDragging] = useState(false);const sliderRef = useRef<HTMLDivElement>(null);@@ -46,6 +47,7 @@ export function SliderControl({ icon, label, value, min = 0, max = 100, step = 1const handleMouseUp = () => {setIsDragging(false);+ onChangeEnd?.(); // Notify parent that dragging ended};document.addEventListener('mousemove', handleMouseMove);@@ -55,7 +57,7 @@ export function SliderControl({ icon, label, value, min = 0, max = 100, step = 1document.removeEventListener('mousemove', handleMouseMove);document.removeEventListener('mouseup', handleMouseUp);};- }, [isDragging, min, max, step, onChange]);+ }, [isDragging, min, max, step, onChange, onChangeEnd]);const displayPercentage = Math.round(((value - min) / (max - min)) * 100);diff --git a/app/components/ui/WalpaperSections.tsx b/app/components/ui/WalpaperSections.tsxindex 9911aee..8e8697d 100644--- a/app/components/ui/WalpaperSections.tsx+++ b/app/components/ui/WalpaperSections.tsx@@ -5,7 +5,8 @@ import { Icon } from "@iconify/react";import { motion, AnimatePresence } from "framer-motion";import { WALLPAPER_CATEGORIES, type WallpaperCategory, type WallpaperItem } from "@/lib/wallpaper.catalog";import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";-import { UnsplashPickerPopover } from "./UnsplashPickerPopover";+import { PhotoPickerPopover } from "./PhotoPickerPopover";+import { TooltipAction } from "@/components/ui/tooltip-action";const PREVIEW_LIMIT = 11;@@ -23,24 +24,25 @@ interface WallpaperGridProps {export function OptionsGrid({ selectedIndex = -1, onSelect, onUnsplashSelect }: WallpaperGridProps) {return (<div className="grid grid-cols-6 gap-2">- <button- onClick={() => onSelect?.(-1)}- title="Sin fondo"- className={`aspect-square squircle-element cursor-pointer transition-all flex items-center justify-center relative overflow-hidden ${selectedIndex === -1- ? "ring-2 ring-white/90 shadow-lg shadow-black/40"- : "hover:ring-2 ring-white/60"- }`}- style={{- backgroundImage:- "linear-gradient(45deg,#444 25%,transparent 25%),linear-gradient(-45deg,#444 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#444 75%),linear-gradient(-45deg,transparent 75%,#444 75%)",- backgroundSize: "12px 12px",- backgroundPosition: "0 0,0 6px,6px -6px,-6px 0",- backgroundColor: "#ccc",- }}- >- </button>+ <TooltipAction label="Sin fondo">+ <button+ onClick={() => onSelect?.(-1)}+ className={`aspect-square squircle-element cursor-pointer transition-all flex items-center justify-center relative overflow-hidden ${selectedIndex === -1+ ? "ring-2 ring-white/90 shadow-lg shadow-black/40"+ : "hover:ring-2 ring-white/60"+ }`}+ style={{+ backgroundImage:+ "linear-gradient(45deg,#444 25%,transparent 25%),linear-gradient(-45deg,#444 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#444 75%),linear-gradient(-45deg,transparent 75%,#444 75%)",+ backgroundSize: "12px 12px",+ backgroundPosition: "0 0,0 6px,6px -6px,-6px 0",+ backgroundColor: "#ccc",+ }}+ >+ </button>+ </TooltipAction>- <UnsplashPickerPopover onSelect={(url) => onUnsplashSelect?.(url)} />+ <PhotoPickerPopover onSelect={(url) => onUnsplashSelect?.(url)} /></div>);}@@ -66,6 +68,38 @@ function WallpaperThumb({);}+function WallpaperThumbProgressive({+ item,+ isSelected,+ onSelect,+}: {+ item: WallpaperItem;+ isSelected: boolean;+ onSelect?: (index: number) => void;+}) {+ const [isLoaded, setIsLoaded] = useState(false);++ return (+ <button+ onClick={() => onSelect?.(item.index)}+ className={`aspect-square squircle-element cursor-pointer transition-all bg-cover bg-center border overflow-hidden relative ${isSelected+ ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50"+ : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"+ }`}+ >+ <img+ src={item.previewUrl}+ alt={item.filename}+ decoding="async"+ loading="lazy"+ onLoad={() => setIsLoaded(true)}+ className={`w-full h-full object-cover transition-all duration-500 ease-out ${isLoaded ? "opacity-100 blur-none scale-100" : "opacity-0 blur-sm scale-105"+ }`}+ />+ </button>+ );+}+function CategoryPopover({category,selectedIndex,@@ -79,24 +113,24 @@ function CategoryPopover({return (<Popover open={open} onOpenChange={setOpen}>- <PopoverTrigger asChild>- <button- className="aspect-square rounded-lg border border-white/10 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"- title={`Ver más de ${category.label}`}- >- <Icon- icon="ph:plus-bold"- width="16"- className="text-blue-400 group-hover:text-blue-300 transition-colors"- />- </button>- </PopoverTrigger>-+ <TooltipAction label={`Ver más de ${category.label}`}>+ <PopoverTrigger asChild>+ <button+ className="aspect-square rounded-lg border border-white/10 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"+ >+ <Icon+ icon="ph:plus-bold"+ width="16"+ className="text-blue-400 group-hover:text-blue-300 transition-colors"+ />+ </button>+ </PopoverTrigger>+ </TooltipAction><PopoverContentside="right"align="start"sideOffset={12}- className="w-72 p-0 border-0 shadow-2xl"+ className="w-126 p-0 border-0 shadow-2xl"><div className="flex flex-col bg-[#111113] border border-white/10 rounded-xl overflow-hidden shadow-2xl"><div className="flex items-center gap-2 px-4 py-3 border-b border-white/10 bg-white/2">@@ -109,17 +143,13 @@ function CategoryPopover({</span></div>- <div className="p-3 grid grid-cols-4 gap-2 max-h-80 overflow-y-auto custom-scrollbar">+ <div className="p-3 grid grid-cols-8 gap-2 max-h-80 overflow-y-auto custom-scrollbar">{category.items.slice(PREVIEW_LIMIT).map((item) => (- <button+ <WallpaperThumbProgressivekey={item.index}- onClick={() => { onSelect?.(item.index); setOpen(false); }}- title={item.filename}- className={`aspect-square rounded-lg cursor-pointer transition-all bg-cover bg-center border ${selectedIndex === item.index- ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50"- : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"- }`}- style={{ backgroundImage: `url('${item.previewUrl}')` }}+ item={item}+ isSelected={selectedIndex === item.index}+ onSelect={onSelect}/>))}</div>@@ -148,10 +178,11 @@ function PrimaryCategoryGrid({</div>);}-function SecondaryCategoryGrid({category, selectedIndex, onSelect,}: { category: WallpaperCategory; selectedIndex: number; onSelect?: (index: number) => void; }) {+ const visible = category.items.slice(0, PREVIEW_LIMIT);+return (<motion.divinitial={{ opacity: 0, height: 0, marginTop: 0 }}@@ -165,9 +196,12 @@ function SecondaryCategoryGrid({<span>{category.label}</span></div><div className="grid grid-cols-6 gap-2">- {category.items.map((item) => (+ {visible.map((item) => (<WallpaperThumb key={item.index} item={item} isSelected={selectedIndex === item.index} onSelect={onSelect} />))}+ {category.items.length > PREVIEW_LIMIT && (+ <CategoryPopover category={category} selectedIndex={selectedIndex} onSelect={onSelect} />+ )}</div></motion.div>);diff --git a/app/components/ui/editor/AudioFragmentTrackItem.tsx b/app/components/ui/editor/AudioFragmentTrackItem.tsxindex f1532f7..b2fd230 100644--- a/app/components/ui/editor/AudioFragmentTrackItem.tsx+++ b/app/components/ui/editor/AudioFragmentTrackItem.tsx@@ -3,9 +3,7 @@import { useState, useRef, useCallback, useMemo, useEffect } from "react";import { motion, useMotionValue } from "framer-motion";import type { AudioTrack, UploadedAudio } from "@/types/audio.types";-import { Icon } from "@iconify/react";-// Minimum fragment duration in secondsconst MIN_FRAGMENT_DURATION = 0.1;interface AudioFragmentTrackItemProps {@@ -39,7 +37,6 @@ export function AudioFragmentTrackItem({const [isResizing, setIsResizing] = useState<'start' | 'end' | null>(null);const containerRef = useRef<HTMLDivElement>(null);- // Motion values for smooth animationsconst fragmentX = useMotionValue(0);const fragmentWidth = useMotionValue(0);@@ -61,9 +58,10 @@ export function AudioFragmentTrackItem({}}, [initialLeft, initialWidth, isDragging, isResizing, fragmentX, fragmentWidth]);- // Find boundaries - can't overlap with other fragmentsconst boundaries = useMemo(() => {- const sorted = [...otherTracks].sort((a, b) => a.startTime - b.startTime);+ const sorted = [...otherTracks]+ .filter(t => t.id !== track.id) // defensive: excluye el propio track+ .sort((a, b) => a.startTime - b.startTime);let minStart = 0;let maxEnd = videoDuration;@@ -71,7 +69,7 @@ export function AudioFragmentTrackItem({for (const other of sorted) {const otherEnd = other.startTime + other.duration;const trackEnd = track.startTime + track.duration;-+if (otherEnd <= track.startTime) {minStart = Math.max(minStart, otherEnd);}@@ -82,14 +80,13 @@ export function AudioFragmentTrackItem({}return { minStart, maxEnd };- }, [otherTracks, track.startTime, track.duration, videoDuration]);+ }, [otherTracks, track.id, track.startTime, track.duration, videoDuration]);- // Handle drag (move entire fragment)- const handleDrag = useCallback((e: MouseEvent | TouchEvent | PointerEvent, info: { delta: { x: number } }) => {+ // ── Drag (mover fragmento completo) ──────────────────────────────+ const handleDrag = useCallback((_e: MouseEvent | TouchEvent | PointerEvent, info: { delta: { x: number } }) => {if (contentWidth === 0 || videoDuration === 0) return;const currentX = fragmentX.get();-let newX = currentX + info.delta.x;const minX = timeToPixels(boundaries.minStart);@@ -109,14 +106,12 @@ export function AudioFragmentTrackItem({onDragStateChange?.(false);const newStartTime = pixelsToTime(fragmentX.get());-onUpdate({startTime: Math.max(0, Math.min(videoDuration - track.duration, newStartTime)),});}, [fragmentX, pixelsToTime, track.duration, videoDuration, onUpdate, onDragStateChange]);- // Handle resize from start- const handleResizeStartDrag = useCallback((e: MouseEvent | TouchEvent | PointerEvent, info: { delta: { x: number } }) => {+ const handleResizeStartDrag = useCallback((_e: MouseEvent | TouchEvent | PointerEvent, info: { delta: { x: number } }) => {if (contentWidth === 0 || videoDuration === 0) return;const currentX = fragmentX.get();@@ -131,44 +126,38 @@ export function AudioFragmentTrackItem({newX = currentX + currentWidth - minWidth;}- // Clamp to boundaries (can't go before minStart)const minX = timeToPixels(boundaries.minStart);if (newX < minX) {- const diff = minX - newX;+ newWidth = newWidth - (minX - newX);newX = minX;- newWidth = currentWidth - diff;}- // Don't let duration exceed original audio duration- if (audio && newWidth > timeToPixels(audio.duration)) {- const diff = newWidth - timeToPixels(audio.duration);- newX = currentX + diff;- newWidth = timeToPixels(audio.duration);+ if (audio) {+ const maxWidth = timeToPixels(audio.duration);+ if (newWidth > maxWidth) {+ const diff = newWidth - maxWidth;+ newX = newX + diff;+ newWidth = maxWidth;+ }}fragmentX.set(newX);fragmentWidth.set(newWidth);}, [contentWidth, videoDuration, fragmentX, fragmentWidth, boundaries, timeToPixels, audio]);- // Handle resize from end- const handleResizeEndDrag = useCallback((e: MouseEvent | TouchEvent | PointerEvent, info: { delta: { x: number } }) => {+ const handleResizeEndDrag = useCallback((_e: MouseEvent | TouchEvent | PointerEvent, info: { delta: { x: number } }) => {if (contentWidth === 0 || videoDuration === 0) return;+ const currentX = fragmentX.get();const currentWidth = fragmentWidth.get();-- // Calculate new widthlet newWidth = currentWidth + info.delta.x;- // Enforce minimum durationconst minWidth = timeToPixels(MIN_FRAGMENT_DURATION);newWidth = Math.max(minWidth, newWidth);- // Clamp to boundaries (can't go past maxEnd)- const currentX = fragmentX.get();const maxWidth = timeToPixels(boundaries.maxEnd) - currentX;newWidth = Math.min(newWidth, maxWidth);- // Don't let duration exceed original audio durationif (audio) {newWidth = Math.min(newWidth, timeToPixels(audio.duration));}@@ -185,99 +174,80 @@ export function AudioFragmentTrackItem({setIsResizing(null);onDragStateChange?.(false);- // Update track with new boundsconst newStartTime = pixelsToTime(fragmentX.get());const newDuration = pixelsToTime(fragmentWidth.get());onUpdate({startTime: Math.max(0, newStartTime),- duration: Math.min(audio?.duration || videoDuration, newDuration),+ duration: Math.min(audio?.duration ?? videoDuration, newDuration),});}, [fragmentX, fragmentWidth, pixelsToTime, audio, videoDuration, onUpdate, onDragStateChange]);const isInteracting = isDragging || isResizing !== null;const exceedsVideoDuration = track.startTime + track.duration > videoDuration;+ const [isHovered, setIsHovered] = useState(false);return (<motion.divref={containerRef}- className={`absolute top-[10%] h-[80%] rounded cursor-move transition-colors flex items-center justify-center overflow-hidden ${- isSelected- ? 'bg-purple-600/30 border-2 border-purple-400'- : 'bg-purple-600/20 border border-purple-400/40 hover:border-purple-400/60'- } ${isInteracting ? 'z-10' : 'z-0'}`}+ className={`absolute top-1/2 -translate-y-1/2 h-1.5 rounded-full cursor-grab active:cursor-grabbing transition-colors ${isSelected+ ? 'bg-white shadow-[0_0_15px_rgba(255,255,255,0.5)] z-10'+ : 'bg-white/20 backdrop-blur-sm border border-white/10 hover:bg-white/30'+ } ${isInteracting ? 'z-10' : 'z-0'}`}style={{ x: fragmentX, width: fragmentWidth }}drag="x"+ dragConstraints={{ left: 0, right: contentWidth }}dragElastic={0}dragMomentum={false}onDrag={handleDrag}onDragStart={handleDragStart}onDragEnd={handleDragEnd}- onClick={(e) => {- e.stopPropagation();- onSelect();- }}+ onHoverStart={() => setIsHovered(true)}+ onHoverEnd={() => setIsHovered(false)}+ onClick={(e) => { e.stopPropagation(); onSelect(); }}onMouseEnter={onMouseEnter}onMouseLeave={onMouseLeave}>- {/* Audio waveform visual */}- <div className="absolute inset-0 flex items-center justify-center gap-0.5 px-1 opacity-30">- {Array.from({ length: 12 }).map((_, i) => (- <div- key={i}- className="w-0.5 bg-purple-300 rounded-full"- style={{- height: `${30 + Math.sin(i * 0.7) * 20 + (i % 3) * 5}%`,- }}- />- ))}- </div>-- {/* Icon and info */}- <div className="relative z-10 flex flex-col items-center gap-0.5 pointer-events-none">- <Icon icon="ph:waveform-bold" width="12" height="12" className="text-purple-300" />- <span className="text-[8px] font-mono text-purple-300/80 max-w-full truncate px-1">- {audio?.name || 'Audio'}- </span>- {track.loop && (- <Icon icon="ph:repeat-bold" width="8" height="8" className="text-purple-300/60" />- )}- {exceedsVideoDuration && (- <Icon icon="ph:warning-bold" width="8" height="8" className="text-yellow-400" />- )}+ <div className="absolute inset-0 flex items-center justify-center pointer-events-none">+ <div className={`flex items-center gap-[1.5px] px-1.5 h-full ${isSelected ? 'bg-white' : ''}`}>+ <div className={`w-[1.5px] h-2 rounded-full ${isSelected ? 'bg-sky-400' : 'bg-white/60'}`} />+ <div className={`w-[1.5px] h-3 rounded-full ${isSelected ? 'bg-sky-400' : 'bg-white/60'}`} />+ <div className={`w-[1.5px] h-1.5 rounded-full ${isSelected ? 'bg-sky-400' : 'bg-white/60'}`} />+ </div></div>- {/* Resize handle - Start */}<motion.div- className={`absolute left-0 top-0 bottom-0 w-2 cursor-ew-resize z-20 group/resize flex items-center justify-center ${- isResizing === 'start' ? 'bg-purple-400/50' : 'hover:bg-purple-400/30'- }`}+ className="absolute left-0 top-1/2 -translate-y-1/2 w-2 h-3 cursor-ew-resize z-20 flex items-center justify-center"+ animate={{ opacity: isHovered || isResizing === 'start' ? 1 : 0 }}+ transition={{ duration: 0.15 }}drag="x"+ dragConstraints={{ left: 0, right: 0 }}dragElastic={0}dragMomentum={false}onDrag={handleResizeStartDrag}- onDragStart={() => handleResizeStart('start')}+ onDragStart={(e) => { e.stopPropagation(); handleResizeStart('start'); }}onDragEnd={handleResizeEnd}onClick={(e) => e.stopPropagation()}>- <div className="w-0.5 h-4 bg-purple-300 rounded-full" />+ <div className="w-1 h-4 bg-white rounded-full shadow-sm border border-gray-200" /></motion.div>- {/* Resize handle - End */}<motion.div- className={`absolute right-0 top-0 bottom-0 w-2 cursor-ew-resize z-20 group/resize flex items-center justify-center ${- isResizing === 'end' ? 'bg-purple-400/50' : 'hover:bg-purple-400/30'- }`}+ className="absolute right-0 top-1/2 -translate-y-1/2 w-2 h-3 cursor-ew-resize z-20 flex items-center justify-center"+ animate={{ opacity: isHovered || isResizing === 'end' ? 1 : 0 }}+ transition={{ duration: 0.15 }}drag="x"+ dragConstraints={{ left: 0, right: 0 }}dragElastic={0}dragMomentum={false}onDrag={handleResizeEndDrag}- onDragStart={() => handleResizeStart('end')}+ onDragStart={(e) => { e.stopPropagation(); handleResizeStart('end'); }}onDragEnd={handleResizeEnd}onClick={(e) => e.stopPropagation()}>- <div className="w-0.5 h-4 bg-purple-300 rounded-full" />+ <div className="w-1 h-4 bg-white rounded-full shadow-sm border border-gray-200" /></motion.div></motion.div>+);-}+}\ No newline at end of filediff --git a/app/components/ui/editor/AudioMenu.tsx b/app/components/ui/editor/AudioMenu.tsxindex deed1de..7c12c04 100644--- a/app/components/ui/editor/AudioMenu.tsx+++ b/app/components/ui/editor/AudioMenu.tsx@@ -1,19 +1,20 @@"use client";import { Icon } from "@iconify/react";-import { useCallback, useRef, useState } from "react";-import type { UploadedAudio, AudioTrack } from "@/types/audio.types";+import { useCallback, useRef, useState, useEffect } from "react";+import type { AudioTrack, UploadedAudio } from "@/types/audio.types";import { SliderControl } from "../SliderControl";+import { AudioTrimModal } from "./AudioTrimModal";+import { Button } from "@/components/ui/button";+import { TooltipAction } from "@/components/ui/tooltip-action";interface AudioMenuProps {- uploadedAudios: UploadedAudio[];audioTracks: AudioTrack[];+ uploadedAudios: UploadedAudio[];muteOriginalAudio: boolean;masterVolume: number;videoDuration: number;onAudioUpload: (file: File) => void;- onAudioDelete: (audioId: string) => void;- onAddAudioTrack: (audioId: string) => void;onUpdateAudioTrack: (trackId: string, updates: Partial<AudioTrack>) => void;onDeleteAudioTrack: (trackId: string) => void;onToggleMuteOriginalAudio: () => void;@@ -21,15 +22,43 @@ interface AudioMenuProps {videoHasAudioTrack?: boolean;}+// Dentro de AudioMenu, antes del return principal+function TrackVolumeSlider({ track, onUpdateAudioTrack }: {+ track: AudioTrack;+ onUpdateAudioTrack: (id: string, updates: Partial<AudioTrack>) => void;+}) {+ const [internalVolume, setInternalVolume] = useState(track.volume * 100);++ useEffect(() => {+ const externalValue = track.volume * 100;+ if (Math.abs(internalVolume - externalValue) > 1) {+ setInternalVolume(externalValue);+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [track.volume]);++ return (+ <SliderControl+ icon="mdi:volume-medium"+ label="Volumen"+ value={internalVolume}+ min={0}+ max={100}+ onChange={(value: number) => {+ setInternalVolume(value);+ onUpdateAudioTrack(track.id, { volume: value / 100 });+ }}+ />+ );+}+export function AudioMenu({- uploadedAudios,audioTracks,+ uploadedAudios,muteOriginalAudio,masterVolume,videoDuration,onAudioUpload,- onAudioDelete,- onAddAudioTrack,onUpdateAudioTrack,onDeleteAudioTrack,onToggleMuteOriginalAudio,@@ -38,12 +67,22 @@ export function AudioMenu({}: AudioMenuProps) {const fileInputRef = useRef<HTMLInputElement>(null);const [selectedTrackId, setSelectedTrackId] = useState<string | null>(null);+ const [trimModalOpen, setTrimModalOpen] = useState(false);+ const [trimModalTrack, setTrimModalTrack] = useState<AudioTrack | null>(null);+ const [internalMasterVolume, setInternalMasterVolume] = useState(masterVolume * 100);++ useEffect(() => {+ const externalValue = masterVolume * 100;+ if (Math.abs(internalMasterVolume - externalValue) > 1) {+ setInternalMasterVolume(externalValue);+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [masterVolume]);const handleFileSelect = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {const file = e.target.files?.[0];if (!file) return;- // Validate file typeconst SUPPORTED_AUDIO_FORMATS = ['audio/mpeg', 'audio/mp3', 'audio/wav', 'audio/wave','audio/x-wav', 'audio/ogg', 'audio/aac', 'audio/m4a', 'audio/x-m4a'@@ -55,16 +94,14 @@ export function AudioMenu({return;}- // Validate file size (50MB)- const MAX_AUDIO_FILE_SIZE = 50 * 1024 * 1024;+ const MAX_AUDIO_FILE_SIZE = 10 * 1024 * 1024;if (file.size > MAX_AUDIO_FILE_SIZE) {- alert("El archivo es demasiado grande. El tamaño máximo es 50MB.");+ alert("El archivo es demasiado grande. El tamaño máximo es 10MB.");return;}onAudioUpload(file);- // Reset inputif (fileInputRef.current) {fileInputRef.current.value = "";}@@ -76,28 +113,55 @@ export function AudioMenu({return `${mins}:${secs.toString().padStart(2, '0')}`;};- const formatFileSize = (bytes: number) => {- if (bytes < 1024) return `${bytes} B`;- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;- };+ const [isDragOver, setIsDragOver] = useState(false);++ const handleDragOver = useCallback((e: React.DragEvent) => {+ e.preventDefault();+ setIsDragOver(true);+ }, []);++ const handleDragLeave = useCallback((e: React.DragEvent) => {+ e.preventDefault();+ setIsDragOver(false);+ }, []);++ const handleDrop = useCallback((e: React.DragEvent) => {+ e.preventDefault();+ setIsDragOver(false);+ const file = e.dataTransfer.files?.[0];+ if (!file) return;++ const SUPPORTED_AUDIO_FORMATS = [+ 'audio/mpeg', 'audio/mp3', 'audio/wav', 'audio/wave',+ 'audio/x-wav', 'audio/ogg', 'audio/aac', 'audio/m4a', 'audio/x-m4a'+ ];+ if (!SUPPORTED_AUDIO_FORMATS.includes(file.type) &&+ !['.mp3', '.wav', '.ogg', '.aac', '.m4a'].some(ext => file.name.toLowerCase().endsWith(ext))) {+ alert("Formato de audio no soportado. Por favor usa MP3, WAV, OGG, AAC o M4A.");+ return;+ }+ const MAX_AUDIO_FILE_SIZE = 10 * 1024 * 1024;+ if (file.size > MAX_AUDIO_FILE_SIZE) {+ alert("El archivo es demasiado grande. El tamaño máximo es 10MB.");+ return;+ }+ onAudioUpload(file);+ }, [onAudioUpload]);return (<div className="p-4 flex flex-col gap-5">- {/* Header */}<div className="flex items-center gap-2 text-white font-medium">- <Icon icon="mdi:music-note" width="20" />+ <Icon icon="mdi:volume-high" width="20" /><span>Audio</span></div>- {/* Mute Original Audio Toggle */}<div className="bg-[#09090B] border border-white/5 squircle-element p-3"><buttononClick={onToggleMuteOriginalAudio}disabled={!videoHasAudioTrack}className={`w-full flex items-center justify-between text-sm transition-colors ${!videoHasAudioTrack- ? "opacity-40 cursor-not-allowed text-white/40"- : "text-white/80 hover:text-white"+ ? "opacity-40 cursor-not-allowed text-white/40"+ : "text-white/80 hover:text-white"}`}><div className="flex items-center gap-2"><Icon@@ -116,18 +180,25 @@ export function AudioMenu({</button></div>- {/* Master Volume */}<SliderControlicon="mdi:volume-medium"label="Volumen maestro"- value={masterVolume * 100}+ value={internalMasterVolume}min={0}max={100}- onChange={(value: number) => onMasterVolumeChange(value / 100)}+ onChange={(value: number) => {+ setInternalMasterVolume(value);+ onMasterVolumeChange(value / 100);+ }}/>- {/* Upload Audio Button */}- <div>+ <div+ className={`flex flex-col items-center justify-center w-full rounded-lg transition-colors ${isDragOver ? "bg-blue-500/10 ring-1 ring-blue-500/40" : ""+ }`}+ onDragOver={handleDragOver}+ onDragLeave={handleDragLeave}+ onDrop={handleDrop}+ ><inputref={fileInputRef}type="file"@@ -135,69 +206,19 @@ export function AudioMenu({onChange={handleFileSelect}className="hidden"/>- <button+ <Button+ variant="outline"+ className="w-full text-xs"onClick={() => fileInputRef.current?.click()}- className="w-full bg-blue-500 hover:bg-blue-600 text-white py-2.5 px-4 rounded-lg font-medium text-sm transition-all duration-200 flex items-center justify-center gap-2">- <Icon icon="mdi:upload" width="18" />- Subir audio- </button>+ <Icon icon="mdi:upload" width="14" />+ <span>Subir audio</span>+ </Button><p className="text-xs text-white/40 mt-2 text-center">- MP3, WAV, OGG, AAC, M4A (max 50MB)+ MP3, WAV, OGG, AAC, M4A (max 10MB)</p></div>- {/* Uploaded Audios Library */}- {uploadedAudios.length > 0 && (- <div className="flex flex-col gap-2">- <div className="text-xs font-medium text-white/60 flex items-center gap-2">- <Icon icon="mdi:folder-music" width="14" />- <span>BIBLIOTECA DE AUDIO ({uploadedAudios.length})</span>- </div>- <div className="flex flex-col gap-2 max-h-[300px] overflow-y-auto custom-scrollbar">- {uploadedAudios.map((audio) => {- const isInTimeline = audioTracks.some(track => track.audioId === audio.id);- return (- <div- key={audio.id}- className="bg-[#09090B] border border-white/5 squircle-element p-3 hover:border-white/10 transition-all"- >- <div className="flex items-start justify-between gap-2 mb-2">- <div className="flex-1 min-w-0">- <div className="text-sm text-white font-medium truncate">- {audio.name}- </div>- <div className="text-xs text-white/40 mt-0.5">- {formatDuration(audio.duration)} • {formatFileSize(audio.fileSize)}- </div>- </div>- <button- onClick={() => onAudioDelete(audio.id)}- className="p-1.5 rounded text-white/40 hover:text-red-400 hover:bg-red-500/10 transition-all"- title="Eliminar audio"- >- <Icon icon="mdi:delete" width="16" />- </button>- </div>- <button- onClick={() => onAddAudioTrack(audio.id)}- disabled={isInTimeline}- className={`w-full py-1.5 px-3 rounded text-xs font-medium transition-all flex items-center justify-center gap-1.5 ${isInTimeline- ? "bg-white/5 text-white/30 cursor-not-allowed"- : "bg-blue-500/20 text-blue-400 hover:bg-blue-500/30"- }`}- >- <Icon icon={isInTimeline ? "mdi:check" : "mdi:plus"} width="14" />- {isInTimeline ? "En línea de tiempo" : "Añadir a línea de tiempo"}- </button>- </div>- );- })}- </div>- </div>- )}-- {/* Audio Tracks in Timeline */}{audioTracks.length > 0 && (<div className="flex flex-col gap-2"><div className="text-xs font-medium text-white/60 flex items-center gap-2">@@ -206,9 +227,6 @@ export function AudioMenu({</div><div className="flex flex-col gap-2">{audioTracks.map((track) => {- const audio = uploadedAudios.find(a => a.id === track.audioId);- if (!audio) return null;-const isSelected = selectedTrackId === track.id;const exceedsVideoDuration = (track.startTime + track.duration) > videoDuration;@@ -224,10 +242,10 @@ export function AudioMenu({<div className="flex items-start justify-between gap-2 mb-2"><div className="flex-1 min-w-0"><div className="text-sm text-white font-medium truncate">- {audio.name}+ {track.name}</div><div className="text-xs text-white/40 mt-0.5">- Inicio: {formatDuration(track.startTime)}+ Inicio: {formatDuration(track.startTime)} • Duración: {formatDuration(track.duration)}</div>{exceedsVideoDuration && (<div className="text-xs text-orange-400 mt-1 flex items-center gap-1">@@ -236,50 +254,42 @@ export function AudioMenu({</div>)}</div>- <button- onClick={(e) => {- e.stopPropagation();- onDeleteAudioTrack(track.id);- if (selectedTrackId === track.id) {- setSelectedTrackId(null);- }- }}- className="p-1.5 rounded text-white/40 hover:text-red-400 hover:bg-red-500/10 transition-all"- title="Quitar de línea de tiempo"- >- <Icon icon="mdi:close" width="16" />- </button>- </div>-- {isSelected && (- <div className="flex flex-col gap-3 pt-2 border-t border-white/5 animate-in fade-in duration-150">- <SliderControl- icon="mdi:volume-medium"- label="Volumen"- value={track.volume * 100}- min={0}- max={100}- onChange={(value: number) => onUpdateAudioTrack(track.id, { volume: value / 100 })}- />-- <div className="flex items-center justify-between">- <label className="text-xs text-white/60 flex items-center gap-1.5">- <Icon icon="mdi:repeat" width="14" />- Repetir- </label>+ <div className="flex items-center gap-1">+ <TooltipAction label="Recortar audio"><buttononClick={(e) => {e.stopPropagation();- onUpdateAudioTrack(track.id, { loop: !track.loop });+ setTrimModalTrack(track);+ setTrimModalOpen(true);}}- className={`px-2.5 py-1 rounded text-xs font-medium transition-all ${track.loop- ? "bg-blue-500/20 text-blue-400"- : "bg-white/5 text-white/40 hover:bg-white/10"- }`}+ className="p-1.5 rounded text-white/40 hover:text-blue-400 hover:bg-blue-500/10 transition-all">- {track.loop ? "Activado" : "Desactivado"}+ <Icon icon="mdi:content-cut" width="16" /></button>- </div>+ </TooltipAction>+ <TooltipAction label="Eliminar audio">+ <button+ onClick={(e) => {+ e.stopPropagation();+ onDeleteAudioTrack(track.id);+ if (selectedTrackId === track.id) {+ setSelectedTrackId(null);+ }+ }}+ className="p-1.5 rounded text-white/40 hover:text-red-400 hover:bg-red-500/10 transition-all"+ >+ <Icon icon="material-symbols:delete-outline-rounded" width="16" />+ </button>+ </TooltipAction>+ </div>+ </div>++ {isSelected && (+ <div className="flex flex-col gap-3 pt-2 border-t border-white/5 animate-in fade-in duration-150">+ <TrackVolumeSlider+ track={track}+ onUpdateAudioTrack={onUpdateAudioTrack}+ /></div>)}</div>@@ -289,13 +299,41 @@ export function AudioMenu({</div>)}- {uploadedAudios.length === 0 && (+ {audioTracks.length === 0 && (<div className="text-center py-8 px-4 text-white/40"><Icon icon="mdi:music-note-off" width="48" className="mx-auto mb-3 opacity-30" />- <p className="text-sm">No hay audios subidos</p>- <p className="text-xs mt-1">Sube un archivo de audio para comenzar</p>+ <p className="text-sm">No hay pistas de audio</p>+ <p className="text-xs mt-1">Sube un archivo de audio para añadirlo automáticamente a la línea de tiempo</p></div>)}+ {trimModalOpen && trimModalTrack && (() => {+ const originalAudio = uploadedAudios.find(a => a.id === trimModalTrack.audioId);+ if (!originalAudio) return null;++ return (+ <AudioTrimModal+ key={trimModalTrack.id}+ isOpen={trimModalOpen}+ audioName={trimModalTrack.name}+ audioUrl={originalAudio.url}+ audioDuration={originalAudio.duration}+ initialTrimStart={trimModalTrack.trimStart ?? 0}+ initialTrimEnd={(trimModalTrack.trimStart ?? 0) + trimModalTrack.duration}+ onConfirm={(trimStart, trimEnd) => {+ onUpdateAudioTrack(trimModalTrack.id, {+ duration: trimEnd - trimStart,+ trimStart: trimStart,+ });+ setTrimModalOpen(false);+ setTrimModalTrack(null);+ }}+ onCancel={() => {+ setTrimModalOpen(false);+ setTrimModalTrack(null);+ }}+ />+ );+ })()}</div>);}\ No newline at end of filediff --git a/app/components/ui/editor/AudioTrimModal.tsx b/app/components/ui/editor/AudioTrimModal.tsxnew file mode 100644index 0000000..dd00e38--- /dev/null+++ b/app/components/ui/editor/AudioTrimModal.tsx@@ -0,0 +1,389 @@+"use client";++import { useState, useRef, useEffect, useCallback } from "react";+import { Button } from "@/components/ui/button";+import { Icon } from "@iconify/react";+import { motion, useMotionValue, PanInfo } from "framer-motion";++interface AudioTrimModalProps {+ isOpen: boolean;+ audioName: string;+ audioUrl: string;+ audioDuration: number;+ initialTrimStart?: number;+ initialTrimEnd?: number;+ onConfirm: (trimStart: number, trimEnd: number) => void;+ onCancel: () => void;+}++export function AudioTrimModal({+ isOpen,+ audioName,+ audioUrl,+ audioDuration,+ initialTrimStart = 0,+ initialTrimEnd,+ onConfirm,+ onCancel,+}: AudioTrimModalProps) {+ const [trimStart, setTrimStart] = useState(initialTrimStart);+ const [trimEnd, setTrimEnd] = useState(initialTrimEnd ?? audioDuration);+ const [isDragging, setIsDragging] = useState(false);++ const trackRef = useRef<HTMLDivElement>(null);+ const audioRef = useRef<HTMLAudioElement | null>(null);+ const playbackTimeoutRef = useRef<NodeJS.Timeout | null>(null);+ const isPlayingRef = useRef(false);++ const trimStartX = useMotionValue(0);+ const trimEndX = useMotionValue(0);++ const waveformHeights = useState(() =>+ Array.from({ length: 60 }, () => Math.random() * 60 + 20)+ )[0];+ const trimmedWaveformHeights = useState(() =>+ Array.from({ length: 40 }, () => Math.random() * 60 + 20)+ )[0];++ useEffect(() => {+ if (!isOpen || !audioUrl) return;+ const audio = new Audio(audioUrl);+ audioRef.current = audio;+ return () => {+ if (playbackTimeoutRef.current) clearTimeout(playbackTimeoutRef.current);+ audio.pause();+ audio.src = '';+ audioRef.current = null;+ isPlayingRef.current = false;+ };+ }, [isOpen, audioUrl]);++ useEffect(() => {+ return () => {+ if (playbackTimeoutRef.current) clearTimeout(playbackTimeoutRef.current);+ };+ }, []);++ const trackWidth = useCallback(() => {+ return trackRef.current?.getBoundingClientRect().width ?? 0;+ }, []);++ const timeToPixels = useCallback((time: number) => {+ const w = trackWidth();+ if (!w) return 0;+ return (time / audioDuration) * w;+ }, [audioDuration, trackWidth]);++ const pixelsToTime = useCallback((pixels: number) => {+ const w = trackWidth();+ if (!w) return 0;+ return (pixels / w) * audioDuration;+ }, [audioDuration, trackWidth]);++ const playPreviewFrom = useCallback((fromTime: number, previewDuration: number) => {+ const audio = audioRef.current;+ if (!audio) return;++ if (playbackTimeoutRef.current) {+ clearTimeout(playbackTimeoutRef.current);+ playbackTimeoutRef.current = null;+ }+ if (isPlayingRef.current) {+ audio.pause();+ isPlayingRef.current = false;+ }++ audio.currentTime = Math.max(0, fromTime);+ const playPromise = audio.play();+ if (playPromise !== undefined) {+ isPlayingRef.current = true;+ playPromise+ .then(() => {+ playbackTimeoutRef.current = setTimeout(() => {+ audio.pause();+ isPlayingRef.current = false;+ }, previewDuration * 1000);+ })+ .catch(() => { isPlayingRef.current = false; });+ }+ }, []);++ useEffect(() => {+ if (isDragging) return;+ const timer = setTimeout(() => {+ trimStartX.set(timeToPixels(trimStart));+ trimEndX.set(timeToPixels(trimEnd));+ }, isOpen ? 200 : 0);+ return () => clearTimeout(timer);+ }, [trimStart, trimEnd, isDragging, timeToPixels, trimStartX, trimEndX, isOpen]);++ useEffect(() => {+ if (!isOpen) return;+ const raf = requestAnimationFrame(() => {+ setTimeout(() => {+ playPreviewFrom(initialTrimStart, (initialTrimEnd ?? audioDuration) - initialTrimStart);+ }, 100);+ });+ return () => cancelAnimationFrame(raf);+ }, [isOpen]);++ const handleTrimStartDrag = useCallback((_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {+ if (!trackRef.current) return;+ let newX = trimStartX.get() + info.delta.x;+ const minX = 0;+ const maxX = trimEndX.get() - timeToPixels(0.1);+ newX = Math.max(minX, Math.min(newX, maxX));+ trimStartX.set(newX);+ setTrimStart(Math.max(0, Math.min(pixelsToTime(newX), pixelsToTime(trimEndX.get()) - 0.1)));+ }, [trimStartX, trimEndX, timeToPixels, pixelsToTime]);++ const handleTrimStartDragEnd = useCallback(() => {+ setIsDragging(false);+ const finalTime = pixelsToTime(trimStartX.get());+ const clampedTime = Math.max(0, Math.min(finalTime, pixelsToTime(trimEndX.get()) - 0.1));+ setTrimStart(clampedTime);+ playPreviewFrom(clampedTime, pixelsToTime(trimEndX.get()) - clampedTime);+ }, [trimStartX, trimEndX, pixelsToTime, playPreviewFrom]);++ const handleTrimEndDrag = useCallback((_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {+ if (!trackRef.current) return;+ let newX = trimEndX.get() + info.delta.x;+ const minX = trimStartX.get() + timeToPixels(0.1);+ const maxX = trackWidth();+ newX = Math.max(minX, Math.min(newX, maxX));+ trimEndX.set(newX);+ setTrimEnd(Math.max(pixelsToTime(trimStartX.get()) + 0.1, Math.min(pixelsToTime(newX), audioDuration)));+ }, [trimStartX, trimEndX, audioDuration, timeToPixels, pixelsToTime, trackWidth]);++ const handleTrimEndDragEnd = useCallback(() => {+ setIsDragging(false);+ const finalTime = pixelsToTime(trimEndX.get());+ const clampedTime = Math.max(pixelsToTime(trimStartX.get()) + 0.1, Math.min(finalTime, audioDuration));+ setTrimEnd(clampedTime);+ playPreviewFrom(pixelsToTime(trimStartX.get()), clampedTime - pixelsToTime(trimStartX.get()));+ }, [trimEndX, trimStartX, audioDuration, pixelsToTime, playPreviewFrom]);++ const stopAudio = useCallback(() => {+ if (playbackTimeoutRef.current) clearTimeout(playbackTimeoutRef.current);+ if (audioRef.current && isPlayingRef.current) {+ audioRef.current.pause();+ isPlayingRef.current = false;+ }+ }, []);+++ const rangeDraggingRef = useRef(false);+ const rangePointerStartRef = useRef<{ pointerX: number; startX: number; endX: number } | null>(null);++ const handleRangePointerDown = useCallback((e: React.PointerEvent) => {+ e.currentTarget.setPointerCapture(e.pointerId);+ rangeDraggingRef.current = true;+ rangePointerStartRef.current = {+ pointerX: e.clientX,+ startX: trimStartX.get(),+ endX: trimEndX.get(),+ };+ }, [trimStartX, trimEndX]);++ const handleRangePointerMove = useCallback((e: React.PointerEvent) => {+ if (!rangeDraggingRef.current || !rangePointerStartRef.current) return;+ const w = trackWidth();+ const { pointerX, startX, endX } = rangePointerStartRef.current;+ const delta = e.clientX - pointerX;+ const duration = endX - startX;++ let newStartX = startX + delta;+ let newEndX = endX + delta;++ if (newStartX < 0) { newStartX = 0; newEndX = duration; }+ if (newEndX > w) { newEndX = w; newStartX = w - duration; }++ trimStartX.set(newStartX);+ trimEndX.set(newEndX);+ setTrimStart(pixelsToTime(newStartX));+ setTrimEnd(pixelsToTime(newEndX));+ }, [trackWidth, trimStartX, trimEndX, pixelsToTime]);++ const handleRangePointerUp = useCallback(() => {+ if (!rangeDraggingRef.current) return;+ rangeDraggingRef.current = false;+ const finalStart = pixelsToTime(trimStartX.get());+ const finalEnd = pixelsToTime(trimEndX.get());+ rangePointerStartRef.current = null;+ playPreviewFrom(finalStart, finalEnd - finalStart);+ }, [trimStartX, trimEndX, pixelsToTime, playPreviewFrom]);++ const handleCancel = useCallback(() => { stopAudio(); onCancel(); }, [stopAudio, onCancel]);+ const handleConfirm = useCallback(() => { stopAudio(); onConfirm(trimStart, trimEnd); }, [stopAudio, onConfirm, trimStart, trimEnd]);++ const formatTime = (seconds: number) => {+ const mins = Math.floor(seconds / 60);+ const secs = Math.floor(seconds % 60);+ const ms = Math.floor((seconds % 1) * 10);+ return `${mins}:${secs.toString().padStart(2, '0')}.${ms}`;+ };++ const trimmedDuration = trimEnd - trimStart;+ const startPercentage = (trimStart / audioDuration) * 100;+ const endPercentage = (trimEnd / audioDuration) * 100;++ if (!isOpen) return null;++ return (+ <div className="fixed inset-0 z-100 flex items-center justify-center bg-black/60 backdrop-blur-md animate-in fade-in duration-200">+ <motion.div+ initial={{ scale: 0.95, opacity: 0 }}+ animate={{ scale: 1, opacity: 1 }}+ exit={{ scale: 0.95, opacity: 0 }}+ transition={{ duration: 0.2 }}+ className="p-8 bg-[#09090B] border border-white/20 rounded-2xl shadow-[0_0_80px_-15px_rgba(0,0,0,1)] w-full max-w-2xl mx-4"+ >+ <div className="flex items-start justify-between mb-6">+ <div className="flex items-center gap-3">+ <div className="p-2 bg-blue-500/10 border border-blue-500/20 rounded-xl">+ <Icon icon="mdi:content-cut" className="text-blue-400" width="24" />+ </div>+ <div>+ <h2 className="text-xl font-bold text-white">Recortar audio</h2>+ <p className="text-sm text-white/50 mt-0.5">+ Arrastra los handles o la zona azul para ajustar+ </p>+ </div>+ </div>+ <button onClick={handleCancel} className="p-2 rounded-lg text-white/40 hover:text-white hover:bg-white/5 transition-colors">+ <Icon icon="lucide:x" width="20" />+ </button>+ </div>++ <div className="mb-6 p-4 bg-white/5 border border-white/10 rounded-xl">+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2 text-sm text-white/60">+ <Icon icon="mdi:music-note" width="16" />+ <span className="font-medium text-white">{audioName}</span>+ </div>+ <span className="text-xs text-white/40">Duración total: {formatTime(audioDuration)}</span>+ </div>+ </div>++ <div className="mb-8">+ <div+ ref={trackRef}+ className="relative h-24 bg-[#141417] border border-white/10 select-none mb-4"+ >+ <div className="absolute inset-0 flex items-center pointer-events-none">+ <div className="flex items-end gap-0.5 h-full w-full px-2 pb-2 pt-2">+ {waveformHeights.map((height, i) => (+ <div key={i} className="flex-1 bg-white/10 rounded-full" style={{ height: `${height}%` }} />+ ))}+ </div>+ </div>++ <div+ className="absolute top-0 bottom-0 bg-blue-500/15 border-y border-blue-500/30 cursor-grab active:cursor-grabbing select-none"+ style={{+ left: `${startPercentage}%`,+ right: `${100 - endPercentage}%`,+ }}+ onPointerDown={handleRangePointerDown}+ onPointerMove={handleRangePointerMove}+ onPointerUp={handleRangePointerUp}+ >+ <div className="absolute inset-0 flex items-end px-1 pb-2 pt-2 pointer-events-none">+ {trimmedWaveformHeights.map((height, i) => (+ <div key={i} className="flex-1 bg-blue-400/50 rounded-full" style={{ height: `${height}%` }} />+ ))}+ </div>+ </div>++ <motion.div+ className="absolute top-0 bottom-0 z-20 flex items-center justify-center"+ style={{ left: -1, x: trimStartX, width: 2 }}+ drag="x"+ dragElastic={0}+ dragMomentum={false}+ onDrag={handleTrimStartDrag}+ onDragStart={() => setIsDragging(true)}+ onDragEnd={handleTrimStartDragEnd}+ >+ <div className="absolute inset-0 bg-blue-500" />+ <div+ className="absolute cursor-ew-resize"+ style={{+ width: 6,+ height: 28,+ background: '#378ADD',+ borderRadius: 3,+ left: -2,+ top: '50%',+ transform: 'translateY(-50%)',+ boxShadow: '0 0 0 1.5px rgba(55,138,221,0.3)',+ }}+ />+ </motion.div>++ <motion.div+ className="absolute top-0 bottom-0 z-20 flex items-center justify-center"+ style={{ left: -1, x: trimEndX, width: 2 }}+ drag="x"+ dragElastic={0}+ dragMomentum={false}+ onDrag={handleTrimEndDrag}+ onDragStart={() => setIsDragging(true)}+ onDragEnd={handleTrimEndDragEnd}+ >+ <div className="absolute inset-0 bg-blue-500" />+ <div+ className="absolute cursor-ew-resize"+ style={{+ width: 6,+ height: 28,+ background: '#378ADD',+ borderRadius: 3,+ left: -2,+ top: '50%',+ transform: 'translateY(-50%)',+ boxShadow: '0 0 0 1.5px rgba(55,138,221,0.3)',+ }}+ />+ </motion.div>+ </div>++ <div className="flex items-center justify-between gap-4">+ <div className="flex-1 p-3 bg-[#141417] border border-white/10 rounded-lg">+ <div className="text-xs text-white/40 mb-1">Inicio</div>+ <div className="text-lg font-mono text-white">{formatTime(trimStart)}</div>+ </div>+ <Icon icon="mdi:arrow-right" width="20" className="text-white/40 shrink-0" />+ <div className="flex-1 p-3 bg-[#141417] border border-white/10 rounded-lg">+ <div className="text-xs text-white/40 mb-1">Final</div>+ <div className="text-lg font-mono text-white">{formatTime(trimEnd)}</div>+ </div>+ <Icon icon="mdi:equal" width="20" className="text-white/40 shrink-0" />+ <div className="flex-1 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg">+ <div className="text-xs text-blue-400/60 mb-1">Duración</div>+ <div className="text-lg font-mono text-blue-400 font-semibold">{formatTime(trimmedDuration)}</div>+ </div>+ </div>+ </div>++ <div className="flex items-center gap-3">+ <Button+ variant="outline"+ onClick={handleCancel}+ className="flex-1 h-11 bg-transparent border-white/10 hover:bg-white/5 text-white/60 hover:text-white"+ >+ Cancelar+ </Button>+ <Button+ onClick={handleConfirm}+ variant="primary"+ className="flex-1 h-11 text-white font-medium"+ >+ <Icon icon="mdi:check" width="18" className="mr-1.5" />+ Aplicar recorte+ </Button>+ </div>+ </motion.div>+ </div>+ );+}\ No newline at end of filediff --git a/app/components/ui/editor/ControlPanel.tsx b/app/components/ui/editor/ControlPanel.tsxindex 6c15a14..ab525cd 100644--- a/app/components/ui/editor/ControlPanel.tsx+++ b/app/components/ui/editor/ControlPanel.tsx@@ -8,8 +8,9 @@ import type { ControlPanelProps } from "@/types/control-panel.types";import Link from "next/link";import Image from "next/image";import { lazy, Suspense } from "react";-import { ElementsMenuSkeleton, ZoomGlobalConfigSkeleton, MockupMenuSkeleton, WallpaperSkeleton, BackgroundColorSkeleton, ImageBackgroundSkeleton, ZoomFragmentEditorSkeleton } from "../Skeleton";+import { ElementsMenuSkeleton, ZoomGlobalConfigSkeleton, MockupMenuSkeleton, WallpaperSkeleton, BackgroundColorSkeleton, ImageBackgroundSkeleton, ZoomFragmentEditorSkeleton, AudioMenuSkeleton } from "../Skeleton";import { ElementsMenu } from "./ElementsMenu";+import { TooltipAction } from "@/components/ui/tooltip-action";// Lazy load heavy components - only load when neededconst ImageRecentBackgroundGrid = lazy(() => import("../ImageRecentBackgroundGrid").then(mod => ({ default: mod.ImageRecentBackgroundGrid })));@@ -87,42 +88,35 @@ export function ControlPanel({videoHasAudioTrack = true,}: ExtendedControlPanelProps) {return (- <div className="relative w-[320px] h-screen bg-[#141417] border-r border-white/10 flex flex-col shrink-0">+ <div className="relative w-full sm:w-[320px] h-screen bg-[#141417] border-r border-white/10 flex flex-col shrink-0"><header className="flex items-center justify-between h-13 p-2 border-b border-white/10 shrink-0">- <Link href="/" className="flex items-center gap-2 group">+ <Link href="/" onClick={() => { window.location.href = "/"; }} className="flex items-center gap-2 group"><Image src="/svg/logo-openvid.svg" alt="Logo" width={30} height={30} />- <span className="hidden sm:flex text-white font-semibold text-sm transition-colors group-hover:text-neutral-200">- Free- <span className="relative inline-block px-1 ml-0.5">- <span className="absolute inset-0 bg-blue-500/20 border border-dashed border-blue-400/50 rounded-sm -rotate-1" />-- <span className="relative">Shot</span>-- <div className="absolute -bottom-1 -right-1 size-2 bg-sky-500 border border-white rounded-full shadow-lg" />- </span>- </span>+ <Image src="/svg/openvid.svg" alt="Logo" width={70} height={50} /></Link>- <motion.button- onClick={onTogglePanel}- className="p-2 rounded-lg text-white/60 hover:text-white hover:bg-white/5 transition-all duration-200" title="Cerrar panel de control"- whileHover={{ scale: 1.1 }}- whileTap={{ scale: 0.9 }}- >- <motion.div- animate={{ rotate: isOpen ? 0 : 180 }}- transition={{ duration: 0.3, ease: "easeInOut" }}+ <TooltipAction label="Cerrar panel de control" side="right">+ <motion.button+ onClick={onTogglePanel}+ className="p-2 rounded-lg text-white/60 hover:text-white hover:bg-white/5 transition-all duration-200"+ whileHover={{ scale: 1.1 }}+ whileTap={{ scale: 0.9 }}>- <Icon icon="lucide:sidebar-close" width="20" />- </motion.div>- </motion.button>+ <motion.div+ animate={{ rotate: isOpen ? 0 : 180 }}+ transition={{ duration: 0.3, ease: "easeInOut" }}+ >+ <Icon icon="lucide:sidebar-close" width="20" />+ </motion.div>+ </motion.button>+ </TooltipAction></header><div className="flex-1 overflow-y-auto custom-scrollbar">{activeTool === "screenshot" && (<>- <div className="p-4 border-b border-white/10">+ <div className="p-4"><div className="flex items-center gap-2 text-white font-medium mb-4">- <Icon icon="gravity-ui:picture" width="20" />+ <Icon icon="solar:gallery-wide-linear" width="20" /><span>Fondo</span></div>@@ -157,6 +151,7 @@ export function ControlPanel({selectedIndex={selectedWallpaper}onSelect={onWallpaperSelect}onUnsplashSelect={(url) => {+ onWallpaperSelect?.(-2); // Deselect catalog wallpapersonImageSelect?.(url);}}/>@@ -166,6 +161,7 @@ export function ControlPanel({selectedIndex={selectedWallpaper}onSelect={onWallpaperSelect}onUnsplashSelect={(url) => {+ onWallpaperSelect?.(-2); // Deselect catalog wallpapersonImageSelect?.(url);}}/>@@ -247,16 +243,14 @@ export function ControlPanel({)}{activeTool === "audio" && (- <Suspense fallback={<ElementsMenuSkeleton />}>+ <Suspense fallback={<AudioMenuSkeleton />}><AudioMenu- uploadedAudios={uploadedAudios}audioTracks={audioTracks}+ uploadedAudios={uploadedAudios || []}muteOriginalAudio={muteOriginalAudio}masterVolume={masterVolume}videoDuration={videoDuration}onAudioUpload={onAudioUpload || (() => { })}- onAudioDelete={onAudioDelete || (() => { })}- onAddAudioTrack={onAddAudioTrack || (() => { })}onUpdateAudioTrack={onUpdateAudioTrack || (() => { })}onDeleteAudioTrack={onDeleteAudioTrack || (() => { })}onToggleMuteOriginalAudio={onToggleMuteOriginalAudio || (() => { })}diff --git a/app/components/ui/editor/EditorTopBar.tsx b/app/components/ui/editor/EditorTopBar.tsxindex 478874f..756507f 100644--- a/app/components/ui/editor/EditorTopBar.tsx+++ b/app/components/ui/editor/EditorTopBar.tsx@@ -5,16 +5,51 @@ import { ExportDropdown } from "../ExportDropdown";import type { ExportQuality, ExportProgress } from "@/types";import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";import { useEffect, useState } from "react";+import { useAuth } from "@/hooks/useAuth";+import * as DropdownMenu from "@radix-ui/react-dropdown-menu";+import Image from "next/image";+import Link from "next/link";+import { TooltipAction } from "@/components/ui/tooltip-action";interface EditorTopBarProps {onExport: (quality: ExportQuality) => void;exportProgress: ExportProgress;hasTransparentBackground?: boolean;+ onUndo?: () => void;+ onRedo?: () => void;+ canUndo?: boolean;+ canRedo?: boolean;}-export function EditorTopBar({ onExport, exportProgress, hasTransparentBackground }: EditorTopBarProps) {+export function EditorTopBar({+ onExport,+ exportProgress,+ hasTransparentBackground,+ onUndo,+ onRedo,+ canUndo = false,+ canRedo = false+}: EditorTopBarProps) {const [showAlert, setShowAlert] = useState(false);const [prevStatus, setPrevStatus] = useState<string>(exportProgress.status);+ const { user, profile, signOut, loading } = useAuth();+ const [isLoggingOut, setIsLoggingOut] = useState(false);++ const handleSignOut = async () => {+ setIsLoggingOut(true);+ try {+ await signOut();+ window.location.href = "/";+ } catch (error) {+ console.error("Error signing out:", error);+ setIsLoggingOut(false);+ }+ };++ const meta = user?.user_metadata || {};+ const displayName = profile?.first_name || profile?.full_name || meta.full_name || meta.name || user?.email?.split("@")[0] || "Usuario";+ const avatarUrl = profile?.avatar_url || meta.avatar_url || meta.picture || `https://api.dicebear.com/7.x/initials/svg?seed=${displayName}`;+ const provider = profile?.provider || meta.provider || "email";if (exportProgress.status !== prevStatus) {setPrevStatus(exportProgress.status);@@ -38,7 +73,7 @@ export function EditorTopBar({ onExport, exportProgress, hasTransparentBackgroun<div className="h-13 border-b border-white/10 flex items-center justify-between px-4 shrink-0 relative">{showAlert && (- <div className="fixed top-6 left-1/2 -translate-x-1/2 w-full max-w-md z-200 px-4 animate-in fade-in zoom-in slide-in-from-top-4 duration-300">+ <div className="fixed top-6 left-1/2 -translate-x-1/2 w-full max-w-md z-[200] px-4 animate-in fade-in zoom-in slide-in-from-top-4 duration-300"><Alert variant="info" className="relative border-red-500/50 bg-red-950/95 backdrop-blur-lg shadow-2xl overflow-hidden"><buttononClick={() => setShowAlert(false)}@@ -70,14 +105,127 @@ export function EditorTopBar({ onExport, exportProgress, hasTransparentBackgroun<div className="flex items-center gap-3 ml-auto"><div className="flex items-center gap-2 border-r border-white/10 pr-3">- <button className="hover:text-white transition-colors">- <Icon icon="mdi:undo" width="20" />- </button>- <button className="hover:text-white transition-colors opacity-50 cursor-not-allowed">- <Icon icon="mdi:redo" width="20" />- </button>+ <TooltipAction label={canUndo ? "Deshacer (Ctrl+Z)" : "No hay acciones para deshacer"}>+ <button+ onClick={onUndo}+ disabled={!canUndo}+ className={`transition-colors ${canUndo+ ? 'hover:text-white text-white/70'+ : 'opacity-30 cursor-not-allowed text-white/30'+ }`}+ >+ <Icon icon="mdi:undo" width="20" />+ </button>+ </TooltipAction>+ <TooltipAction label={canRedo ? "Rehacer (Ctrl+Y)" : "No hay acciones para rehacer"}>+ <button+ onClick={onRedo}+ disabled={!canRedo}+ className={`transition-colors ${canRedo+ ? 'hover:text-white text-white/70'+ : 'opacity-30 cursor-not-allowed text-white/60'+ }`}+ >+ <Icon icon="mdi:redo" width="20" />+ </button>+ </TooltipAction></div>- <ExportDropdown onExport={onExport} exportProgress={exportProgress} hasTransparentBackground={hasTransparentBackground}/>+ <ExportDropdown onExport={onExport} exportProgress={exportProgress} hasTransparentBackground={hasTransparentBackground} />++ {loading ? (+ <div className="flex items-center gap-2 pl-3 border-l border-white/10 ml-1">+ <div className="hidden sm:flex flex-col items-end gap-1.5">+ <div className="w-16 h-2.5 bg-white/10 rounded-sm animate-pulse"></div>+ <div className="w-24 h-2 bg-white/10 rounded-sm animate-pulse"></div>+ </div>+ <div className="h-8 w-8 rounded-full bg-white/10 animate-pulse border border-white/10 shrink-0"></div>+ </div>+ ) : !user ? (+ <div className="pl-3 border-l border-white/10 ml-1 flex items-center h-8">+ <Link+ href="/login"+ className="text-sm font-medium text-white/80 hover:text-white transition-colors"+ >+ Iniciar sesión+ </Link>+ </div>+ ) : (+ <DropdownMenu.Root>+ <DropdownMenu.Trigger asChild>+ <button+ className="flex items-center gap-2 pl-3 border-l border-white/10 ml-1 hover:opacity-80 transition-opacity focus:outline-none"+ aria-label="Menú de usuario"+ >+ <div className="hidden sm:flex flex-col items-end leading-none">+ <span className="text-[11px] font-medium text-white max-w-[100px] truncate">+ {displayName}+ </span>+ <span className="text-[10px] text-neutral-500 max-w-[120px] truncate">+ {user.email}+ </span>+ </div>+ <div className="h-8 w-8 rounded-full border border-white/10 bg-neutral-900 overflow-hidden shrink-0 relative">+ <Image+ src={avatarUrl}+ alt={displayName}+ fill+ sizes="32px"+ className="object-cover"+ unoptimized+ />+ </div>+ </button>+ </DropdownMenu.Trigger>++ <DropdownMenu.Portal>+ <DropdownMenu.Content+ className="min-w-55 bg-black border border-white/25 rounded-lg shadow-xl p-1 z-9999"+ sideOffset={5}+ align="end"+ >+ <div className="px-3 py-2 border-b border-white/10">+ <p className="text-sm font-medium text-white truncate">{displayName}</p>+ <p className="text-xs text-neutral-400 truncate">{user.email}</p>+ <p className="text-xs text-neutral-500 mt-1 capitalize">+ Conectado con {provider}+ </p>+ </div>++ <DropdownMenu.Item asChild>+ <Link+ href="/"+ className="flex items-center gap-3 px-3 py-2 text-sm text-neutral-300 hover:text-white hover:bg-white/5 rounded-lg transition-colors cursor-pointer outline-none"+ >+ <Icon icon="hugeicons:home-11" className="size-4" />+ Inicio+ </Link>+ </DropdownMenu.Item>++ <DropdownMenu.Item asChild>+ <Link+ href="/editor"+ className="flex items-center gap-3 px-3 py-2 text-sm text-neutral-300 hover:text-white hover:bg-white/5 rounded-lg transition-colors cursor-pointer outline-none"+ >+ <Icon icon="solar:video-frame-cut-2-linear" className="size-4" />+ Editor+ </Link>+ </DropdownMenu.Item>+ <DropdownMenu.Separator className="h-px bg-white/10 my-1" />++ <DropdownMenu.Item asChild>+ <button+ onClick={handleSignOut}+ disabled={isLoggingOut}+ className="w-full flex items-center gap-3 px-3 py-2 text-sm text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded-lg transition-colors cursor-pointer outline-none disabled:opacity-50 disabled:cursor-not-allowed"+ >+ <Icon icon="solar:logout-2-linear" className="size-4" />+ {isLoggingOut ? "Cerrando sesión..." : "Cerrar sesión"}+ </button>+ </DropdownMenu.Item>+ </DropdownMenu.Content>+ </DropdownMenu.Portal>+ </DropdownMenu.Root>+ )}</div></div>);diff --git a/app/components/ui/editor/ElementsMenu.tsx b/app/components/ui/editor/ElementsMenu.tsxindex 7e58fcd..b58beaf 100644--- a/app/components/ui/editor/ElementsMenu.tsx+++ b/app/components/ui/editor/ElementsMenu.tsx@@ -9,6 +9,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popoverimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";import { Button } from "@/components/ui/button";import { SVG_COMPONENTS } from "@/components/canvas-svg";+import { TooltipAction } from "@/components/ui/tooltip-action";export function ElementsMenu({onAddElement,@@ -20,12 +21,10 @@ export function ElementsMenu({}: ElementsMenuProps) {const [mode, setMode] = useState<"text" | "elements">("elements");- // SVG/Shape settingsconst [shapeSize, setShapeSize] = useState(15);const [shapeColor, setShapeColor] = useState("#FFFFFF");const [shapeOpacity, setShapeOpacity] = useState(100);- // Text settingsconst [textContent, setTextContent] = useState("Texto");const [textFontSize, setTextFontSize] = useState(32);const [textColor, setTextColor] = useState("#FFFFFF");@@ -33,28 +32,22 @@ export function ElementsMenu({const [textFontFamily, setTextFontFamily] = useState("Inter");const [textFontWeight, setTextFontWeight] = useState<"normal" | "medium" | "bold">("normal");- // Image settingsconst [imageOpacity, setImageOpacity] = useState(100);const [imageSize, setImageSize] = useState(25);- // Popover statesconst [selectedSvgCategory, setSelectedSvgCategory] = useState<string>("all");const [selectedImageCategory, setSelectedImageCategory] = useState<string>("all");- // Track if we're syncing to avoid infinite loopsconst isSyncing = useRef(false);const lastSelectedId = useRef<string | null>(null);- // Sync form FROM selected element (auto-fill when clicking element)useEffect(() => {- // Only sync if the selected element ID has changedconst currentId = selectedElement?.id || null;if (lastSelectedId.current === currentId) return;lastSelectedId.current = currentId;isSyncing.current = true;- // Use startTransition to batch state updatesstartTransition(() => {if (selectedElement) {if (selectedElement.type === "svg") {@@ -76,7 +69,6 @@ export function ElementsMenu({setMode("text");}} else {- // Reset to defaults when no selectionsetShapeSize(15);setShapeColor("#FFFFFF");setShapeOpacity(100);@@ -94,7 +86,6 @@ export function ElementsMenu({});}, [selectedElement]);- // Sync element FROM form changes (real-time preview for SVG)useEffect(() => {if (!isSyncing.current && selectedElement?.type === "svg" && onUpdateElement) {onUpdateElement(selectedElement.id, {@@ -106,7 +97,6 @@ export function ElementsMenu({}}, [shapeSize, shapeColor, shapeOpacity, selectedElement?.id, selectedElement?.type, onUpdateElement]);- // Sync element FROM form changes (real-time preview for image)useEffect(() => {if (!isSyncing.current && selectedElement?.type === "image" && onUpdateElement) {onUpdateElement(selectedElement.id, {@@ -117,7 +107,6 @@ export function ElementsMenu({}}, [imageSize, imageOpacity, selectedElement?.id, selectedElement?.type, onUpdateElement]);- // Sync element FROM form changes (real-time preview for text)useEffect(() => {if (!isSyncing.current && selectedElement?.type === "text" && onUpdateElement) {onUpdateElement(selectedElement.id, {@@ -131,17 +120,14 @@ export function ElementsMenu({}}, [textContent, textFontSize, textColor, textOpacity, textFontFamily, textFontWeight, selectedElement?.id, selectedElement?.type, onUpdateElement]);- // Filter SVG items by categoryconst filteredSvgItems = selectedSvgCategory === "all"? SVG_CATEGORIES.flatMap(cat => cat.items.map(item => ({ ...item, category: cat.id }))): SVG_CATEGORIES.find(cat => cat.id === selectedSvgCategory)?.items.map(item => ({ ...item, category: selectedSvgCategory })) || [];- // Filter image items by categoryconst filteredImageItems = selectedImageCategory === "all"? IMAGE_CATEGORIES.flatMap(cat => cat.items.map(item => ({ ...item, category: cat.id }))): IMAGE_CATEGORIES.find(cat => cat.id === selectedImageCategory)?.items.map(item => ({ ...item, category: selectedImageCategory })) || [];- // Handler to add SVG elementconst handleAddSvg = useCallback((item: { id: string; name: string; icon?: string }, categoryId?: string) => {const timestamp = Date.now();const newElement: SvgElement = {@@ -235,44 +221,43 @@ export function ElementsMenu({</div><div className="grid grid-cols-6 gap-2">{PINNED_SVG_ITEMS.map((item) => (- <button- key={item.id}- title={item.name}- onClick={() => handleAddSvg(item)}- className="aspect-square bg-white/3 hover:bg-white/8 border border-white/[0.07] hover:border-white/20 squircle-element flex items-center justify-center transition-all active:scale-90 group"- >- {item.icon ? (- <Icon- icon={item.icon}- width="18"- className="text-white/50 group-hover:text-white transition-colors"- />- ) : (- // Renderizar el SVG component directamente como preview- (() => {- const SvgComponent = SVG_COMPONENTS[item.id];- return SvgComponent- ? <SvgComponent color="currentColor" className="w-4 h-4 text-white/50 group-hover:text-white transition-colors" />- : <span className="text-[9px] text-white/40">{item.name}</span>;- })()- )}- </button>- ))}-- <Popover>- <PopoverTrigger asChild>+ <TooltipAction label={item.name} key={item.id}><button- className="aspect-square squircle-element border border-dashed border-white/30 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"- title="Ver todas las figuras"+ onClick={() => handleAddSvg(item)}+ className="aspect-square bg-white/3 hover:bg-white/8 border border-white/[0.07] hover:border-white/20 squircle-element flex items-center justify-center transition-all active:scale-90 group">- <Icon- icon="ph:plus-bold"- width="16"- className="text-blue-400 group-hover:text-blue-300 transition-colors"- />+ {item.icon ? (+ <Icon+ icon={item.icon}+ width="18"+ className="text-white/50 group-hover:text-white transition-colors"+ />+ ) : (+ (() => {+ const SvgComponent = SVG_COMPONENTS[item.id];+ return SvgComponent+ ? <SvgComponent color="currentColor" className="w-4 h-4 text-white/50 group-hover:text-white transition-colors" />+ : <span className="text-[9px] text-white/40">{item.name}</span>;+ })()+ )}</button>- </PopoverTrigger>+ </TooltipAction>+ ))}+ <Popover>+ <TooltipAction label="Ver todas las figuras">+ <PopoverTrigger asChild>+ <button+ className="aspect-square squircle-element border border-dashed border-white/30 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"+ >+ <Icon+ icon="ph:plus-bold"+ width="16"+ className="text-blue-400 group-hover:text-blue-300 transition-colors"+ />+ </button>+ </PopoverTrigger>+ </TooltipAction><PopoverContentside="right"align="start"@@ -310,27 +295,27 @@ export function ElementsMenu({<div className="p-3 grid grid-cols-6 gap-2 overflow-y-auto custom-scrollbar">{filteredSvgItems.map((item) => (- <button- key={`${item.category}-${item.id}`}- title={item.name}- onClick={() => handleAddSvg(item, item.category)}- className="aspect-square bg-white/3 hover:bg-white/8 border border-white/[0.07] hover:border-white/20 squircle-element flex items-center justify-center transition-all active:scale-90 group"- >- {item.icon ? (- <Icon- icon={item.icon}- width="18"- className="text-white/50 group-hover:text-white transition-colors"- />- ) : (- (() => {- const SvgComponent = SVG_COMPONENTS[item.id];- return SvgComponent- ? <SvgComponent color="currentColor" className="w-4 h-4 text-white/50 scale-200 group-hover:text-white transition-colors" />- : <span className="text-[9px] text-white/40">{item.name}</span>;- })()- )}- </button>+ <TooltipAction label={item.name} key={`${item.category}-${item.id}`}>+ <button+ onClick={() => handleAddSvg(item, item.category)}+ className="aspect-square bg-white/3 hover:bg-white/8 border border-white/[0.07] hover:border-white/20 squircle-element flex items-center justify-center transition-all active:scale-90 group"+ >+ {item.icon ? (+ <Icon+ icon={item.icon}+ width="18"+ className="text-white/50 group-hover:text-white transition-colors"+ />+ ) : (+ (() => {+ const SvgComponent = SVG_COMPONENTS[item.id];+ return SvgComponent+ ? <SvgComponent color="currentColor" className="w-4 h-4 text-white/50 scale-200 group-hover:text-white transition-colors" />+ : <span className="text-[9px] text-white/40">{item.name}</span>;+ })()+ )}+ </button>+ </TooltipAction>))}</div></div>@@ -345,18 +330,18 @@ export function ElementsMenu({</div><div className="grid grid-cols-6 gap-1.5">{PINNED_IMAGE_ITEMS.map((item) => (- <button- key={item.id}- title={item.name}- onClick={() => handleAddImage(item)}- className="aspect-square bg-white/3 hover:bg-white/8 border border-white/[0.07] hover:border-white/20 squircle-element flex items-center justify-center transition-all active:scale-90 overflow-hidden group"- >- <img- src={getImagePreviewPath(item)}- alt={item.name}- className="w-full h-full object-cover group-hover:scale-110 transition-transform"- />- </button>+ <TooltipAction label={item.name} key={item.id}>+ <button+ onClick={() => handleAddImage(item)}+ className="aspect-square bg-white/3 hover:bg-white/8 border border-white/[0.07] hover:border-white/20 squircle-element flex items-center justify-center transition-all active:scale-90 overflow-hidden group"+ >+ <ProgressiveImg+ src={getImagePreviewPath(item)}+ alt={item.name}+ className="w-full h-full object-cover group-hover:scale-110"+ />+ </button>+ </TooltipAction>))}{Array.from({ length: Math.max(0, 11 - PINNED_IMAGE_ITEMS.length) }).map((_, i) => (@@ -364,23 +349,24 @@ export function ElementsMenu({))}<Popover>- <PopoverTrigger asChild>- <button- className="aspect-square squircle-element border border-dashed border-white/30 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"- title="Ver todas las imágenes"- >- <Icon- icon="ph:plus-bold"- width="16"- className="text-blue-400 group-hover:text-blue-300 transition-colors"- />- </button>- </PopoverTrigger>+ <TooltipAction label="Ver todas las imágenes">+ <PopoverTrigger asChild>+ <button+ className="aspect-square squircle-element border border-dashed border-white/30 bg-white/5 flex items-center justify-center hover:bg-white/10 transition group"+ >+ <Icon+ icon="ph:plus-bold"+ width="16"+ className="text-blue-400 group-hover:text-blue-300 transition-colors"+ />+ </button>+ </PopoverTrigger>+ </TooltipAction><PopoverContentside="right"align="start"sideOffset={12}- className="w-124 p-0 border-0 shadow-2xl"+ className="w-130 p-0 border-0 shadow-2xl"><div className="flex flex-col bg-[#111113] border border-white/10 rounded-xl overflow-hidden shadow-2xl max-h-125"><div className="flex items-center gap-2 px-4 py-3 border-b border-white/10 bg-white/2 flex-wrap">@@ -412,26 +398,23 @@ export function ElementsMenu({</div><div className="p-3 grid grid-cols-8 gap-2 overflow-y-auto custom-scrollbar">- {filteredImageItems.length === 0 ? (- <div className="col-span-4 text-xs text-white/30 italic py-8 text-center">- No hay imágenes disponibles+ {filteredImageItems.map((item) => (+ <div key={`${item.category}-${item.id}`} className="w-full" style={{ paddingBottom: "100%", position: "relative" }}>+ <TooltipAction label={item.name}>+ <button+ title={item.name}+ onClick={() => handleAddImage(item, item.category)}+ className="absolute inset-0 bg-white/3 hover:bg-white/8 border border-white/[0.07] hover:border-white/20 squircle-element transition-all active:scale-90 overflow-hidden group"+ >+ <ProgressiveImg+ src={getImagePreviewPath(item)}+ alt={item.name}+ className="w-full h-full object-contain group-hover:scale-110"+ />+ </button>+ </TooltipAction></div>- ) : (- filteredImageItems.map((item) => (- <button- key={`${item.category}-${item.id}`}- title={item.name}- onClick={() => handleAddImage(item, item.category)}- className="aspect-square bg-white/3 hover:bg-white/8 border border-white/[0.07] hover:border-white/20 squircle-element flex items-center justify-center transition-all active:scale-90 overflow-hidden group"- >- <img- src={getImagePreviewPath(item)}- alt={item.name}- className="w-full h-full object-contain group-hover:scale-110 transition-transform"- />- </button>- ))- )}+ ))}</div></div></PopoverContent>@@ -447,14 +430,14 @@ export function ElementsMenu({<div className="flex gap-2"><div className="grid grid-cols-5 gap-2 flex-1">{PRESET_COLORS.map((color) => (- <button- key={color}- onClick={() => setShapeColor(color)}- className={`aspect-square squircle-element cursor-pointer transition-all border border-white/20 ${shapeColor === color ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50" : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"- }`}- style={{ backgroundColor: color }}- title={color}- />+ <TooltipAction label={color} key={color}>+ <button+ onClick={() => setShapeColor(color)}+ className={`aspect-square squircle-element cursor-pointer transition-all border border-white/20 ${shapeColor === color ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50" : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"+ }`}+ style={{ backgroundColor: color }}+ />+ </TooltipAction>))}</div><label className="relative cursor-pointer">@@ -482,7 +465,7 @@ export function ElementsMenu({value={selectedElement.type === "svg" ? shapeSize : imageSize}onChange={selectedElement.type === "svg" ? setShapeSize : setImageSize}min={5}- max={60}+ max={100}/><SliderControlicon="mdi:opacity"@@ -493,7 +476,21 @@ export function ElementsMenu({</div><div className="space-y-2">- <div className="text-[10px] uppercase tracking-widest text-white/40 font-semibold">Jerarquía</div>+ <div className="flex items-center justify-between">+ <div className="text-[10px] uppercase tracking-widest text-white/40 font-semibold">+ Jerarquía+ </div>++ <TooltipAction label="Eliminar">+ <button+ onClick={() => onDeleteElement?.(selectedElement.id)}+ className="p-1.5 bg-red-500/10 hover:bg-red-500/20 border border-red-500/30 rounded-md text-red-400 hover:text-red-300 transition-all active:scale-95"+ >+ <Icon icon="ph:trash-bold" width="14" />+ </button>+ </TooltipAction>+ </div>+<div className="grid grid-cols-2 gap-2"><buttononClick={() => onBringToFront?.(selectedElement.id)}@@ -511,17 +508,6 @@ export function ElementsMenu({</button></div></div>-- <div className="space-y-2">- <div className="text-[10px] uppercase tracking-widest text-white/40 font-semibold">Acciones</div>- <button- onClick={() => onDeleteElement?.(selectedElement.id)}- className="flex items-center justify-center gap-2 px-3 py-2 bg-red-500/10 hover:bg-red-500/20 border border-red-500/30 rounded-lg text-xs text-red-400 hover:text-red-300 transition-all"- >- <Icon icon="ph:trash-bold" width="16" />- Eliminar- </button>- </div></>)}</div>@@ -622,14 +608,14 @@ export function ElementsMenu({<div className="flex gap-2"><div className="grid grid-cols-5 gap-2 flex-1">{PRESET_COLORS.map((color) => (- <button- key={color}- onClick={() => setTextColor(color)}- className={`aspect-square squircle-element cursor-pointer transition-all border border-white/20 ${textColor === color ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50" : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"- }`}- style={{ backgroundColor: color }}- title={color}- />+ <TooltipAction label={color} key={color}>+ <button+ onClick={() => setTextColor(color)}+ className={`aspect-square squircle-element cursor-pointer transition-all border border-white/20 ${textColor === color ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50" : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"+ }`}+ style={{ backgroundColor: color }}+ />+ </TooltipAction>))}</div><label className="relative cursor-pointer">@@ -700,35 +686,36 @@ export function ElementsMenu({{selectedElement && selectedElement.type === "text" && (<><div className="space-y-2">- <div className="text-[10px] uppercase tracking-widest text-white/40 font-semibold">Jerarquía</div>+ <div className="flex items-center justify-between">+ <div className="text-[10px] uppercase tracking-widest text-white/40 font-semibold">+ Jerarquía+ </div>++ <TooltipAction label="Eliminar">+ <button+ onClick={() => onDeleteElement?.(selectedElement.id)}+ className="p-1.5 bg-red-500/10 hover:bg-red-500/20 border border-red-500/30 rounded-md text-red-400 hover:text-red-300 transition-all active:scale-95"+ >+ <Icon icon="ph:trash-bold" width="14" />+ </button>+ </TooltipAction>+ </div>+<div className="grid grid-cols-2 gap-2"><Button variant="outline" className="text-xs"onClick={() => onBringToFront?.(selectedElement.id)}-><Icon icon="ph:bring-to-front-bold" width="16" />Traer al frente</Button><Button variant="outline" className="text-xs"onClick={() => onSendToBack?.(selectedElement.id)}-><Icon icon="ph:send-to-back-bold" width="16" />Enviar atrás</Button></div></div>-- <div className="space-y-2">- <div className="text-[10px] uppercase tracking-widest text-white/40 font-semibold">Acciones</div>- <button- onClick={() => onDeleteElement?.(selectedElement.id)}- className="flex items-center justify-center gap-2 px-3 py-2 bg-red-500/10 hover:bg-red-500/20 border border-red-500/30 rounded-lg text-xs text-red-400 hover:text-red-300 transition-all"- >- <Icon icon="ph:trash-bold" width="16" />- Eliminar- </button>- </div></>)}</div>@@ -736,3 +723,26 @@ export function ElementsMenu({</div>);}+function ProgressiveImg({+ src,+ alt,+ className,+}: {+ src: string;+ alt: string;+ className?: string;+}) {+ const [isLoaded, setIsLoaded] = useState(false);++ return (+ <img+ src={src}+ alt={alt}+ decoding="async"+ loading="lazy"+ onLoad={() => setIsLoaded(true)}+ className={`transition-all duration-500 ease-out ${isLoaded ? "opacity-100 blur-none scale-100" : "opacity-0 blur-sm scale-95"+ } ${className ?? ""}`}+ />+ );+}\ No newline at end of filediff --git a/app/components/ui/editor/LabelSidebar.tsx b/app/components/ui/editor/LabelSidebar.tsxindex e00c1c3..7db8417 100644--- a/app/components/ui/editor/LabelSidebar.tsx+++ b/app/components/ui/editor/LabelSidebar.tsx@@ -6,18 +6,22 @@ export default function LabelSidebar({ audioTracksCount = 0 }: LabelSidebarPropsreturn (<div className="absolute left-0 top-0 bottom-0 w-16 shrink-0 border-r border-white/5 flex flex-col bg-[#0D0D11] z-30"><div className="h-7 border-b border-white/5" />+<div className="flex-1 flex items-center px-3"><span className="text-[9px] uppercase font-semibold tracking-wider text-zinc-500">Video</span></div>- <div className="flex-1 flex items-center px-3 border-t border-white/5">++ <div className={`flex items-center px-3 border-t border-white/5 transition-all duration-300 ${audioTracksCount > 0 ? 'h-12' : 'h-14'+ }`}><span className="text-[9px] uppercase font-semibold tracking-wider text-zinc-500">Zoom</span></div>{audioTracksCount > 0 && (- <div className="flex-1 flex items-center px-3 border-t border-white/5">+ <div className="h-5 flex items-center px-3 border-t border-white/5 bg-white/1"><span className="text-[9px] uppercase font-semibold tracking-wider text-zinc-500">Audio</span></div>)}</div>+);}\ No newline at end of filediff --git a/app/components/ui/editor/MobileControlPanel.tsx b/app/components/ui/editor/MobileControlPanel.tsxnew file mode 100644index 0000000..2a221d0--- /dev/null+++ b/app/components/ui/editor/MobileControlPanel.tsx@@ -0,0 +1,89 @@+"use client";++import { Suspense } from "react";+import { Icon } from "@iconify/react";+import * as Dialog from "@radix-ui/react-dialog";+import type { Tool } from "@/types";+import type { ControlPanelProps } from "@/types/control-panel.types";+import { LoadingSpinner } from "@/app/components/ui/LoadingSpinner";++interface MobileControlPanelProps extends ControlPanelProps {+ isOpen: boolean;+ onClose: () => void;+}++// Dynamic imports+import dynamic from "next/dynamic";++const ControlPanel = dynamic(+ () => import("./ControlPanel").then(mod => ({ default: mod.ControlPanel })),+ {+ loading: () => (+ <div className="w-full h-full flex items-center justify-center">+ <LoadingSpinner message="Cargando..." />+ </div>+ ),+ ssr: false+ }+);++export function MobileControlPanel({+ isOpen,+ onClose,+ ...controlPanelProps+}: MobileControlPanelProps) {+ return (+ <Dialog.Root open={isOpen} onOpenChange={onClose}>+ <Dialog.Portal>+ <Dialog.Overlay className="fixed inset-0 bg-black/80 backdrop-blur-sm z-100 animate-in fade-in duration-200 lg:hidden" />+ <Dialog.Content className="fixed inset-x-0 bottom-0 top-16 bg-[#141417] z-101 animate-in slide-in-from-bottom duration-300 overflow-y-auto lg:hidden">+ {/* Header */}+ <div className="sticky top-0 z-10 bg-[#141417] border-b border-white/10 px-4 py-3 flex items-center justify-between">+ <Dialog.Title className="text-lg font-semibold text-white flex items-center gap-2">+ <Icon+ icon={+ controlPanelProps.activeTool === "screenshot" ? "solar:gallery-wide-linear" :+ controlPanelProps.activeTool === "elements" ? "mdi:shape-outline" :+ controlPanelProps.activeTool === "audio" ? "mdi:volume-high" :+ controlPanelProps.activeTool === "zoom" ? "iconamoon:zoom-in-bold" :+ "hugeicons:ai-browser"+ }+ width="20"+ />+ {controlPanelProps.activeTool === "screenshot" && "Fondo"}+ {controlPanelProps.activeTool === "elements" && "Elementos"}+ {controlPanelProps.activeTool === "audio" && "Audio"}+ {controlPanelProps.activeTool === "zoom" && "Zoom"}+ {controlPanelProps.activeTool === "mockup" && "Mockup"}+ </Dialog.Title>+ <Dialog.Close asChild>+ <button+ className="h-8 w-8 rounded-full hover:bg-white/10 flex items-center justify-center transition-colors"+ aria-label="Cerrar"+ >+ <Icon icon="mdi:close" width="20" className="text-white/70" />+ </button>+ </Dialog.Close>+ </div>++ {/* Content */}+ <div className="p-4">+ <Suspense+ fallback={+ <div className="flex items-center justify-center py-20">+ <LoadingSpinner message="Cargando panel..." />+ </div>+ }+ >+ <ControlPanel+ {...controlPanelProps}+ onTogglePanel={onClose}+ isOpen={true}+ />+ </Suspense>+ </div>+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>+ );+}diff --git a/app/components/ui/editor/MobileToolsMenu.tsx b/app/components/ui/editor/MobileToolsMenu.tsxnew file mode 100644index 0000000..44045f0--- /dev/null+++ b/app/components/ui/editor/MobileToolsMenu.tsx@@ -0,0 +1,229 @@+"use client";++import { useState } from "react";+import { Icon } from "@iconify/react";+import * as Dialog from "@radix-ui/react-dialog";+import type { Tool } from "@/types";++interface MobileToolsMenuProps {+ activeTool: Tool;+ onToolChange: (tool: Tool) => void;+ onVideoUpload?: (file: File) => void;+ isUploading?: boolean;+ onOpenToolPanel?: () => void;+}++export function MobileToolsMenu({+ activeTool,+ onToolChange,+ onVideoUpload,+ isUploading = false,+ onOpenToolPanel+}: MobileToolsMenuProps) {+ const [isOpen, setIsOpen] = useState(false);++ const handleToolChange = (tool: Tool) => {+ onToolChange(tool);+ setIsOpen(false);+ // Open the control panel for this tool+ if (onOpenToolPanel) {+ setTimeout(() => onOpenToolPanel(), 100);+ }+ };++ const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {+ const file = e.target.files?.[0];+ if (file && onVideoUpload) {+ onVideoUpload(file);+ e.target.value = '';+ }+ };++ return (+ <Dialog.Root open={isOpen} onOpenChange={setIsOpen}>+ <Dialog.Trigger asChild>+ <button+ className="fixed bottom-4 left-4 z-50 h-14 w-14 rounded-full shadow-lg shadow-blue-500/50 bg-gradient-primary flex items-center justify-center hover:scale-105 transition-transform active:scale-95 lg:hidden"+ aria-label="Abrir menú de herramientas"+ >+ <Icon icon="solar:widget-2-bold-duotone" width="24" className="text-white" />+ </button>+ </Dialog.Trigger>++ <Dialog.Portal>+ <Dialog.Overlay className="fixed inset-0 bg-black/80 backdrop-blur-sm z-100 animate-in fade-in duration-200" />+ <Dialog.Content className="fixed bottom-0 left-0 right-0 bg-[#1a1a1d] border-t border-white/10 rounded-t-2xl z-101 p-6 animate-in slide-in-from-bottom duration-300 max-h-[80vh] overflow-y-auto">+ <div className="flex items-center justify-between mb-6">+ <Dialog.Title className="text-lg font-semibold text-white">+ Herramientas+ </Dialog.Title>+ <Dialog.Close asChild>+ <button+ className="h-8 w-8 rounded-full hover:bg-white/10 flex items-center justify-center transition-colors"+ aria-label="Cerrar"+ >+ <Icon icon="mdi:close" width="20" className="text-white/70" />+ </button>+ </Dialog.Close>+ </div>++ <div className="grid grid-cols-2 gap-3">+ <button+ onClick={() => handleToolChange("screenshot")}+ className="flex items-center justify-center p-4 squircle-element transition-all duration-200 group relative flex-col gap-1"+ style={activeTool === "screenshot" ? {+ background: 'radial-gradient(circle at 50% 0%, #555555 0%, #454545 64%)',+ boxShadow: 'inset 0 1.01rem 0.2rem -1rem #fff, 0 0 0 1px #fff4, 0 4px 4px 0 #0004, 0 0 0 1px #333',+ } : {+ background: 'rgba(255, 255, 255, 0.05)',+ border: '1px solid rgba(255, 255, 255, 0.1)'+ }}+ >+ <div className={`transition-transform duration-300 ${activeTool === "screenshot" ? "scale-110" : "group-hover:scale-105"}`}>+ <Icon+ icon="solar:gallery-wide-linear"+ width="24"+ className={activeTool === "screenshot" ? "text-white" : "text-white/70"}+ />+ </div>++ <span className={`text-sm font-medium transition-colors ${activeTool === "screenshot" ? "text-white" : "text-white/40"}`}>+ Fondo+ </span>++ {activeTool === "screenshot" && (+ <div className="absolute left-2 w-20 h-5 top-1/4 -translate-y-1/2 size-3 bg-white rounded-full blur-[14px] rotate-45 opacity-50 pointer-events-none" />+ )}+ </button>++ <button+ onClick={() => handleToolChange("elements")}+ className="flex items-center justify-center p-4 squircle-element transition-all duration-200 group relative flex-col gap-1 active:scale-95"+ style={activeTool === "elements" ? {+ background: 'radial-gradient(circle at 50% 0%, #555555 0%, #454545 64%)',+ boxShadow: 'inset 0 1.01rem 0.2rem -1rem #fff, 0 0 0 1px #fff4, 0 4px 4px 0 #0004, 0 0 0 1px #333',+ } : {+ background: 'rgba(255, 255, 255, 0.05)',+ border: '1px solid rgba(255, 255, 255, 0.1)'+ }}+ >+ <div className={`transition-transform duration-300 ${activeTool === "elements" ? "scale-110" : "group-hover:scale-105"}`}>+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" className={activeTool === "elements" ? "text-white" : "text-white/70"}>+ <path d="M11 13.5V21.5H3V13.5H11ZM9 15.5H5V19.5H9V15.5ZM12 2L17.5 11H6.5L12 2ZM12 5.86L10.08 9H13.92L12 5.86Z" fill="currentColor" stroke="currentColor" strokeWidth="0.2" />+ <path fillRule="evenodd" clipRule="evenodd" d="M13.7667 13.8246C13.7667 13.6323 13.8431 13.4479 13.9791 13.312C14.115 13.176 14.2994 13.0996 14.4917 13.0996H20.2917C20.484 13.0996 20.6684 13.176 20.8044 13.312C20.9403 13.4479 21.0167 13.6323 21.0167 13.8246V14.7913C21.0167 14.9836 20.9403 15.168 20.8044 15.3039C20.6684 15.4399 20.484 15.5163 20.2917 15.5163C20.0994 15.5163 19.915 15.4399 19.7791 15.3039C19.6431 15.168 19.5667 14.9836 19.5667 14.7913V14.5496H18.1167V20.3496H18.3584C18.5507 20.3496 18.7351 20.426 18.871 20.562C19.007 20.6979 19.0834 20.8823 19.0834 21.0746C19.0834 21.2669 19.007 21.4513 18.871 21.5873C18.7351 21.7232 18.5507 21.7996 18.3584 21.7996H16.4251C16.2328 21.7996 16.0484 21.7232 15.9124 21.5873C15.7764 21.4513 15.7001 21.2669 15.7001 21.0746C15.7001 20.8823 15.7764 20.6979 15.9124 20.562C16.0484 20.426 16.2328 20.3496 16.4251 20.3496H16.6667V14.5496H15.2167V14.7913C15.2167 14.9836 15.1403 15.168 15.0044 15.3039C14.8684 15.4399 14.684 15.5163 14.4917 15.5163C14.2994 15.5163 14.115 15.4399 13.9791 15.3039C13.8431 15.168 13.7667 14.9836 13.7667 14.7913V13.8246Z" fill="currentColor" stroke="currentColor" strokeWidth="0.5" />+ </svg>+ </div>+ <span className={`text-sm font-medium transition-colors ${activeTool === "elements" ? "text-white" : "text-white/40"}`}>+ Elementos+ </span>+ {activeTool === "elements" && (+ <div className="absolute left-2 w-20 h-5 top-1/4 -translate-y-1/2 size-3 bg-white rounded-full blur-[14px] rotate-45 opacity-50 pointer-events-none" />+ )}+ </button>++ <button+ onClick={() => handleToolChange("audio")}+ className="flex items-center justify-center p-4 squircle-element transition-all duration-200 group relative flex-col gap-1 active:scale-95"+ style={activeTool === "audio" ? {+ background: 'radial-gradient(circle at 50% 0%, #555555 0%, #454545 64%)',+ boxShadow: 'inset 0 1.01rem 0.2rem -1rem #fff, 0 0 0 1px #fff4, 0 4px 4px 0 #0004, 0 0 0 1px #333',+ } : {+ background: 'rgba(255, 255, 255, 0.05)',+ border: '1px solid rgba(255, 255, 255, 0.1)'+ }}+ >+ <div className={`transition-transform duration-300 ${activeTool === "audio" ? "scale-110" : "group-hover:scale-105"}`}>+ <Icon icon="mdi:volume-high" width="24" className={activeTool === "audio" ? "text-white" : "text-white/70"} />+ </div>+ <span className={`text-sm font-medium transition-colors ${activeTool === "audio" ? "text-white" : "text-white/40"}`}>+ Audio+ </span>+ {activeTool === "audio" && (+ <div className="absolute left-2 w-20 h-5 top-1/4 -translate-y-1/2 size-3 bg-white rounded-full blur-[14px] rotate-45 opacity-50 pointer-events-none" />+ )}+ </button>++ <button+ onClick={() => handleToolChange("zoom")}+ className="flex items-center justify-center p-4 squircle-element transition-all duration-200 group relative flex-col gap-1 active:scale-95"+ style={activeTool === "zoom" ? {+ background: 'radial-gradient(circle at 50% 0%, #555555 0%, #454545 64%)',+ boxShadow: 'inset 0 1.01rem 0.2rem -1rem #fff, 0 0 0 1px #fff4, 0 4px 4px 0 #0004, 0 0 0 1px #333',+ } : {+ background: 'rgba(255, 255, 255, 0.05)',+ border: '1px solid rgba(255, 255, 255, 0.1)'+ }}+ >+ <div className={`transition-transform duration-300 ${activeTool === "zoom" ? "scale-110" : "group-hover:scale-105"}`}>+ <Icon icon="iconamoon:zoom-in-bold" width="24" className={activeTool === "zoom" ? "text-white" : "text-white/70"} />+ </div>+ <span className={`text-sm font-medium transition-colors ${activeTool === "zoom" ? "text-white" : "text-white/40"}`}>+ Zoom+ </span>+ {activeTool === "zoom" && (+ <div className="absolute left-2 w-20 h-5 top-1/4 -translate-y-1/2 size-3 bg-white rounded-full blur-[14px] rotate-45 opacity-50 pointer-events-none" />+ )}+ </button>++ <button+ onClick={() => handleToolChange("mockup")}+ className="flex items-center justify-center p-4 squircle-element transition-all duration-200 group relative flex-col gap-1 active:scale-95"+ style={activeTool === "mockup" ? {+ background: 'radial-gradient(circle at 50% 0%, #555555 0%, #454545 64%)',+ boxShadow: 'inset 0 1.01rem 0.2rem -1rem #fff, 0 0 0 1px #fff4, 0 4px 4px 0 #0004, 0 0 0 1px #333',+ } : {+ background: 'rgba(255, 255, 255, 0.05)',+ border: '1px solid rgba(255, 255, 255, 0.1)'+ }}+ >+ <div className={`transition-transform duration-300 ${activeTool === "mockup" ? "scale-110" : "group-hover:scale-105"}`}>+ <Icon icon="hugeicons:ai-browser" width="24" className={activeTool === "mockup" ? "text-white" : "text-white/70"} />+ </div>+ <span className={`text-sm font-medium transition-colors ${activeTool === "mockup" ? "text-white" : "text-white/40"}`}>+ Mockup+ </span>+ {activeTool === "mockup" && (+ <div className="absolute left-2 w-20 h-5 top-1/4 -translate-y-1/2 size-3 bg-white rounded-full blur-[14px] rotate-45 opacity-50 pointer-events-none" />+ )}+ </button>++ <label+ className={`flex items-center justify-center p-4 squircle-element transition-all duration-200 group relative flex-col gap-1 active:scale-95 cursor-pointer ${isUploading ? "opacity-50 cursor-not-allowed" : ""+ }`}+ style={{+ background: 'rgba(255, 255, 255, 0.05)',+ border: '1px solid rgba(255, 255, 255, 0.1)',+ boxShadow: isUploading ? 'none' : '0 4px 4px 0 #0004',+ }}+ >+ <div className={`transition-transform duration-300 ${isUploading ? "animate-pulse" : "group-hover:scale-105"}`}>+ <Icon+ icon={isUploading ? "svg-spinners:ring-resize" : "solar:cloud-upload-bold-duotone"}+ width="24"+ className="text-white"+ />+ </div>++ <span className="text-sm font-medium text-white/70 group-hover:text-white transition-colors">+ {isUploading ? "Subiendo..." : "Subir video"}+ </span>++ {!isUploading && (+ <div className="absolute left-2 w-16 h-4 top-1/4 -translate-y-1/2 bg-white rounded-full blur-md rotate-45 opacity-20 pointer-events-none" />+ )}++ <input+ type="file"+ accept="video/mp4,video/webm,video/quicktime,video/x-matroska"+ className="hidden"+ onChange={handleFileChange}+ disabled={isUploading}+ />+ </label>++ </div>+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>+ );+}diff --git a/app/components/ui/editor/MockupMenu.tsx b/app/components/ui/editor/MockupMenu.tsxindex 8427398..9adf0b1 100644--- a/app/components/ui/editor/MockupMenu.tsx+++ b/app/components/ui/editor/MockupMenu.tsx@@ -48,23 +48,21 @@ export function MockupMenu({}, 0);}};+const handleCategoryChange = (cat: MockupCategory) => {setSelectedCategory(cat);setGridLoaded(false);setTimeout(() => setGridLoaded(true), 250);};+const handleDarkModeChange = (isDark: boolean) => {- // Determinar si el color actual es claro u oscuroconst currentFrameColor = (mockupConfig?.frameColor || "#f6f6f6").toLowerCase();const isCurrentColorDark = FRAME_COLORS_DARK.includes(currentFrameColor);- // Si el modo cambia, actualizar el frameColor a uno apropiadolet newFrameColor = currentFrameColor;if (isDark && !isCurrentColorDark) {- // Cambiar a dark mode pero el color es claro -> usar color oscuronewFrameColor = "#1e1e1e";} else if (!isDark && isCurrentColorDark) {- // Cambiar a light mode pero el color es oscuro -> usar color claronewFrameColor = "#f6f6f6";}@@ -90,7 +88,7 @@ export function MockupMenu({return (<div className="p-4 flex flex-col gap-6"><div className="flex items-center gap-2 text-white font-medium">- <Icon icon="hugeicons:browser" width="20" />+ <Icon icon="hugeicons:ai-browser" width="20" /><span>Mockup</span></div>@@ -105,7 +103,7 @@ export function MockupMenu({<PopoverTrigger asChild><buttontype="button"- className="group relative flex items-center gap-3 p-2 squircle-element border transition-all w-full h-[140px] bg-blue-500/10 border-blue-500/40 text-blue-300"+ className="group relative flex items-center gap-3 p-2 squircle-element border transition-all w-full h-35 bg-blue-500/10 border-blue-500/40 text-blue-300"><div className="flex-1 flex flex-col gap-2 h-full justify-center overflow-hidden"><div className="w-full squircle-element overflow-hidden bg-neutral-900 relative h-full">@@ -143,10 +141,9 @@ export function MockupMenu({side="right"align="start"sideOffset={12}- className="w-[500px] p-0 border-0 shadow-2xl"+ className="w-125 p-0 border-0 shadow-2xl">- <div className="flex flex-col bg-[#111113] border border-white/10 rounded-xl overflow-hidden shadow-2xl max-h-[600px]">- {/* Header con categorías */}+ <div className="flex flex-col bg-[#111113] border border-white/10 rounded-xl overflow-hidden shadow-2xl max-h-150"><div className="flex items-center gap-2 px-4 py-3 border-b border-white/10 bg-white/2 flex-wrap">{MOCKUP_CATEGORIES.map((cat) => (<button@@ -166,60 +163,69 @@ export function MockupMenu({</span></div>- {/* Grid de mockups */}- <div className="overflow-y-auto custom-scrollbar">- {!gridLoaded ? (+ <div className="relative overflow-y-auto custom-scrollbar min-h-62.5">+ <div+ className={`absolute inset-0 w-full transition-all duration-300 ease-out z-10 ${+ gridLoaded+ ? "opacity-0 blur-md pointer-events-none scale-105"+ : "opacity-100 blur-0 scale-100"+ }`}+ ><MockupGridSkeleton />- ) : (- <div className="p-3 grid grid-cols-3 gap-2">- {filteredMockups.map((mockup) => {- const categoryConfig = MOCKUP_CATEGORIES.find(c => c.id === mockup.category);- const isActive = mockupId === mockup.id;-- return (- <button- key={mockup.id}- onClick={() => handleMockupSelect(mockup.id)}- className={`group relative w-full h-28 squircle-element border-2 overflow-hidden shadow-lg transition-all active:scale-95 ${isActive- ? "border-blue-500 ring-2 ring-blue-500/50"- : "border-neutral-800 hover:border-white/20"- }`}- >- <div- className="absolute inset-0 bg-cover bg-center bg-no-repeat transition-transform duration-500 group-hover:scale-105"- style={{- backgroundImage: `url('${categoryConfig?.bgUrl || "https://i.ibb.co/r2JQ3Gcy/minimal-02.jpg"}')`- }}- >- <div className="absolute inset-0 flex items-center justify-center pointer-events-none">- {mockup.preview}- </div>- </div>+ </div>- <div className="absolute inset-0 group-hover:bg-black/5 transition-colors pointer-events-none" />+ <div+ className={`p-3 grid grid-cols-3 gap-2 transition-all duration-300 ease-out ${+ !gridLoaded+ ? "opacity-0 blur-md scale-95 pointer-events-none"+ : "opacity-100 blur-0 scale-100"+ }`}+ >+ {filteredMockups.map((mockup) => {+ const categoryConfig = MOCKUP_CATEGORIES.find(c => c.id === mockup.category);+ const isActive = mockupId === mockup.id;- <div className="absolute bottom-0 left-0 bg-black/60 backdrop-blur-md border-t border-r border-white/10 px-2 py-1 text-[9px] text-white/80 font-bold tracking-tighter rounded-tr-md rounded-bl-lg z-30">- {mockup.name}+ return (+ <button+ key={mockup.id}+ onClick={() => handleMockupSelect(mockup.id)}+ className={`group relative w-full h-28 squircle-element border-2 overflow-hidden shadow-lg transition-all active:scale-95 ${isActive+ ? "border-blue-500 ring-2 ring-blue-500/50"+ : "border-neutral-800 hover:border-white/20"+ }`}+ >+ <div+ className="absolute inset-0 bg-cover bg-center bg-no-repeat transition-transform duration-500 group-hover:scale-105"+ style={{+ backgroundImage: `url('${categoryConfig?.bgUrl || "https://i.ibb.co/r2JQ3Gcy/minimal-02.jpg"}')`+ }}+ >+ <div className="absolute inset-0 flex items-center justify-center pointer-events-none">+ {mockup.preview}</div>+ </div>- {isActive && (- <div className="absolute top-2 right-2 rounded-full shadow-[0_0_10px_rgba(96,165,250,0.8)] z-30">- <Icon icon="icon-park-solid:check-one" width="20" className="text-blue-500" />- </div>+ <div className="absolute inset-0 group-hover:bg-black/5 transition-colors pointer-events-none" />- )}- </button>+ <div className="absolute bottom-0 left-0 bg-black/60 backdrop-blur-md border-t border-r border-white/10 px-2 py-1 text-[9px] text-white/80 font-bold tracking-tighter rounded-tr-md rounded-bl-lg z-30">+ {mockup.name}+ </div>- );- })}- </div>- )}+ {isActive && (+ <div className="absolute top-2 right-2 rounded-full shadow-[0_0_10px_rgba(96,165,250,0.8)] z-30">+ <Icon icon="icon-park-solid:check-one" width="20" className="text-blue-500" />+ </div>+ )}+ </button>+ );+ })}+ </div></div></div></PopoverContent></Popover></div>- {/* Sugerencias cuando no hay mockup seleccionado */}+{mockupId === "none" && (<div className="space-y-2.5"><p className="text-[10px] uppercase tracking-widest text-white/40 font-bold">Sugeridos</p>@@ -251,7 +257,7 @@ export function MockupMenu({</div></div>)}- {/* Controles condicionales basados en features del mockup */}+{features.hasDarkMode && (<div className="flex items-center justify-between"><div className="flex items-center gap-2 text-[11px] text-white/55">@@ -283,7 +289,6 @@ export function MockupMenu({</div>)}- {/* Color del marco */}{features.hasFrameColor && (<div className="space-y-2.5"><p className="text-[10px] uppercase tracking-widest text-white/40 font-bold">@@ -317,7 +322,6 @@ export function MockupMenu({</div>)}- {/* URL de página */}{features.hasUrl && (<div className="space-y-2"><p className="text-[10px] uppercase tracking-widest text-white/40 font-bold">URL de página</p>@@ -334,7 +338,6 @@ export function MockupMenu({</div>)}- {/* Sliders */}{(features.hasHeaderScale || features.hasHeaderOpacity) && (<div className="space-y-3">{features.hasHeaderScale && (@@ -360,7 +363,6 @@ export function MockupMenu({</div>)}- {/* Quitar mockup - solo mostrar si no es "none" */}{mockupId !== "none" && (<buttononClick={() => handleMockupSelect("none")}diff --git a/app/components/ui/editor/PlayerControls.tsx b/app/components/ui/editor/PlayerControls.tsxindex 3866515..cd3bc0d 100644--- a/app/components/ui/editor/PlayerControls.tsx+++ b/app/components/ui/editor/PlayerControls.tsx@@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button";import { AspectRatioSelect } from "../AspectRatioSelect";import { formatTime } from "@/lib/video.utils";import type { PlayerControlsProps } from "@/types/player-control.types";+import { TooltipAction } from "@/components/ui/tooltip-action";const MIN_ZOOM = 1;const MAX_ZOOM = 10;@@ -96,30 +97,31 @@ export function PlayerControls({role="toolbar"aria-label="Controles de reproducción">- {/* ── Left: fullscreen + zoom ── */}<div className="flex items-center gap-3 text-xs">- <button- onClick={onToggleFullscreen}- className="text-zinc-500 hover:text-white transition-colors"- title={`${isFullscreen ? "Salir de pantalla completa" : "Pantalla completa"} (F)`}- aria-label={isFullscreen ? "Salir de pantalla completa" : "Pantalla completa"}- aria-pressed={isFullscreen}- >- <Icon icon={isFullscreen ? "typcn:arrow-minimise" : "typcn:arrow-maximise"} width="17" />- </button>+ <TooltipAction label={`${isFullscreen ? "Salir de pantalla completa" : "Pantalla completa"} (F)`}>+ <button+ onClick={onToggleFullscreen}+ className="text-zinc-500 hover:text-white transition-colors"+ aria-label={isFullscreen ? "Salir de pantalla completa" : "Pantalla completa"}+ aria-pressed={isFullscreen}+ >+ <Icon icon={isFullscreen ? "typcn:arrow-minimise" : "typcn:arrow-maximise"} width="17" />+ </button>+ </TooltipAction><div className="h-4 w-px bg-white/10" /><div className="flex items-center gap-2" role="group" aria-label="Zoom del timeline">- <button- onClick={handleZoomOut}- disabled={zoomLevel <= MIN_ZOOM}- className="text-zinc-500 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed"- title="Alejar timeline (↓)"- aria-label="Reducir zoom del timeline"- >- <Icon icon="mdi:magnify-minus-outline" width="16" />- </button>+ <TooltipAction label="Alejar timeline (↓)">+ <button+ onClick={handleZoomOut}+ disabled={zoomLevel <= MIN_ZOOM}+ className="text-zinc-500 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed"+ aria-label="Reducir zoom del timeline"+ >+ <Icon icon="mdi:magnify-minus-outline" width="16" />+ </button>+ </TooltipAction><div className="w-16 h-0.75 bg-white/10 rounded-full relative group cursor-pointer"><div@@ -144,17 +146,16 @@ export function PlayerControls({aria-valuenow={Math.round(zoomLevel)}/></div>-- <button- onClick={handleZoomIn}- disabled={zoomLevel >= MAX_ZOOM}- className="text-zinc-500 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed"- title="Acercar timeline (↑)"- aria-label="Aumentar zoom del timeline"- >- <Icon icon="mdi:magnify-plus-outline" width="16" />- </button>-+ <TooltipAction label="Acercar timeline (↑)">+ <button+ onClick={handleZoomIn}+ disabled={zoomLevel >= MAX_ZOOM}+ className="text-zinc-500 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed"+ aria-label="Aumentar zoom del timeline"+ >+ <Icon icon="mdi:magnify-plus-outline" width="16" />+ </button>+ </TooltipAction><span className="text-[10px] font-mono text-zinc-500 min-w-5" aria-live="polite" aria-atomic="true">{Math.round(zoomLevel)}×</span>@@ -170,33 +171,35 @@ export function PlayerControls({</span><div className="flex items-center gap-2.5">- <button- className="text-zinc-500 hover:text-white transition-colors"- onClick={onSkipBackward}- title="Retroceder 5s (← o J)"- aria-label="Retroceder 5 segundos"- >- <Icon icon="mdi:rewind-5" width="20" />- </button>-- <button- onClick={onTogglePlayPause}- className="w-9 h-9 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/10 text-white transition border border-white/10"- title={`${isPlaying ? "Pausar" : "Reproducir"} (Espacio o K)`}- aria-label={isPlaying ? "Pausar" : "Reproducir"}- aria-pressed={isPlaying}- >- <Icon icon={isPlaying ? "mdi:pause" : "mdi:play"} width="20" />- </button>+ <TooltipAction label="Retroceder 5s (← o J)">+ <button+ className="text-zinc-500 hover:text-white transition-colors"+ onClick={onSkipBackward}+ aria-label="Retroceder 5 segundos"+ >+ <Icon icon="mdi:rewind-5" width="20" />+ </button>+ </TooltipAction>+ <TooltipAction label={`${isPlaying ? "Pausar" : "Reproducir"} (Espacio o K)`}>+ <button+ onClick={onTogglePlayPause}+ className="w-9 h-9 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/10 text-white transition border border-white/10"+ aria-label={isPlaying ? "Pausar" : "Reproducir"}+ aria-pressed={isPlaying}+ >+ <Icon icon={isPlaying ? "mdi:pause" : "mdi:play"} width="20" />+ </button>+ </TooltipAction>+ <TooltipAction label="Avanzar 5s (→ o L)">+ <button+ className="text-zinc-500 hover:text-white transition-colors"+ onClick={onSkipForward}+ aria-label="Avanzar 5 segundos"+ >+ <Icon icon="mdi:fast-forward-5" width="20" />+ </button>+ </TooltipAction>- <button- className="text-zinc-500 hover:text-white transition-colors"- onClick={onSkipForward}- title="Avanzar 5s (→ o L)"- aria-label="Avanzar 5 segundos"- >- <Icon icon="mdi:fast-forward-5" width="20" />- </button></div><span@@ -208,18 +211,20 @@ export function PlayerControls({</div><div className="flex items-center gap-2">- <Button- variant="outline"- size="sm"- className="gap-1.5 px-3 py-1.5 text-xs"- onClick={onOpenCropper}- aria-label="Abrir recortador de video"- title="Abrir recortador de video"- >- <Icon icon="mdi:crop" width="14" /> Recortar- </Button>- <AspectRatioSelect- value={aspectRatio}+ <TooltipAction label="Abrir recortador de video">+ <Button+ variant="outline"+ size="sm"+ className="gap-1.5 px-3 py-1.5 text-xs"+ onClick={onOpenCropper}+ aria-label="Abrir recortador de video"+ >+ <Icon icon="mdi:crop" width="14" /> Recortar+ </Button>+ </TooltipAction>++ <AspectRatioSelect+ value={aspectRatio}onChange={onAspectRatioChange}customDimensions={customAspectRatio}onCustomDimensionsChange={onCustomAspectRatioChange}diff --git a/app/components/ui/editor/Timeline.tsx b/app/components/ui/editor/Timeline.tsxindex 62a79de..f31bb56 100644--- a/app/components/ui/editor/Timeline.tsx+++ b/app/components/ui/editor/Timeline.tsx@@ -53,10 +53,11 @@ export function Timeline({const [isHoveringZoomRow, setIsHoveringZoomRow] = useState(false);const [ghostX, setGhostX] = useState(0);const validDuration = Number.isFinite(videoDuration) && videoDuration > 0 ? videoDuration : 0;++ // Store pending trim values during drag to avoid excessive parent updates+ const pendingTrimRef = useRef<{ start: number; end: number } | null>(null);// Trimmed duration for display- const trimmedDuration = useMemo(() => {- return trimRange.end - trimRange.start;- }, [trimRange]);+const TRACK_PADDING = 16;@@ -69,7 +70,29 @@ export function Timeline({const playheadX = useMotionValue(0);const trimStartX = useMotionValue(0);const trimEndX = useMotionValue(0);+ const contentWidthMotion = useMotionValue(0);+ const validDurationMotion = useMotionValue(0);++ useEffect(() => {+ contentWidthMotion.set(contentWidth);+ }, [contentWidth, contentWidthMotion]);+ useEffect(() => {+ validDurationMotion.set(validDuration);+ }, [validDuration, validDurationMotion]);+ const calculateDuration = useCallback(([start, end, cw, vd]: number[]) => {+ if (cw === 0 || vd === 0) return 0;+ return ((end - start) / cw) * vd;+ }, []);+ const trimmedDurationLabel = useTransform(+ [trimStartX, trimEndX, contentWidthMotion, validDurationMotion] as const,+ ([start, end, cw, vd]: number[]) => {+ const prefix = videoUrl ? 'Media Clip' : 'No Media';+ if (cw === 0 || vd === 0) return `${prefix} · 0:00`;+ const secs = ((end - start) / cw) * vd;+ return `${prefix} · ${formatTime(secs)}`;+ }+ );// Calculate trim handle positionsconst trimStartPosition = useMemo(() => {if (validDuration === 0 || contentWidth === 0) return 0;@@ -201,14 +224,10 @@ export function Timeline({const newX = Math.max(0, Math.min(trimEndX.get() - (MIN_TRIM_DURATION / validDuration) * contentWidth, trimStartX.get() + info.delta.x));trimStartX.set(newX);+ // Store pending value without triggering parent updateconst newStartTime = (newX / contentWidth) * validDuration;- onTrimChange({ ...trimRange, start: Math.max(0, newStartTime) });-- // If playhead is before new start, move it- if (currentTime < newStartTime) {- onSeek(newStartTime);- }- }, [contentWidth, validDuration, trimStartX, trimEndX, trimRange, onTrimChange, currentTime, onSeek]);+ pendingTrimRef.current = { start: Math.max(0, newStartTime), end: trimRange.end };+ }, [contentWidth, validDuration, trimStartX, trimEndX, trimRange.end]);const handleTrimEndDrag = useCallback((_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {if (contentWidth === 0 || validDuration === 0) return;@@ -216,22 +235,33 @@ export function Timeline({const newX = Math.min(contentWidth, Math.max(trimStartX.get() + (MIN_TRIM_DURATION / validDuration) * contentWidth, trimEndX.get() + info.delta.x));trimEndX.set(newX);+ // Store pending value without triggering parent updateconst newEndTime = (newX / contentWidth) * validDuration;- onTrimChange({ ...trimRange, end: Math.min(validDuration, newEndTime) });-- // If playhead is after new end, move it- if (currentTime > newEndTime) {- onSeek(newEndTime);- }- }, [contentWidth, validDuration, trimStartX, trimEndX, trimRange, onTrimChange, currentTime, onSeek]);+ pendingTrimRef.current = { start: trimRange.start, end: Math.min(validDuration, newEndTime) };+ }, [contentWidth, validDuration, trimStartX, trimEndX, trimRange.start]);const handleTrimDragStart = useCallback((handle: 'start' | 'end') => {setIsDraggingTrim(handle);+ pendingTrimRef.current = null;}, []);const handleTrimDragEnd = useCallback(() => {setIsDraggingTrim(null);- }, []);++ // Apply pending trim change+ if (pendingTrimRef.current) {+ onTrimChange(pendingTrimRef.current);++ // Adjust playhead if needed+ if (currentTime < pendingTrimRef.current.start) {+ onSeek(pendingTrimRef.current.start);+ } else if (currentTime > pendingTrimRef.current.end) {+ onSeek(pendingTrimRef.current.end);+ }++ pendingTrimRef.current = null;+ }+ }, [onTrimChange, currentTime, onSeek]);// Auto-scroll when playhead near edgeuseEffect(() => {@@ -248,17 +278,28 @@ export function Timeline({}}, [playheadPosition, isDragging]);- const clipLeft = trimStartPosition;- const clipWidth = trimEndPosition - trimStartPosition;+ const calculateProgressWidth = useCallback(([px, start, end]: number[]) => {+ const width = end - start;+ if (width <= 0) return 0;+ const clampedX = Math.max(start, Math.min(px, end));+ return Math.max(0, clampedX - start);+ }, []);- // Derive progress width directly from playheadX motion value for perfect syncconst progressWidth = useTransform(- playheadX,- (x) => {- if (clipWidth <= 0) return 0;- const clampedX = Math.max(trimStartPosition, Math.min(x, trimEndPosition));- return Math.max(0, clampedX - trimStartPosition);- }+ [playheadX, trimStartX, trimEndX] as const,+ calculateProgressWidth+ );++ const clipLeftMotion = useTransform(trimStartX, (x) => x);+ const clipWidthMotion = useTransform(+ [trimStartX, trimEndX] as const,+ ([start, end]: number[]) => Math.max(end - start, 20)+ );+ const trimOverlayLeftWidth = useTransform(trimStartX, (x) => x);+ const trimOverlayRightLeft = useTransform(trimEndX, (x) => x);+ const trimOverlayRightWidth = useTransform(+ [trimEndX, contentWidthMotion] as const,+ ([end, cw]: number[]) => cw - end);return (@@ -277,7 +318,6 @@ export function Timeline({><div style={{ width: contentWidth > 0 ? contentWidth : '100%' }} className="relative flex flex-col h-full">-{/* Playhead */}<motion.divclassName="absolute top-0 bottom-0 z-20 flex flex-col items-center cursor-ew-resize group select-none"@@ -336,22 +376,22 @@ export function Timeline({style={{ width: contentWidth > 0 ? contentWidth : '100%' }}>{trimRange.start > 0 && (- <div+ <motion.divclassName="absolute left-0 top-0 bottom-0 bg-black/60 rounded-l-md z-10"- style={{ width: trimStartPosition }}+ style={{ width: trimOverlayLeftWidth }}/>)}{trimRange.end < validDuration && (- <div+ <motion.divclassName="absolute right-0 top-0 bottom-0 bg-black/60 rounded-r-md z-10"- style={{ width: contentWidth - trimEndPosition }}+ style={{ left: trimOverlayRightLeft, width: trimOverlayRightWidth }}/>)}{/* Active clip region */}- <div+ <motion.divclassName="absolute top-0 bottom-0 rounded-md border border-[#34A853]/40 bg-[#182e20] overflow-hidden"- style={{ left: clipLeft, width: Math.max(clipWidth, 20) }}+ style={{ left: clipLeftMotion, width: clipWidthMotion }}><div className="absolute inset-0 flex items-center overflow-hidden"><div className="flex h-full w-full">@@ -375,11 +415,10 @@ export function Timeline({boxShadow: 'inset 0 1px 0 rgba(255,255,255,0.2)'}}/>- <span className="flex items-center justify-center gap-2 text-emerald-400 text-[11px] font-medium ml-3 relative z-10 drop-shadow-sm h-full">- {videoUrl ? 'Media Clip' : 'No Media'} · {formatTime(trimmedDuration)}- </span>- </div>-+ <motion.span className="flex items-center justify-center gap-2 text-emerald-400 text-[11px] font-medium ml-3 relative z-10 drop-shadow-sm h-full">+ {trimmedDurationLabel}+ </motion.span>+ </motion.div>{/* Trim Start Handle */}<motion.divclassName="absolute top-0 bottom-0 w-3 cursor-ew-resize z-20 group/trim flex items-center justify-center"@@ -522,12 +561,11 @@ export function Timeline({{/* Audio track - only show if there are audio tracks */}{audioTracks.length > 0 && (- <div className="flex-1 flex items-center border-t border-white/5 relative">+ <div className="h-5 shrink-0 flex items-center border-t border-white/5 relative"><divclassName="h-full flex items-center relative"style={{ width: contentWidth > 0 ? contentWidth : '100%' }}>- {/* Audio fragments with drag/resize */}{audioTracks.map((track) => {const audio = uploadedAudios?.find(a => a.id === track.audioId);return (diff --git a/app/components/ui/editor/ToolsSidebar.tsx b/app/components/ui/editor/ToolsSidebar.tsxindex 129bb7c..7aa1582 100644--- a/app/components/ui/editor/ToolsSidebar.tsx+++ b/app/components/ui/editor/ToolsSidebar.tsx@@ -3,7 +3,8 @@import { Icon } from "@iconify/react";import { SidebarTool } from "../SidebarTool";import type { ToolsSidebarProps } from "@/types/tool-sidebar.types";-import { useRef } from "react";+import { useRef, useState } from "react";+import { TooltipAction } from "@/components/ui/tooltip-action";interface ExtendedToolsSidebarProps extends ToolsSidebarProps {onVideoUpload?: (file: File) => void;@@ -17,12 +18,12 @@ export function ToolsSidebar({isUploading = false}: ExtendedToolsSidebarProps) {const fileInputRef = useRef<HTMLInputElement>(null);+ const [isDragging, setIsDragging] = useState(false);const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {const file = e.target.files?.[0];if (file && onVideoUpload) {onVideoUpload(file);- // Reset input para permitir subir el mismo archivo nuevamentee.target.value = '';}};@@ -30,6 +31,33 @@ export function ToolsSidebar({const handleUploadClick = () => {fileInputRef.current?.click();};++ const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {+ e.preventDefault();+ e.stopPropagation();+ if (!isDragging) setIsDragging(true); // Activamos el estado visual+ };++ const handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {+ e.preventDefault();+ e.stopPropagation();+ setIsDragging(false); // Desactivamos el estado visual al salir+ };++ const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {+ e.preventDefault();+ e.stopPropagation();+ setIsDragging(false); // Desactivamos el estado visual al soltar++ if (isUploading) return;++ const file = e.dataTransfer.files?.[0];++ if (file && file.type.startsWith("video/") && onVideoUpload) {+ onVideoUpload(file);+ }+ };+return (<div className="relative shrink-0 bg-[#141417]" style={{ width: '90px' }}><div className="h-13 border-b border-white/10 w-full" />@@ -44,7 +72,7 @@ export function ToolsSidebar({><div className="flex flex-col gap-4 w-full overflow-y-auto p-2"><SidebarTool- icon="gravity-ui:picture"+ icon="solar:gallery-wide-linear"label="Fondo"isActive={activeTool === "screenshot"}onClick={() => onToolChange("screenshot")}@@ -86,33 +114,51 @@ export function ToolsSidebar({/><SidebarTool- icon="hugeicons:browser"+ icon="hugeicons:ai-browser"label="Mockup"isActive={activeTool === "mockup"}onClick={() => onToolChange("mockup")}/></div>- <div className="w-full p-2 relative flex flex-col items-center shrink-0 group">+ <div+ className="w-full p-2 relative flex flex-col items-center shrink-0 group"+ onDragOver={handleDragOver}+ onDragLeave={handleDragLeave}+ onDrop={handleDrop}+ ><div className="absolute -top-0.5 left-0 w-full border-t border-white/10" />- <button- onClick={handleUploadClick}- disabled={isUploading}- className="w-full flex flex-col items-center text-center justify-center gap-1.5 p-2 rounded-xl cursor-pointer hover:bg-blue-500/20 text-white/60 hover:text-blue-400 transition-all group disabled:opacity-50 disabled:cursor-not-allowed"- title={isUploading ? "Subiendo video..." : "Subir video personalizado"}- >- {isUploading ? (- <>- <Icon icon="svg-spinners:ring-resize" className="transition-transform duration-300" width="24" height="24" />- <span className="text-xs font-medium">Subiendo...</span>- </>- ) : (- <>- <Icon icon="mage:video-upload" className="transition-transform duration-300 group-hover:scale-105" width="24" height="24" />- <span className="text-xs font-medium">Subir video</span>- </>- )}- </button>+ <TooltipAction label={isUploading ? "Subiendo video..." : "Subir video personalizado"}>+ <button+ onClick={handleUploadClick}+ disabled={isUploading}+ className={`w-full flex flex-col items-center text-center justify-center gap-1.5 p-2 rounded-xl cursor-pointer transition-all group disabled:opacity-50 disabled:cursor-not-allowed border-2+ ${isDragging+ ? "bg-blue-500/20 text-blue-400 border-dashed border-blue-400/50 scale-105"+ : "border-transparent text-white/60 hover:bg-blue-500/20 hover:text-blue-400"+ }+ `}+ >+ {isUploading ? (+ <>+ <Icon icon="svg-spinners:ring-resize" className="transition-transform duration-300" width="24" height="24" />+ <span className="text-xs font-medium">Subiendo...</span>+ </>+ ) : (+ <>+ <Icon+ icon="mage:video-upload"+ className={`transition-transform duration-300 ${!isDragging && "group-hover:scale-105"}`}+ width="24"+ height="24"+ />+ <span className="text-xs font-medium">+ {isDragging ? "Suelta aquí" : "Subir video"}+ </span>+ </>+ )}+ </button>+ </TooltipAction><inputref={fileInputRef}type="file"diff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsxindex cc87750..b0ed10b 100644--- a/app/components/ui/editor/VideoCanvas.tsx+++ b/app/components/ui/editor/VideoCanvas.tsx@@ -14,17 +14,9 @@ import { MockupWrapper } from "./mockups/MockupWrapper";import { DEFAULT_MOCKUP_CONFIG } from "@/types/mockup.types";import { calculateSmoothZoom } from "@/lib/canvas.utils";import { SVG_COMPONENTS, getSvgDataUrl } from "@/components/canvas-svg";+import { VIDEO_Z_INDEX, BOTTOM_ONLY_RADIUS_MOCKUPS, SELF_SHADOWING_MOCKUPS } from "@/lib/constants";export type { VideoCanvasHandle, VideoCanvasProps };-// Mockups con header → solo esquinas INFERIORES del video redondeadas-const BOTTOM_ONLY_RADIUS_MOCKUPS = ["macos", "macos-glass", "macos-ghost", "macos-ghost-glass", "vscode", "macos-dark-ide", "macos-ghost-ide", "brave", "brave-glass", "browser-tab-glass", "chrome", "chrome-glass"];--// Mockups glass → manejan su propia sombra, no necesitan el rect sólido previo-const SELF_SHADOWING_MOCKUPS = ["macos-glass", "macos-ghost-glass", "glass-ui-container", "macos-container-glass", "brave-glass", "browser-tab-glass", "chrome-glass"];--// Z-index del video: elementos con zIndex < VIDEO_Z_INDEX se renderizan detrás del video-export const VIDEO_Z_INDEX = 1000;-export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(function VideoCanvas({videoRef,videoUrl,@@ -294,7 +286,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functlet deltaAngle = currentAngle - startAngle;if (deltaAngle > 180) deltaAngle -= 360;if (deltaAngle < -180) deltaAngle += 360;-+const newRotation = elementDragStart.current.initialRotation + deltaAngle;onElementUpdate(selectedElementId, { rotation: newRotation });@@ -340,7 +332,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functcanvasHeight: number,behindVideo: boolean) => {- const filteredElements = elements.filter(el =>+ const filteredElements = elements.filter(el =>behindVideo ? el.zIndex < VIDEO_Z_INDEX : el.zIndex >= VIDEO_Z_INDEX);const sortedElements = [...filteredElements].sort((a, b) => a.zIndex - b.zIndex);@@ -639,7 +631,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct}));return (- <div className="flex-1 flex items-center justify-center min-h-0 min-w-0 overflow-hidden bg-[#09090B] p-4 sm:p-1">+ <div className="flex-1 flex items-center justify-center min-h-0 min-w-0 overflow-hidden bg-[#09090B] p-2 sm:p-4 lg:p-1">{/* Canvas oculto para exportación */}<canvasref={exportCanvasRef}@@ -650,11 +642,16 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct{/* Preview visual - contenedor con tamaño dinámico según aspect ratio */}<div- className="relative h-full max-h-full max-w-full shrink-0 overflow-hidden border border-white/20 rounded-xl transition-all duration-300"+ className="relative h-full max-h-full w-full max-w-full shrink-0 overflow-hidden border border-white/20 rounded-xl transition-all duration-300"style={{aspectRatio: getAspectRatioStyle(aspectRatio, customAspectRatio ?? undefined),maxWidth: getMaxWidth(aspectRatio, customAspectRatio ?? undefined),}}+ onClick={(e) => {+ if (!(e.target as HTMLElement).closest('[data-canvas-element]') && onElementSelect) {+ onElementSelect(null);+ }+ }}>{/* Zoom container - applies zoom to entire composition (background + video) */}<div@@ -815,6 +812,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct<imgsrc={currentThumbnail.dataUrl}alt="Preview"+ crossOrigin="anonymous"className="absolute inset-0 w-full h-full object-contain"/>)}@@ -833,7 +831,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct{/* Capa 3: Canvas elements ABOVE video (zIndex >= VIDEO_Z_INDEX) */}<CanvasElementsLayer- canvasContainerRef={canvasContainerRef}+ canvasContainerRef={canvasContainerRef}canvasElements={canvasElements}selectedElementId={selectedElementId}hoveredElementId={hoveredElementId}@@ -853,9 +851,9 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct);});-{/* Canvas Elements Layer Component - renders elements either behind or above video */}+{/* Canvas Elements Layer Component - renders elements either behind or above video */ }function CanvasElementsLayer({- canvasContainerRef,+ canvasContainerRef,canvasElements,selectedElementId,hoveredElementId,@@ -869,7 +867,7 @@ function CanvasElementsLayer({elementDragStart,layerZIndex,}: {- canvasContainerRef?: React.RefObject<HTMLDivElement | null>;+ canvasContainerRef?: React.RefObject<HTMLDivElement | null>;canvasElements: CanvasElement[];selectedElementId: string | null;hoveredElementId: string | null;@@ -895,7 +893,7 @@ function CanvasElementsLayer({return (<div- ref={canvasContainerRef}+ ref={canvasContainerRef}className="absolute inset-0"onClick={(e) => {// Deselect element if clicking on background (not on an element)@@ -907,35 +905,70 @@ function CanvasElementsLayer({>{/* Sort elements by zIndex for proper layering */}{[...filteredElements].sort((a, b) => a.zIndex - b.zIndex).map((element) => {- const isSelected = selectedElementId === element.id;- const isHovered = hoveredElementId === element.id;+ const isSelected = selectedElementId === element.id;+ const isHovered = hoveredElementId === element.id;++ if (element.type === "svg") {+ return (+ <div+ key={element.id}+ data-canvas-element+ className="absolute pointer-events-auto cursor-move"+ style={{+ left: `${element.x}%`,+ top: `${element.y}%`,+ width: `${element.width}%`,+ height: `${element.height}%`,+ transform: `translate(-50%, -50%) rotate(${element.rotation}deg)`,+ zIndex: element.zIndex,+ transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',+ }}+ onMouseEnter={() => setHoveredElementId(element.id)}+ onMouseLeave={() => setHoveredElementId(null)}+ onMouseDown={(e) => {+ if (!onElementSelect) return;+ // Only start dragging if not clicking on rotation handle+ if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;++ e.preventDefault();+ e.stopPropagation();+ onElementSelect(element.id);+ setIsDraggingElement(true);+ elementDragStart.current = {+ x: e.clientX,+ y: e.clientY,+ initialX: element.x,+ initialY: element.y,+ initialRotation: element.rotation,+ };+ }}+ >+ {/* SVG element - render inline with color */}+ {(() => {+ const SvgComponent = SVG_COMPONENTS[element.svgId];+ if (!SvgComponent) return null;+ return (+ <div className="w-full h-full" style={{ opacity: element.opacity }}>+ <SvgComponent color={element.color} className="w-full h-full" />+ </div>+ );+ })()}- if (element.type === "svg") {- return (+ {/* Selection border and rotation handle */}+ {(isSelected || isHovered) && (+ <>+ <div+ className={`absolute -inset-px border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}+ style={{ borderRadius: '2px' }}+ />+ {isSelected && onElementUpdate && (<div- key={element.id}- className="absolute pointer-events-auto cursor-move"- style={{- left: `${element.x}%`,- top: `${element.y}%`,- width: `${element.width}%`,- height: `${element.height}%`,- transform: `translate(-50%, -50%) rotate(${element.rotation}deg)`,- opacity: element.opacity,- zIndex: element.zIndex,- transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',- }}- onMouseEnter={() => setHoveredElementId(element.id)}- onMouseLeave={() => setHoveredElementId(null)}+ data-element-rotation+ className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default"onMouseDown={(e) => {- if (!onElementSelect) return;- // Only start dragging if not clicking on rotation handle- if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;-e.preventDefault();e.stopPropagation();- onElementSelect(element.id);- setIsDraggingElement(true);+ setIsDraggingElementRotation(true);elementDragStart.current = {x: e.clientX,y: e.clientY,@@ -945,79 +978,79 @@ function CanvasElementsLayer({};}}>- {/* SVG element - render inline with color */}- {(() => {- const SvgComponent = SVG_COMPONENTS[element.svgId];- if (!SvgComponent) return null;- return <SvgComponent color={element.color} className="w-full h-full" />;- })()}-- {/* Selection border and rotation handle */}- {(isSelected || isHovered) && (- <>- <div- className={`absolute -inset-px border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}- style={{ borderRadius: '2px' }}- />- {isSelected && onElementUpdate && (- <div- data-element-rotation- className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default"- onMouseDown={(e) => {- e.preventDefault();- e.stopPropagation();- setIsDraggingElementRotation(true);- elementDragStart.current = {- x: e.clientX,- y: e.clientY,- initialX: element.x,- initialY: element.y,- initialRotation: element.rotation,- };- }}- >- <div className="p-0.5 border border-blue-500 hover:border-blue-400 rounded shadow-sm bg-[#111]">- <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" className="text-blue-500">- <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />- </svg>- </div>- <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">- <div className="w-px h-1 bg-blue-500" />- <div className="w-1 h-1 rounded-full bg-blue-500" />- </div>- </div>- )}- </>- )}+ <div className="p-0.5 border border-blue-500 hover:border-blue-400 rounded shadow-sm bg-[#111]">+ <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" className="text-blue-500">+ <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />+ </svg>+ </div>+ <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">+ <div className="w-px h-1 bg-blue-500" />+ <div className="w-1 h-1 rounded-full bg-blue-500" />+ </div></div>- );- }+ )}+ </>+ )}+ </div>+ );+ }++ if (element.type === "image") {+ return (+ <div+ key={element.id}+ data-canvas-element+ className="absolute pointer-events-auto cursor-move"+ style={{+ left: `${element.x}%`,+ top: `${element.y}%`,+ width: `${element.width}%`,+ height: `${element.height}%`,+ transform: `translate(-50%, -50%) rotate(${element.rotation}deg)`,+ zIndex: element.zIndex,+ transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',+ }}+ onMouseEnter={() => setHoveredElementId(element.id)}+ onMouseLeave={() => setHoveredElementId(null)}+ onMouseDown={(e) => {+ if (!onElementSelect) return;+ if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;- if (element.type === "image") {- return (+ e.preventDefault();+ e.stopPropagation();+ onElementSelect(element.id);+ setIsDraggingElement(true);+ elementDragStart.current = {+ x: e.clientX,+ y: e.clientY,+ initialX: element.x,+ initialY: element.y,+ initialRotation: element.rotation,+ };+ }}+ >+ <img+ src={element.imagePath}+ alt="Image element"+ crossOrigin="anonymous"+ className="w-full h-full object-contain rounded"+ style={{ pointerEvents: 'none', opacity: element.opacity }}+ />++ {(isSelected || isHovered) && (+ <>+ <div+ className={`absolute -inset-px border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}+ style={{ borderRadius: '2px' }}+ />+ {isSelected && onElementUpdate && (<div- key={element.id}- className="absolute pointer-events-auto cursor-move"- style={{- left: `${element.x}%`,- top: `${element.y}%`,- width: `${element.width}%`,- height: `${element.height}%`,- transform: `translate(-50%, -50%) rotate(${element.rotation}deg)`,- opacity: element.opacity,- zIndex: element.zIndex,- transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',- }}- onMouseEnter={() => setHoveredElementId(element.id)}- onMouseLeave={() => setHoveredElementId(null)}+ data-element-rotation+ className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default"onMouseDown={(e) => {- if (!onElementSelect) return;- if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;-e.preventDefault();e.stopPropagation();- onElementSelect(element.id);- setIsDraggingElement(true);+ setIsDraggingElementRotation(true);elementDragStart.current = {x: e.clientX,y: e.clientY,@@ -1027,76 +1060,84 @@ function CanvasElementsLayer({};}}>- <img- src={element.imagePath}- alt="Image element"- className="w-full h-full object-cover rounded"- style={{ pointerEvents: 'none' }}- />-- {(isSelected || isHovered) && (- <>- <div- className={`absolute -inset-px border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}- style={{ borderRadius: '2px' }}- />- {isSelected && onElementUpdate && (- <div- data-element-rotation- className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default"- onMouseDown={(e) => {- e.preventDefault();- e.stopPropagation();- setIsDraggingElementRotation(true);- elementDragStart.current = {- x: e.clientX,- y: e.clientY,- initialX: element.x,- initialY: element.y,- initialRotation: element.rotation,- };- }}- >- <div className="p-0.5 border border-blue-500 hover:border-blue-400 rounded shadow-sm bg-[#111]">- <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" className="text-blue-500">- <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />- </svg>- </div>- <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">- <div className="w-px h-1 bg-blue-500" />- <div className="w-1 h-1 rounded-full bg-blue-500" />- </div>- </div>- )}- </>- )}+ <div className="p-0.5 border border-blue-500 hover:border-blue-400 rounded shadow-sm bg-[#111]">+ <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" className="text-blue-500">+ <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />+ </svg>+ </div>+ <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">+ <div className="w-px h-1 bg-blue-500" />+ <div className="w-1 h-1 rounded-full bg-blue-500" />+ </div></div>- );- }+ )}+ </>+ )}+ </div>+ );+ }++ if (element.type === "text") {+ return (+ <div+ key={element.id}+ data-canvas-element+ className="absolute pointer-events-auto cursor-move select-none"+ style={{+ left: `${element.x}%`,+ top: `${element.y}%`,+ transform: `translate(-50%, -50%) rotate(${element.rotation}deg)`,+ zIndex: element.zIndex,+ transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',+ }}+ onMouseEnter={() => setHoveredElementId(element.id)}+ onMouseLeave={() => setHoveredElementId(null)}+ onMouseDown={(e) => {+ if (!onElementSelect) return;+ if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;- if (element.type === "text") {- return (+ e.preventDefault();+ e.stopPropagation();+ onElementSelect(element.id);+ setIsDraggingElement(true);+ elementDragStart.current = {+ x: e.clientX,+ y: e.clientY,+ initialX: element.x,+ initialY: element.y,+ initialRotation: element.rotation,+ };+ }}+ >+ <div+ className="whitespace-nowrap"+ style={{+ fontSize: `${element.fontSize}px`,+ fontFamily: element.fontFamily,+ fontWeight: element.fontWeight === 'normal' ? 400 : element.fontWeight === 'medium' ? 500 : 700,+ textAlign: 'center',+ color: element.color,+ pointerEvents: 'none',+ opacity: element.opacity,+ }}+ >+ {element.content}+ </div>++ {(isSelected || isHovered) && (+ <>+ <div+ className={`absolute -inset-x-2 -inset-y-1 border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}+ style={{ borderRadius: '2px' }}+ />+ {isSelected && onElementUpdate && (<div- key={element.id}- className="absolute pointer-events-auto cursor-move select-none"- style={{- left: `${element.x}%`,- top: `${element.y}%`,- transform: `translate(-50%, -50%) rotate(${element.rotation}deg)`,- opacity: element.opacity,- zIndex: element.zIndex,- transition: isDraggingElement ? 'none' : 'transform 0.1s ease-out',- }}- onMouseEnter={() => setHoveredElementId(element.id)}- onMouseLeave={() => setHoveredElementId(null)}+ data-element-rotation+ className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default"onMouseDown={(e) => {- if (!onElementSelect) return;- if ((e.target as HTMLElement).closest('[data-element-rotation]')) return;-e.preventDefault();e.stopPropagation();- onElementSelect(element.id);- setIsDraggingElement(true);+ setIsDraggingElementRotation(true);elementDragStart.current = {x: e.clientX,y: e.clientY,@@ -1106,62 +1147,25 @@ function CanvasElementsLayer({};}}>- <div- className="whitespace-nowrap"- style={{- fontSize: `${element.fontSize}px`,- fontFamily: element.fontFamily,- fontWeight: element.fontWeight === 'normal' ? 400 : element.fontWeight === 'medium' ? 500 : 700,- textAlign: 'center',- color: element.color,- pointerEvents: 'none',- }}- >- {element.content}+ <div className="p-0.5 border border-blue-500 hover:border-blue-400 rounded shadow-sm bg-[#111]">+ <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" className="text-blue-500">+ <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />+ </svg>+ </div>+ <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">+ <div className="w-px h-1 bg-blue-500" />+ <div className="w-1 h-1 rounded-full bg-blue-500" /></div>-- {(isSelected || isHovered) && (- <>- <div- className={`absolute -inset-x-2 -inset-y-1 border pointer-events-none ${isSelected ? 'border-blue-500' : 'border-white/50'}`}- style={{ borderRadius: '2px' }}- />- {isSelected && onElementUpdate && (- <div- data-element-rotation- className="absolute -top-5 left-1/2 -translate-x-1/2 z-20 cursor-default"- onMouseDown={(e) => {- e.preventDefault();- e.stopPropagation();- setIsDraggingElementRotation(true);- elementDragStart.current = {- x: e.clientX,- y: e.clientY,- initialX: element.x,- initialY: element.y,- initialRotation: element.rotation,- };- }}- >- <div className="p-0.5 border border-blue-500 hover:border-blue-400 rounded shadow-sm bg-[#111]">- <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" className="text-blue-500">- <path fill="currentColor" d="M17.707 3.293a1 1 0 1 0-1.414 1.414l2.294 2.294H11.5a4.5 4.5 0 0 0-4.5 4.5v7.086l-2.293-2.293a1 1 0 1 0-1.414 1.415l4 4a1 1 0 0 0 1.415 0l4-4a1 1 0 0 0-1.415-1.415L9 18.587v-7.086a2.5 2.5 0 0 1 2.5-2.5h7.086l-2.293 2.293a1 1 0 1 0 1.414 1.414l4-4a1 1 0 0 0 0-1.414z" />- </svg>- </div>- <div className="absolute top-full left-1/2 -translate-x-1/2 flex flex-col items-center">- <div className="w-px h-1 bg-blue-500" />- <div className="w-1 h-1 rounded-full bg-blue-500" />- </div>- </div>- )}- </>- )}</div>- );- }+ )}+ </>+ )}+ </div>+ );+ }- return null;- })}+ return null;+ })}</div>);}diff --git a/app/components/ui/editor/ZoomFragmentEditor.tsx b/app/components/ui/editor/ZoomFragmentEditor.tsxindex d424efb..f49a96d 100644--- a/app/components/ui/editor/ZoomFragmentEditor.tsx+++ b/app/components/ui/editor/ZoomFragmentEditor.tsx@@ -6,6 +6,7 @@ import { SliderControl } from "../SliderControl";import type { ZoomFragment } from "@/types/zoom.types";import { formatZoomTime, zoomLevelToFactor, speedToTransitionMs } from "@/types/zoom.types";import type { VideoThumbnail } from "@/types/editor.types";+import { TooltipAction } from "@/components/ui/tooltip-action";interface ZoomFragmentEditorProps {fragment: ZoomFragment;@@ -83,14 +84,15 @@ export function ZoomFragmentEditor({<div className="flex items-center gap-2 min-w-0"><span className="text-md font-medium text-white truncate">Fragmento de zoom</span></div>- <button- onClick={onDelete}- className="ml-auto flex items-center gap-1.5 text-[10px] text-red-400/70 hover:text-red-400 px-2 py-1 rounded-md transition-colors shrink-0"- title="Eliminar fragmento (Delete)"- >- <Icon icon="ph:trash-bold" width="12" />- Eliminar- </button>+ <TooltipAction label="Eliminar fragmento (Delete)">+ <button+ onClick={onDelete}+ className="ml-auto flex items-center gap-1.5 text-[10px] text-red-400/70 hover:text-red-400 px-2 py-1 rounded-md transition-colors shrink-0"+ >+ <Icon icon="ph:trash-bold" width="12" />+ Eliminar+ </button>+ </TooltipAction></div><div className="flex-1 overflow-y-auto custom-scrollbar px-4 py-4 space-y-5">@@ -123,7 +125,7 @@ export function ZoomFragmentEditor({) : null}<div- className="absolute border border-dashed border-blue-500/50 bg-gradient-to-b from-blue-500/30 to-transparent squircle-element pointer-events-none"+ className="absolute border border-dashed border-blue-500/50 bg-linear-to-b from-blue-500/30 to-transparent squircle-element pointer-events-none"style={{width: `${100 / zoomLevelToFactor(fragment.zoomLevel)}%`,height: `${100 / zoomLevelToFactor(fragment.zoomLevel)}%`,diff --git a/components/ui/button.tsx b/components/ui/button.tsxindex 4b58251..52a05dd 100644--- a/components/ui/button.tsx+++ b/components/ui/button.tsx@@ -5,7 +5,7 @@ import { Slot } from "radix-ui"import { cn } from "@/lib/utils"const buttonVariants = cva(- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",+ "inline-flex items-center justify-center gap-2 whitespace-nowrap squircle-element text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants: {variant: {@@ -23,12 +23,12 @@ const buttonVariants = cva(},size: {default: "h-9 px-4 py-2 has-[>svg]:px-3",- xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",- xl: "h-14 rounded-md px-10 has-[>svg]:px-8",+ xs: "h-6 gap-1 squircle-element px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",+ sm: "h-8 squircle-element gap-1.5 px-3 has-[>svg]:px-2.5",+ lg: "h-10 squircle-element px-6 has-[>svg]:px-4",+ xl: "h-14 squircle-element px-10 has-[>svg]:px-8",icon: "size-9",- "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",+ "icon-xs": "size-6 squircle-element [&_svg:not([class*='size-'])]:size-3","icon-sm": "size-8","icon-lg": "size-10",},diff --git a/components/ui/tooltip-action.tsx b/components/ui/tooltip-action.tsxnew file mode 100644index 0000000..05d71a4--- /dev/null+++ b/components/ui/tooltip-action.tsx@@ -0,0 +1,23 @@+import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip"+interface TooltipActionProps {+ children: React.ReactNode;+ label: string;+ side?: "top" | "bottom" | "left" | "right";+}++export function TooltipAction({ children, label, side = "bottom" }: TooltipActionProps) {+ return (+ <Tooltip delayDuration={100}>+ <TooltipTrigger asChild>+ {children}+ </TooltipTrigger>+ <TooltipContent+ side={side}+ sideOffset={5}+ className="bg-white text-black border border-gray-200 px-2 py-1 shadow-sm"+ >+ {label}+ </TooltipContent>+ </Tooltip>+ )+}diff --git a/components/ui/tooltip.tsx b/components/ui/tooltip.tsxnew file mode 100644index 0000000..8e62a2e--- /dev/null+++ b/components/ui/tooltip.tsx@@ -0,0 +1,57 @@+"use client"++import * as React from "react"+import { Tooltip as TooltipPrimitive } from "radix-ui"++import { cn } from "@/lib/utils"++function TooltipProvider({+ delayDuration = 0,+ ...props+}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {+ return (+ <TooltipPrimitive.Provider+ data-slot="tooltip-provider"+ delayDuration={delayDuration}+ {...props}+ />+ )+}++function Tooltip({+ ...props+}: React.ComponentProps<typeof TooltipPrimitive.Root>) {+ return <TooltipPrimitive.Root data-slot="tooltip" {...props} />+}++function TooltipTrigger({+ ...props+}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />+}++function TooltipContent({+ className,+ sideOffset = 0,+ children,+ ...props+}: React.ComponentProps<typeof TooltipPrimitive.Content>) {+ return (+ <TooltipPrimitive.Portal>+ <TooltipPrimitive.Content+ data-slot="tooltip-content"+ sideOffset={sideOffset}+ className={cn(+ "z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-[10px] text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",+ className+ )}+ {...props}+ >+ {children}+ <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-white fill-white" />+ </TooltipPrimitive.Content>+ </TooltipPrimitive.Portal>+ )+}++export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }diff --git a/hooks/RecordingContext.tsx b/hooks/RecordingContext.tsxindex feadbdd..22bc623 100644--- a/hooks/RecordingContext.tsx+++ b/hooks/RecordingContext.tsx@@ -1,10 +1,9 @@"use client";-import { createContext, useContext, ReactNode } from "react";+import { createContext, useContext, ReactNode, useEffect } from "react";import { useScreenRecording } from "./useScreenRecording";import type { RecordingState, RecordingContextType } from "@/types";-// Re-export tipos para compatibilidadexport type { RecordingState, RecordingContextType };const RecordingContext = createContext<RecordingContextType | null>(null);@@ -12,6 +11,30 @@ const RecordingContext = createContext<RecordingContextType | null>(null);export function RecordingProvider({ children }: { children: ReactNode }) {const recording = useScreenRecording();+ useEffect(() => {+ const handleKeyDown = (e: KeyboardEvent) => {+ // Iniciar grabación: Alt + S+ if (e.altKey && e.key.toLowerCase() === "s") {+ e.preventDefault();+ if (recording.isIdle) {+ recording.startCountdown();+ }+ }++ // Detener grabación: Alt + D+ if (e.altKey && e.key.toLowerCase() === "d") {+ e.preventDefault();+ // Solo detener si actualmente está grabando+ if (recording.isRecording) {+ recording.stopRecording();+ }+ }+ };++ window.addEventListener("keydown", handleKeyDown);+ return () => window.removeEventListener("keydown", handleKeyDown);+ }, [recording.isIdle, recording.isRecording, recording.startCountdown, recording.stopRecording]);+return (<RecordingContext.Provider value={recording}>{children}@@ -25,4 +48,4 @@ export function useRecording() {throw new Error("useRecording must be used within a RecordingProvider");}return context;-}+}\ No newline at end of filediff --git a/hooks/useAuth.tsx b/hooks/useAuth.tsxnew file mode 100644index 0000000..211df0c--- /dev/null+++ b/hooks/useAuth.tsx@@ -0,0 +1,138 @@+"use client";++import { createContext, useContext, useEffect, useState, useCallback } from "react";+import { createClient } from "@/utils/supabase/client";+import type { User, Session, AuthChangeEvent } from "@supabase/supabase-js";++export interface UserProfile {+ id: string;+ email: string;+ full_name: string | null;+ first_name: string | null;+ last_name: string | null;+ avatar_url: string | null;+ provider: string;+ created_at: string;+ updated_at: string;+}++interface AuthContextType {+ user: User | null;+ profile: UserProfile | null;+ session: Session | null;+ loading: boolean;+ signOut: () => Promise<void>;+ refreshProfile: () => Promise<void>;+}++const AuthContext = createContext<AuthContextType | undefined>(undefined);++export function AuthProvider({ children }: { children: React.ReactNode }) {+ const [user, setUser] = useState<User | null>(null);+ const [profile, setProfile] = useState<UserProfile | null>(null);+ const [session, setSession] = useState<Session | null>(null);+ const [loading, setLoading] = useState(true);+ const supabase = createClient();++ const fetchProfile = useCallback(async (userId: string) => {+ try {+ const { data, error } = await supabase+ .from("user_profiles")+ .select("*")+ .eq("id", userId)+ .single();++ if (error) {+ console.error("Error fetching profile:", error);+ return null;+ }++ return data as UserProfile;+ } catch (error) {+ console.error("Error fetching profile:", error);+ return null;+ }+ }, [supabase]);++ const refreshProfile = async () => {+ if (user) {+ const profileData = await fetchProfile(user.id);+ setProfile(profileData);+ }+ };++ useEffect(() => {+ let mounted = true;++ const initializeAuth = async () => {+ try {+ const {+ data: { session: initialSession },+ } = await supabase.auth.getSession();++ if (!mounted) return;++ setSession(initialSession);+ setUser(initialSession?.user ?? null);+ setLoading(false);++ if (initialSession?.user) {+ const profileData = await fetchProfile(initialSession.user.id);+ if (mounted) {+ setProfile(profileData);+ }+ }+ } catch (error) {+ console.error("Error initializing auth:", error);+ if (mounted) setLoading(false);+ }+ };++ initializeAuth();++ const {+ data: { subscription },+ } = supabase.auth.onAuthStateChange(async (_event: AuthChangeEvent, newSession: Session | null) => {+ setSession(newSession);+ setUser(newSession?.user ?? null);++ if (newSession?.user) {+ fetchProfile(newSession.user.id).then((profileData) => {+ if (mounted) setProfile(profileData);+ });+ } else {+ setProfile(null);+ }++ setLoading(false);+ });++ return () => {+ mounted = false;+ subscription.unsubscribe();+ };+ }, [supabase, fetchProfile]);++ const signOut = async () => {+ await supabase.auth.signOut();+ setUser(null);+ setProfile(null);+ setSession(null);+ };++ return (+ <AuthContext.Provider+ value={{ user, profile, session, loading, signOut, refreshProfile }}+ >+ {children}+ </AuthContext.Provider>+ );+}++export function useAuth() {+ const context = useContext(AuthContext);+ if (context === undefined) {+ throw new Error("useAuth must be used within an AuthProvider");+ }+ return context;+}\ No newline at end of filediff --git a/lib/mockup-data.tsx b/lib/mockup-data.tsxindex fe11d05..1651336 100644--- a/lib/mockup-data.tsx+++ b/lib/mockup-data.tsx@@ -276,54 +276,54 @@ export const MOCKUPS: Mockup[] = [<IphoneSlimPreview />),},- {- id: "iphone-base",- name: "iPhone Base",- category: "mobile",- preview: (- <IphoneBasePreview />- ),- },- {- id: "glass-curve",- name: "Glass Curve",- category: "mobile",- preview: (- <GlassCurvePreview />- ),- },- {- id: "glass-base",- name: "Glass Base",- category: "mobile",- preview: (- <GlassBasePreview />- ),- },- {- id: "glass-full",- name: "Glass Full",- category: "mobile",- preview: (- <GlassFullPreview />- ),- },- {- id: "hard-shell",- name: "Hard Shell",- category: "mobile",- preview: (- <HardShellPreview />- ),- },- {- id: "s24-ultra",- name: "S24 Ultra",- category: "mobile",- preview: (- <S24UltraPreview />- ),- },+ // {+ // id: "iphone-base",+ // name: "iPhone Base",+ // category: "mobile",+ // preview: (+ // <IphoneBasePreview />+ // ),+ // },+ // {+ // id: "glass-curve",+ // name: "Glass Curve",+ // category: "mobile",+ // preview: (+ // <GlassCurvePreview />+ // ),+ // },+ // {+ // id: "glass-base",+ // name: "Glass Base",+ // category: "mobile",+ // preview: (+ // <GlassBasePreview />+ // ),+ // },+ // {+ // id: "glass-full",+ // name: "Glass Full",+ // category: "mobile",+ // preview: (+ // <GlassFullPreview />+ // ),+ // },+ // {+ // id: "hard-shell",+ // name: "Hard Shell",+ // category: "mobile",+ // preview: (+ // <HardShellPreview />+ // ),+ // },+ // {+ // id: "s24-ultra",+ // name: "S24 Ultra",+ // category: "mobile",+ // preview: (+ // <S24UltraPreview />+ // ),+ // },// IDE Mockups{@@ -399,7 +399,7 @@ export const MOCKUPS: Mockup[] = [export const MOCKUP_CATEGORIES = [{ id: "all" as const, label: "Todos", icon: "ph:grid-four-bold" },- { id: "browser" as const, label: "Browser", icon: "hugeicons:browser", bgUrl: "/images/mockups/bg-browser.avif" },+ { id: "browser" as const, label: "Browser", icon: "hugeicons:ai-browser", bgUrl: "/images/mockups/bg-browser.avif" },{ id: "mobile" as const, label: "Mobile", icon: "ph:device-mobile-bold", bgUrl: "/images/mockups/bg-mobile.avif" },{ id: "ide" as const, label: "IDE", icon: "ph:code-bold", bgUrl: "/images/mockups/bg-ide.avif" },];