Create professional demos and 3D mockups in seconds, directly in your browser
feat: update import paths and streamline wallpaper category configuration
CristianOlivera1357a02ce5154
diff --git a/hooks/useScreenRecording.ts b/hooks/useScreenRecording.tsindex f9a159c..d4f277b 100644--- a/hooks/useScreenRecording.ts+++ b/hooks/useScreenRecording.ts@@ -1,7 +1,7 @@"use client";import { useState, useCallback, useRef, useEffect } from "react";-import { useRouter, usePathname } from "next/navigation";+import { useRouter, usePathname } from "@/navigation";import type { RecordingState, RecordingResult, VideoData } from "@/types";import type { CameraConfig, RecordingSetupConfig } from "@/types/camera.types";import {@@ -379,7 +379,6 @@ export function useScreenRecording() {};cameraRecorder.onerror = (event) => {console.error("Error del MediaRecorder (cámara):", event);- // Camera failure should not crash the whole recording.};}@@ -396,10 +395,7 @@ export function useScreenRecording() {await saveVideoToIndexedDB(screenBlob || new Blob([], { type: "video/webm" }),duration,- {- cameraBlob,- cameraConfig: cameraConfigRef.current,- }+ { cameraBlob, cameraConfig: cameraConfigRef.current });if (pathname === "/editor") {diff --git a/hooks/useVideoExport.ts b/hooks/useVideoExport.tsindex 3b44c55..a8df109 100644--- a/hooks/useVideoExport.ts+++ b/hooks/useVideoExport.ts@@ -283,9 +283,10 @@ async function exportWithFFmpegWebM(setProgress({ status: "preparing", progress: 3, message: "Cargando motor WebM..." });+ const ffmpegBase = `${window.location.origin}/ffmpeg`;await ffmpeg.load({- coreURL: await toBlobURL("/ffmpeg/ffmpeg-core.js", "text/javascript"),- wasmURL: await toBlobURL("/ffmpeg/ffmpeg-core.wasm", "application/wasm"),+ coreURL: await toBlobURL(`${ffmpegBase}/ffmpeg-core.js`, "text/javascript"),+ wasmURL: await toBlobURL(`${ffmpegBase}/ffmpeg-core.wasm`, "application/wasm"),});video.pause();@@ -563,10 +564,10 @@ async function exportWithMediabunnyAndAudio(await output.start();video.pause();-+// For multi-clip export, track the current active clip IDlet currentClipId: string | null = null;-+// Initial setup based on whether we have multiple clipsif (hasMultipleClips && clips.length > 0) {// Sort clips by start time@@ -588,7 +589,7 @@ async function exportWithMediabunnyAndAudio(} else {video.currentTime = trimStart;}-+await waitForVideoFrame(video);for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {@@ -602,10 +603,10 @@ async function exportWithMediabunnyAndAudio(// Multi-clip: determine which clip we're in and seek to correct positionif (hasMultipleClips && clipBlobs) {const activeClipInfo = getActiveClipAtTime(clips, timelineTime);-+if (activeClipInfo) {const { clip, clipTime } = activeClipInfo;-+// Check if we need to switch video sourceif (clip.id !== currentClipId) {const newBlob = clipBlobs.get(clip.libraryVideoId);@@ -620,7 +621,7 @@ async function exportWithMediabunnyAndAudio(currentClipId = clip.id;}}-+// Seek to correct position within the clip's videovideo.currentTime = clipTime;await waitForVideoFrame(video);@@ -644,7 +645,7 @@ async function exportWithMediabunnyAndAudio(setProgress({status: "encoding",progress,- message: hasMultipleClips+ message: hasMultipleClips? `Codificando clips ${frameIndex + 1}/${totalFrames}...`: `Codificando video ${frameIndex + 1}/${totalFrames}...`,});@@ -707,7 +708,8 @@ async function exportWithMediabunnyAndAudio(});const ffmpeg = new FFmpeg();- const baseURL = "/ffmpeg";+ const baseURL = `${window.location.origin}/ffmpeg`;+await ffmpeg.load({coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, "application/wasm"),@@ -936,8 +938,8 @@ async function exportWithFFmpegGif(setProgress({ status: "preparing", progress: 3, message: "Cargando motor de exportación GIF..." });- // toBlobURL de @ffmpeg/util descarga cada archivo como blob local- const baseURL = "/ffmpeg";+ const baseURL = `${window.location.origin}/ffmpeg`;+await ffmpeg.load({coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, "application/wasm"),diff --git a/lib/wallpaper.catalog.ts b/lib/wallpaper.catalog.tsindex 67fbc3f..f061f9e 100644--- a/lib/wallpaper.catalog.ts+++ b/lib/wallpaper.catalog.ts@@ -29,34 +29,10 @@ interface CategoryConfig {}const CATEGORY_CONFIGS: CategoryConfig[] = [- {- id: 'desktop',- label: 'Escritorio',- icon: 'heroicons:computer-desktop-solid',- primary: true,- count: 66,- },- {- id: 'gradient',- label: 'Gradientes',- icon: 'solar:mirror-left-bold',- primary: true,- count: 90,- },- {- id: 'pattern',- label: 'Patrones',- icon: 'solar:palette-round-bold',- primary: false,- count: 49,- },- {- id: 'minimal',- label: 'Minimal',- icon: 'solar:sun-2-bold',- primary: false,- count: 65,- },+ { id: 'desktop', label: 'desktop', icon: 'heroicons:computer-desktop-solid', primary: true, count: 66 },+ { id: 'gradient', label: 'gradient', icon: 'solar:mirror-left-bold', primary: true, count: 90 },+ { id: 'pattern', label: 'pattern', icon: 'solar:palette-round-bold', primary: false, count: 49 },+ { id: 'minimal', label: 'minimal', icon: 'solar:sun-2-bold', primary: false, count: 65 },];let globalIndex = 0;@@ -82,12 +58,10 @@ export const WALLPAPER_CATEGORIES: WallpaperCategory[] = CATEGORY_CONFIGS.map(co};});-/** Mapa plano index → WallpaperItem para búsquedas rápidas */export const WALLPAPER_MAP = new Map<number, WallpaperItem>(WALLPAPER_CATEGORIES.flatMap(cat => cat.items).map(item => [item.index, item]));-/** Devuelve las URLs a partir del índice global */export function getWallpaperByIndex(index: number): WallpaperItem | undefined {return WALLPAPER_MAP.get(index);}diff --git a/types/audio.types.ts b/types/audio.types.tsindex 4630bda..6120c3e 100644--- a/types/audio.types.ts+++ b/types/audio.types.ts@@ -1,25 +1,21 @@export interface AudioTrack {id: string;- audioId: string; // Reference to uploaded audio file+ audioId: string;name: string;- startTime: number; // Start position in video timeline (seconds)- duration: number; // Duration of the audio clip (seconds)- volume: number; // 0 to 1- loop: boolean; // Whether to loop if audio is shorter than video- trimStart?: number; // ← ¿existe este campo?+ startTime: number;+ duration: number;+ volume: number;+ loop: boolean;+ trimStart?: number;}-/**- * Uploaded Audio File- * Represents an audio file available in the library- */export interface UploadedAudio {id: string;name: string;- url: string; // Blob URL or uploaded URL+ url: string;duration: number;- fileSize: number; // In bytes- mimeType: string; // e.g., "audio/mp3", "audio/wav"+ fileSize: number;+ mimeType: string;}export interface AudioConfig {diff --git a/types/background.types.ts b/types/background.types.tsindex b3e7e44..cb7f0fd 100644--- a/types/background.types.ts+++ b/types/background.types.ts@@ -4,17 +4,17 @@ export type GradientDirection =| "to-b" | "to-bl" | "to-l" | "to-tl";export interface ColorStop {- id?: string; // Unique identifier for drag-and-drop+ id?: string;color: string;- position: number; // 0-100+ position: number;}export interface GradientConfig {type: GradientType;direction: GradientDirection;- angle?: number; // 0-360 para linear y conic- originX?: number; // 0-100 para conic (posición horizontal)- originY?: number; // 0-100 para conic (posición vertical)+ angle?: number;+ originX?: number;+ originY?: number;stops: ColorStop[];}@@ -98,7 +98,8 @@ const SHARED_PALETTES: ColorStop[][] = [[{ color: "#ff0844", position: 0 }, { color: "#ffb199", position: 100 }],[{ color: "#c31432", position: 0 }, { color: "#240b36", position: 100 }],[{ color: "#f857a6", position: 0 }, { color: "#ff5858", position: 100 }],- [{ color: "#654ea3", position: 0 }, { color: "#eaafc8", position: 100 }]+ [{ color: "#654ea3", position: 0 }, { color: "#eaafc8", position: 100 }],+ [{ color: "#F8FAFC", position: 0 }, { color: "#F1F5F9", position: 50 }, { color: "#36383A", position: 100 }]];export const PRESET_LINEAR_GRADIENTS: GradientConfig[] = SHARED_PALETTES.map(stops => ({@@ -135,7 +136,8 @@ const CONIC_METADATA = [{ angle: 180, originX: 50, originY: 110 }, { angle: 45, originX: -10, originY: -10 },{ angle: 90, originX: 100, originY: 50 }, { angle: 270, originX: 0, originY: 50 },{ angle: 45, originX: 50, originY: 50 }, { angle: 135, originX: 50, originY: 50 },- { angle: 225, originX: 50, originY: 50 }, { angle: 315, originX: 50, originY: 50 }+ { angle: 225, originX: 50, originY: 50 }, { angle: 315, originX: 50, originY: 50 },+ { angle: 0, originX: 50, originY: 50 }];export const PRESET_CONIC_GRADIENTS: GradientConfig[] = CONIC_METADATA.map((meta, i) => ({diff --git a/types/camera.types.ts b/types/camera.types.tsindex bef945f..192e0f9 100644--- a/types/camera.types.ts+++ b/types/camera.types.ts@@ -106,16 +106,12 @@ export const CAMERA_SHAPES: Array<{ id: CameraShape; label: string; icon: string{ id: "square", label: "Cuadrado", icon: "material-symbols:square-rounded" },];-// Storage key for persisting recording setupexport const RECORDING_SETUP_STORAGE_KEY = "openvid:recordingSetup";-// Valid camera shapes for validationexport const VALID_CAMERA_SHAPES: CameraShape[] = ["squircle", "circle", "square"];-// Valid camera corners for validationexport const VALID_CAMERA_CORNERS: CameraCorner[] = ["top-left", "top-right", "bottom-left", "bottom-right", "custom"];-// Corner position buttons with labels and iconsexport const CORNER_BUTTONS: Array<{ id: Exclude<CameraCorner, "custom">; label: string; icon: string }> = [{ id: "top-left", label: "Arriba izq.", icon: "solar:arrow-up-bold" },{ id: "top-right", label: "Arriba der.", icon: "solar:arrow-up-bold" },diff --git a/types/canvas-elements.types.ts b/types/canvas-elements.types.tsindex 1ac0984..8fd8f4d 100644--- a/types/canvas-elements.types.ts+++ b/types/canvas-elements.types.ts@@ -85,4 +85,15 @@ export const FONT_WEIGHTS = [{ key: "normal", label: "Regular" },{ key: "medium", label: "Medium" },{ key: "bold", label: "Bold" },-] as const;\ No newline at end of file+] as const;++export interface UploadedImage {+ id: string;+ name: string;+ dataUrl: string;+ uploadedAt: number;+}++export const STORAGE_KEY = "openvid-uploaded-images";+export const MAX_FILE_SIZE = 5 * 1024 * 1024;+export const ACCEPTED_FORMATS = ["image/png", "image/jpeg", "image/jpg", "image/webp", "image/gif"];\ No newline at end of filediff --git a/types/zoom.types.ts b/types/zoom.types.tsindex 182054b..725d65a 100644--- a/types/zoom.types.ts+++ b/types/zoom.types.ts@@ -1,3 +1,5 @@+import { VideoThumbnail } from "./editor.types";+export interface ZoomFragment {id: string;startTime: number; // Tiempo de inicio del fragmento (segundos)@@ -28,6 +30,18 @@ export interface ZoomState {selectedFragmentId: string | null;}+export interface ZoomFragmentEditorProps {+ fragment: ZoomFragment;+ videoUrl: string | null;+ videoThumbnail?: string | null;+ currentTime?: number;+ getThumbnailForTime?: (time: number) => VideoThumbnail | null;+ videoDimensions?: { width: number; height: number } | null;+ onBack: () => void;+ onDelete: () => void;+ onUpdate: (updates: Partial<ZoomFragment>) => void;+}+// Smoother easing for professional zoom feel (quart curves)export function easeOutQuart(t: number): number {return 1 - Math.pow(1 - t, 4);