Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

chore: translate Spanish code comments to English

theurzil40266ea733ce
diff --git a/app/[locale]/(editor)/editor/page.tsx b/app/[locale]/(editor)/editor/page.tsx
index 7bc4611..636ef5d 100644
--- a/app/[locale]/(editor)/editor/page.tsx
+++ b/app/[locale]/(editor)/editor/page.tsx
@@ -968,7 +968,7 @@ export default function Editor() {
setMockupConfig(getMockupDefaultConfig(newMockup));
}, []);
- // Handler para cambiar la configuración del mockup
+ // Handler to update mockup configuration
const handleMockupConfigChange = useCallback((updates: Partial<MockupConfig>) => {
setMockupConfig(prev => ({ ...prev, ...updates }));
}, []);
@@ -1455,7 +1455,7 @@ export default function Editor() {
}
}, [uploadVideo, clearHistory]);
- // Handler para subir video solo a la librería (desde VideosMenu)
+ // Handler to upload video to the library only (from VideosMenu)
const handleVideoUploadToLibrary = useCallback(async (file: File) => {
try {
await addVideoToLibrary(file);
@@ -1467,7 +1467,7 @@ export default function Editor() {
}
}, []);
- // Handler para agregar video desde la librería al track (concatenar)
+ // Handler to add video from library to the track (concatenate)
const handleAddVideoToTrack = useCallback(async (videoId: string, blob: Blob, duration: number) => {
// Get video info from library
const libraryVideo = await import("@/lib/videos-library").then(m => m.getLibraryVideo(videoId));
@@ -1483,7 +1483,7 @@ export default function Editor() {
videoUrlsRef.current.set(videoId, blobUrl);
}
- // Usar functional update para tener siempre el estado más reciente
+ // Use functional update to always have the latest state
setVideoClips(prevClips => {
const startTime = findNextClipPosition(prevClips);
@@ -1601,7 +1601,7 @@ export default function Editor() {
}
}, [selectedVideoClipId]);
- // Handler para eliminar video de track cuando se elimina de la librería (cascade delete)
+ // Handler to remove video from track when deleted from library (cascade delete)
const handleDeleteVideoFromLibrary = useCallback((libraryVideoId: string) => {
setVideoClips(prev => {
const newClips = prev.filter(clip => clip.libraryVideoId !== libraryVideoId);
@@ -1647,7 +1647,7 @@ export default function Editor() {
}
}, []);
- // Handler para quitar video del track (toggle) - solo remueve el clip, no la librería
+ // Handler to remove video from track (toggle) - removes clip only, not from library
const handleRemoveVideoFromTrack = useCallback((libraryVideoId: string) => {
setVideoClips(prev => {
const newClips = prev.filter(clip => clip.libraryVideoId !== libraryVideoId);
diff --git a/app/components/ui/AspectRatioSelect.tsx b/app/components/ui/AspectRatioSelect.tsx
index 0e192b4..de5f2c3 100644
--- a/app/components/ui/AspectRatioSelect.tsx
+++ b/app/components/ui/AspectRatioSelect.tsx
@@ -66,7 +66,7 @@ export function AspectRatioSelect({
return standard ? standard.label : t("labels.custom");
})();
- // Componente interno para dibujar las figuritas de los rectángulos/cuadrados
+ // Internal component to render rectangle/square ratio shapes
const RatioShape = ({ ratio, isSelected }: { ratio: AspectRatio; isSelected: boolean }) => {
if (ratio === "auto") {
return <Icon icon="lucide:maximize" width="24" className={isSelected ? "text-primary" : "opacity-60"} />;
diff --git a/app/components/ui/HeroScrollMask.tsx b/app/components/ui/HeroScrollMask.tsx
index 3103893..3cfd5d4 100644
--- a/app/components/ui/HeroScrollMask.tsx
+++ b/app/components/ui/HeroScrollMask.tsx
@@ -47,7 +47,7 @@ export function HeroScrollMask() {
useEffect(() => {
const mm = gsap.matchMedia();
- // Limitamos la ejecución de la animación solo a pantallas >= 640px (breakpoint 'sm')
+ // Limit animation to screens >= 640px (breakpoint 'sm')
mm.add("(min-width: 640px)", () => {
const timeline = gsap.timeline({ defaults: { ease: "none" } });
diff --git a/app/components/ui/RecordingSetupDialog.tsx b/app/components/ui/RecordingSetupDialog.tsx
index 718d7d4..b5d3280 100644
--- a/app/components/ui/RecordingSetupDialog.tsx
+++ b/app/components/ui/RecordingSetupDialog.tsx
@@ -92,7 +92,7 @@ export default function RecordingSetupDialog({ open, onClose, onStart }: Props)
const [devices, setDevices] = useState<AvailableDevices>({ cameras: [], microphones: [] });
const [previewStream, setPreviewStream] = useState<MediaStream | null>(null);
- // Guardaremos códigos de error en lugar de strings duros
+ // Store error codes instead of hardcoded strings
const [cameraErrorCode, setCameraErrorCode] = useState<string | null>(null);
const [micErrorCode, setMicErrorCode] = useState<string | null>(null);
diff --git a/app/components/ui/WalpaperSections.tsx b/app/components/ui/WalpaperSections.tsx
index 95c8d8c..bd2f691 100644
--- a/app/components/ui/WalpaperSections.tsx
+++ b/app/components/ui/WalpaperSections.tsx
@@ -165,7 +165,7 @@ export function WallpaperCatalogGrid({ selectedIndex = -1, onSelect }: Wallpaper
);
}
-// Estos sub-componentes se mantienen igual en lógica pero asegúrate de que usen img o bg-url correctamente.
+// These sub-components keep the same logic — ensure they use img or bg-url correctly.
function WallpaperThumb({ item, isSelected, onSelect }: { item: WallpaperItem; isSelected: boolean; onSelect?: (index: number) => void; }) {
return (
<button
diff --git a/app/components/ui/editor/Timeline.tsx b/app/components/ui/editor/Timeline.tsx
index e12eddb..0844aaf 100644
--- a/app/components/ui/editor/Timeline.tsx
+++ b/app/components/ui/editor/Timeline.tsx
@@ -64,7 +64,7 @@ export function Timeline({
const [ghostX, setGhostX] = useState(0);
const validDuration = useMemo(() => {
if (videoClips.length > 0) {
- // Duración total = fin del último clip
+ // Total duration = end of last clip
const lastClipEnd = Math.max(...videoClips.map(c => c.startTime + (c.trimEnd - c.trimStart)));
return Number.isFinite(lastClipEnd) && lastClipEnd > 0 ? lastClipEnd : 0;
}
diff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsx
index eb8a831..2f2aa33 100644
--- a/app/components/ui/editor/VideoCanvas.tsx
+++ b/app/components/ui/editor/VideoCanvas.tsx
@@ -857,7 +857,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct
}
};
- // Función para dibujar un frame en el canvas de exportación
+ // Function to draw a frame on the export canvas
const drawFrame = async () => {
const canvas = exportCanvasRef.current;
const canvasCtxOptions: CanvasRenderingContext2DSettings = { alpha: true, colorSpace: 'srgb', desynchronized: false, willReadFrequently: false };
@@ -1282,7 +1282,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct
}
}
- // ... A partir de aquí, continúa el resto de tu código exactamente igual:
+ // ... From here, the rest of the code continues as-is:
const { size, left: drawX, top: drawY } = getCameraLayout(
cameraConfig,
canvasWidth,
diff --git a/app/components/ui/editor/mockups/ChromeGlassMockup.tsx b/app/components/ui/editor/mockups/ChromeGlassMockup.tsx
index 1285fb6..73d2177 100644
--- a/app/components/ui/editor/mockups/ChromeGlassMockup.tsx
+++ b/app/components/ui/editor/mockups/ChromeGlassMockup.tsx
@@ -98,7 +98,7 @@ export function ChromeGlassMockup({
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z" />
</svg>
<span className="truncate flex-1" style={{ fontSize: `${tabFontSz}px`, color: textColor }}>
- {url?.replace(/^https?:\/\//, "") ?? "Nueva pestaña"}
+ {url?.replace(/^https?:\/\//, "") ?? "New tab"}
</span>
<svg style={{ width: `${tabCloseS}px`, height: `${tabCloseS}px`, flexShrink: 0, color: iconColor, opacity: 0.7 }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path d="M6 18L18 6M6 6l12 12" strokeWidth="2.5" strokeLinecap="round" />
diff --git a/app/components/ui/editor/mockups/ChromeMockup.tsx b/app/components/ui/editor/mockups/ChromeMockup.tsx
index 4c989db..3d81b1a 100644
--- a/app/components/ui/editor/mockups/ChromeMockup.tsx
+++ b/app/components/ui/editor/mockups/ChromeMockup.tsx
@@ -28,7 +28,7 @@ export function ChromeMockup({
const bgColor = isDark ? "#1e1e1e" : "#ffffff";
const tabBarBg = frameColor; // tab bar = frameColor directo
const addressBg = frameColor; // address bar = frameColor directo
- const tabActiveBg = deriveSearchBg(frameColor); // tab activa = ligeramente más clara/oscura
+ const tabActiveBg = deriveSearchBg(frameColor); // active tab = slightly lighter/darker
const urlBarBgBase = deriveSearchBg(frameColor); // search bar = mismo derivado
const addressBorder = isDark ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.12)";
const textColor = isDark ? "#9ca3af" : "#374151";
@@ -94,7 +94,7 @@ export function ChromeMockup({
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z" />
</svg>
<span className="truncate flex-1" style={{ fontSize: `${tabFontSz}px`, color: textColor }}>
- {url?.replace(/^https?:\/\//, "") ?? "Nueva pestaña"}
+ {url?.replace(/^https?:\/\//, "") ?? "New tab"}
</span>
<svg style={{ width: `${tabIconSz}px`, height: `${tabIconSz}px`, flexShrink: 0, color: iconColor }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path d="M6 18L18 6M6 6l12 12" strokeWidth="2.5" strokeLinecap="round" />
diff --git a/app/components/ui/editor/mockups/GlassFullMockup.tsx b/app/components/ui/editor/mockups/GlassFullMockup.tsx
index 143d32d..d1862a0 100644
--- a/app/components/ui/editor/mockups/GlassFullMockup.tsx
+++ b/app/components/ui/editor/mockups/GlassFullMockup.tsx
@@ -67,7 +67,7 @@ export function GlassFullMockup({
style={{
padding: `${framePadding}px`,
backgroundColor: hexToRgba(frameColor, headerOpacity),
- borderRadius: `${cornerRadius * 2.8}px`, // Proporción similar a rounded-[3.5rem]
+ borderRadius: `${cornerRadius * 2.8}px`, // Proportional to rounded-[3.5rem]
boxShadow: shadows > 0
? `0 ${shadows}px ${shadows * 2}px rgba(0,0,0,0.25)`
: 'none',
@@ -120,7 +120,7 @@ export function GlassFullMockup({
className="relative w-full h-full overflow-hidden flex flex-col shadow-inner"
style={{
backgroundColor: screenBg,
- borderRadius: `${cornerRadius * 2.3}px`, // Proporción similar a rounded-[2.8rem]
+ borderRadius: `${cornerRadius * 2.3}px`, // Proportional to rounded-[2.8rem]
border: `1px solid ${screenBorderColor}`,
}}
>
diff --git a/app/components/ui/editor/mockups/HardShellMockup.tsx b/app/components/ui/editor/mockups/HardShellMockup.tsx
index f7c309e..ab3b225 100644
--- a/app/components/ui/editor/mockups/HardShellMockup.tsx
+++ b/app/components/ui/editor/mockups/HardShellMockup.tsx
@@ -35,7 +35,7 @@ export function HardShellMockup({
const networkFontSize = 10 * headerScale; // text-[10px]
const signalBarWidth = 3 * headerScale; // w-[3px]
- const batteryWidth = 22 * headerScale; // Ligeramente más ancha
+ const batteryWidth = 22 * headerScale; // Slightly wider
const batteryHeight = 11 * headerScale;
const contentPaddingTop = 44 * headerScale; // pt-11
@@ -73,7 +73,7 @@ export function HardShellMockup({
className="absolute shadow-inner rounded-r-md"
style={{
right: `-${buttonWidth}px`,
- top: '18%', // Posición proporcional (top-32)
+ top: '18%', // Proportional position (top-32)
width: `${buttonWidth}px`,
height: '9%', // Proporcional a h-16
backgroundColor: buttonBgColor,
@@ -88,7 +88,7 @@ export function HardShellMockup({
className="absolute shadow-inner rounded-r-md"
style={{
right: `-${buttonWidth}px`,
- top: '31%', // Posición proporcional (top-56)
+ top: '31%', // Proportional position (top-56)
width: `${buttonWidth}px`,
height: '5%', // Proporcional a h-9
backgroundColor: buttonBgColor,
diff --git a/app/components/ui/editor/mockups/S24UltraMockup.tsx b/app/components/ui/editor/mockups/S24UltraMockup.tsx
index 01c0f85..de58f08 100644
--- a/app/components/ui/editor/mockups/S24UltraMockup.tsx
+++ b/app/components/ui/editor/mockups/S24UltraMockup.tsx
@@ -57,7 +57,7 @@ export function S24UltraMockup({
style={{
padding: `${framePadding}px`,
backgroundColor: frameColor,
- borderRadius: `${cornerRadius * 1.2}px`, // S24 Ultra es más cuadrado
+ borderRadius: `${cornerRadius * 1.2}px`, // S24 Ultra is more square
border: `1px solid ${frameBorderColor}`,
boxShadow: shadows > 0
? `0 ${shadows / 2}px ${shadows}px -12px rgba(0,0,0,0.5)`
diff --git a/lib/canvas-elements.config.ts b/lib/canvas-elements.config.ts
index 699381c..fc2674f 100644
--- a/lib/canvas-elements.config.ts
+++ b/lib/canvas-elements.config.ts
@@ -22,7 +22,7 @@ function generateImageItems(
});
}
-// Elementos SVG destacados que se muestran directamente (11 slots)
+// Pinned SVG elements shown directly (11 slots)
export const PINNED_SVG_ITEMS = [
{ id: "rectangle", name: "Rectángulo", icon: "ph:rectangle-bold" },
{ id: "circle", name: "Círculo", icon: "ph:circle-bold" },
@@ -37,7 +37,7 @@ export const PINNED_SVG_ITEMS = [
{ id: "chat", name: "Bocadillo", icon: "ph:chat-circle-bold" },
];
-// Elementos de imagen destacados que se muestran directamente (11 slots)
+// Pinned image elements shown directly (11 slots)
export const PINNED_IMAGE_ITEMS = [
{ id: "overlay-01", name: "Overlay 1", imagePath: "/elements/images/overlays/overlay-01.webp" },
{ id: "overlay-11", name: "Overlay 11", imagePath: "/elements/images/overlays/overlay-11.webp" },
diff --git a/lib/canvas-icons/action-icons.ts b/lib/canvas-icons/action-icons.ts
index 297f689..facabfc 100644
--- a/lib/canvas-icons/action-icons.ts
+++ b/lib/canvas-icons/action-icons.ts
@@ -195,13 +195,13 @@ export function drawWinButton(
export function drawBackIcon(ctx: CanvasRenderingContext2D, x: number, y: number, size: number, color: string) {
ctx.save();
- ctx.globalAlpha = 0.8; // Las flechas suelen ser un poco más opacas que el refresh
+ ctx.globalAlpha = 0.8; // Arrows tend to be slightly more opaque than the refresh icon
const scale = size / 24;
ctx.translate(x, y);
ctx.scale(scale, scale);
ctx.strokeStyle = color;
- ctx.lineWidth = 1.8; // Línea un poco más fina para elegancia
+ ctx.lineWidth = 1.8; // Slightly thinner line for elegance
ctx.lineCap = "round";
ctx.lineJoin = "round";
diff --git a/lib/canvas.utils.ts b/lib/canvas.utils.ts
index 0b85189..5f9c471 100644
--- a/lib/canvas.utils.ts
+++ b/lib/canvas.utils.ts
@@ -76,7 +76,7 @@ export function getAspectRatioNumber(ratio: AspectRatio, customDimensions?: { wi
}
}
-// Función para obtener max-width basado en aspect ratio
+// Get max-width based on aspect ratio
export function getMaxWidth(ratio: AspectRatio, customDimensions?: { width: number; height: number }): string {
if ((ratio === "custom" || ratio === "auto") && customDimensions) {
const aspectValue = customDimensions.width / customDimensions.height;
@@ -338,7 +338,7 @@ export function calculateSmoothZoom(
}
-// Funciones para determinar esquina más cercana y estilos de las esquinas para rotar elementos
+// Functions to determine nearest corner and corner styles for rotating elements
export type Corner = "top-left" | "top-right" | "bottom-right" | "bottom-left";
export function getNearestCorner(e: React.MouseEvent<HTMLElement>, rotationDeg = 0): Corner {
@@ -376,8 +376,8 @@ export function getCornerStyle(corner: Corner, offset = -10): React.CSSPropertie
}
export const CORNER_ICON_ROTATION: Record<Corner, number> = {
- "top-right": 0, // posición natural del SVG
- "bottom-right": 90, // gira 90° a la derecha
- "bottom-left": 180, // gira 180°
- "top-left": 270, // gira 270°
+ "top-right": 0, // natural SVG position
+ "bottom-right": 90, // rotate 90° clockwise
+ "bottom-left": 180, // rotate 180°
+ "top-left": 270, // rotate 270°
};
diff --git a/lib/constants.ts b/lib/constants.ts
index 0009fde..740c7e0 100644
--- a/lib/constants.ts
+++ b/lib/constants.ts
@@ -53,8 +53,8 @@ export const TIMELINE_ZOOM_SCALE: Record<number, number> = {
// Mockups con header → solo esquinas INFERIORES del video redondeadas
export 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", "s24-ultra", "glass-curve", "glass-full"];
-// Mockups glass → manejan su propia sombra, no necesitan el rect sólido previo
+// Glass mockups → handle their own shadow, do not need the solid rect underneath
export const SELF_SHADOWING_MOCKUPS = ["macos-glass", "macos-ghost-glass", "glass-ui-container", "macos-container-glass", "brave-glass", "browser-tab-glass", "chrome-glass", "iphone-slim", "glass-curve", "glass-full", "s24-ultra", "hard-shell"];
-// Z-index del video: elementos con zIndex < VIDEO_Z_INDEX se renderizan detrás del video
+// Video z-index: elements with zIndex < VIDEO_Z_INDEX render behind the video
export const VIDEO_Z_INDEX = 1000;
diff --git a/lib/mockup-canvas.utils.ts b/lib/mockup-canvas.utils.ts
index 9352826..26e6b78 100644
--- a/lib/mockup-canvas.utils.ts
+++ b/lib/mockup-canvas.utils.ts
@@ -46,7 +46,7 @@ export function drawMockupToCanvas(
canvasWidth: number = 1920
): MockupDrawResult {
- //Importante: todos los cálculos dentro de los mockups se hacen en un espacio de 1280x720 para mantener proporciones, luego se escala al tamaño real del canvas. Esto asegura que el diseño del mockup se mantenga consistente sin importar el tamaño del canvas o sin importar la resolución de exportacion.
+ // Important: all mockup calculations are done in a 1280x720 space to maintain proportions, then scaled to the actual canvas size. This ensures the mockup design stays consistent regardless of canvas size or export resolution.
const scale = (canvasWidth / 1280) * 1.2;
ctx.save();
diff --git a/lib/mockup-canvas/chrome-glass.ts b/lib/mockup-canvas/chrome-glass.ts
index 67e80cd..fffc4e7 100644
--- a/lib/mockup-canvas/chrome-glass.ts
+++ b/lib/mockup-canvas/chrome-glass.ts
@@ -246,7 +246,7 @@ export function drawChromeGlassMockup(context: MockupCanvasContext): MockupDrawR
ctx.fillStyle = bgColor;
ctx.fillRect(innerX, innerY + totalHeaderH, innerWidth, innerHeight - totalHeaderH);
- ctx.restore(); // fin clip
+ ctx.restore(); // end clip
return {
contentX: innerX,
diff --git a/lib/mockup-canvas/chrome.ts b/lib/mockup-canvas/chrome.ts
index f8c3943..af9dae7 100644
--- a/lib/mockup-canvas/chrome.ts
+++ b/lib/mockup-canvas/chrome.ts
@@ -218,7 +218,7 @@ export function drawChromeMockup(context: MockupCanvasContext): MockupDrawResult
ctx.fillStyle = bgColor;
ctx.fillRect(x, y + totalHeaderH, width, height - totalHeaderH);
- ctx.restore(); // fin clip global
+ ctx.restore(); // end global clip
return {
contentX: x,
diff --git a/lib/mockup-canvas/glass-full.ts b/lib/mockup-canvas/glass-full.ts
index 735205d..0cb855e 100644
--- a/lib/mockup-canvas/glass-full.ts
+++ b/lib/mockup-canvas/glass-full.ts
@@ -51,7 +51,7 @@ export function drawGlassFullMockup(context: MockupCanvasContext): MockupDrawRes
const drawButton = (percentY: number, percentH: number, isLeft: boolean) => {
const btnW = buttonWidth;
const btnR = 2 * headerScale;
- const overlap = 2; // Para solapar con el marco y evitar líneas
+ const overlap = 2; // Overlap the frame to avoid visible lines
const btnY = y + (height * percentY);
const btnH = height * percentH;
@@ -80,9 +80,9 @@ export function drawGlassFullMockup(context: MockupCanvasContext): MockupDrawRes
ctx.stroke();
};
- drawButton(0.15, 0.05, true); // Silencio
- drawButton(0.25, 0.12, true); // Volumen Arriba
- drawButton(0.28, 0.14, false); // Encendido
+ drawButton(0.15, 0.05, true); // Mute
+ drawButton(0.25, 0.12, true); // Volume Up
+ drawButton(0.28, 0.14, false); // Power
ctx.restore();
ctx.save();
diff --git a/lib/mockup-canvas/hard-shell.ts b/lib/mockup-canvas/hard-shell.ts
index c93e1db..fb88c34 100644
--- a/lib/mockup-canvas/hard-shell.ts
+++ b/lib/mockup-canvas/hard-shell.ts
@@ -76,8 +76,8 @@ export function drawHardShellMockup(context: MockupCanvasContext): MockupDrawRes
ctx.stroke();
};
- drawButton(0.18, 0.09, false); // Volumen
- drawButton(0.31, 0.05, false); // Encendido
+ drawButton(0.18, 0.09, false); // Volume
+ drawButton(0.31, 0.05, false); // Power
ctx.restore();
ctx.save();
@@ -139,13 +139,13 @@ export function drawHardShellMockup(context: MockupCanvasContext): MockupDrawRes
ctx.font = `500 ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;
ctx.fillStyle = textColor;
ctx.textBaseline = "middle";
- ctx.fillText("11:43", timeX, timeY + 1); // +1 para alinear ópticamente
+ ctx.fillText("11:43", timeX, timeY + 1); // +1 for optical alignment
ctx.restore();
const batPoleWidth = 2 * headerScale;
const batPoleHeight = 4 * headerScale;
const batX = screenX + screenWidth - statusBarPaddingX - batPoleWidth - batteryWidth;
- const batY = timeY - batteryHeight / 2 + 1; // +1 alineación óptica
+ const batY = timeY - batteryHeight / 2 + 1; // +1 optical alignment
ctx.save();
ctx.strokeStyle = textColor;
@@ -155,7 +155,7 @@ export function drawHardShellMockup(context: MockupCanvasContext): MockupDrawRes
ctx.stroke();
const batPad = 1.5 * headerScale;
- const fillWidth = (batteryWidth - batPad * 2) * 0.8; // 80% lleno
+ const fillWidth = (batteryWidth - batPad * 2) * 0.8; // 80% full
const fillHeight = batteryHeight - batPad * 2;
ctx.fillStyle = textColor;
ctx.beginPath();
@@ -178,7 +178,7 @@ export function drawHardShellMockup(context: MockupCanvasContext): MockupDrawRes
const totalSigWidth = (signalBarWidth * 4) + (sigGap * 3);
const sigX = batX - 6 * headerScale - totalSigWidth;
const sigMaxHeight = 12 * headerScale;
- const sigYBottom = batY + batteryHeight; // Alineado por abajo con la batería
+ const sigYBottom = batY + batteryHeight; // Bottom-aligned with the battery
ctx.save();
ctx.fillStyle = textColor;
diff --git a/lib/mockup-canvas/iphone-slim.ts b/lib/mockup-canvas/iphone-slim.ts
index 5817571..bd34ad5 100644
--- a/lib/mockup-canvas/iphone-slim.ts
+++ b/lib/mockup-canvas/iphone-slim.ts
@@ -31,9 +31,9 @@ export function drawIPhoneSlimMockup(context: MockupCanvasContext): MockupDrawRe
ctx.save();
const drawButton = (percentY: number, percentH: number, isLeft: boolean) => {
- const btnWidth = 4; // Ancho del botón (similar a w-1)
- const btnRadius = 2; // Radio de las esquinas
- const overlap = 2; // Píxeles que entran hacia el marco para ocultar la unión
+ const btnWidth = 4; // Button width (similar to w-1)
+ const btnRadius = 2; // Corner radius
+ const overlap = 2; // Pixels that overlap the frame to hide the joint
const btnY = y + (height * percentY);
const btnH = height * percentH;
diff --git a/lib/mockup-canvas/macos-glass.ts b/lib/mockup-canvas/macos-glass.ts
index 5865dd5..9293514 100644
--- a/lib/mockup-canvas/macos-glass.ts
+++ b/lib/mockup-canvas/macos-glass.ts
@@ -66,7 +66,7 @@ export function drawMacosGlassMockup(context: MockupCanvasContext): MockupDrawRe
gradient.addColorStop(0, 'rgba(255, 255, 255, 0.35)');
gradient.addColorStop(1, 'rgba(255, 255, 255, 0.45)');
ctx.fillStyle = gradient;
- ctx.fill('evenodd'); // Usar evenodd para crear el efecto "donut"
+ ctx.fill('evenodd'); // Use evenodd to create the "donut" cutout effect
ctx.strokeStyle = 'rgba(255, 255, 255)';
ctx.lineWidth = 0.5;
diff --git a/lib/mockup-canvas/s24-ultra.ts b/lib/mockup-canvas/s24-ultra.ts
index 14d9186..2095ca4 100644
--- a/lib/mockup-canvas/s24-ultra.ts
+++ b/lib/mockup-canvas/s24-ultra.ts
@@ -61,8 +61,8 @@ export function drawS24UltraMockup(context: MockupCanvasContext): MockupDrawResu
ctx.stroke();
};
- drawSideButton(0.20, 0.08); // Volumen
- drawSideButton(0.32, 0.12); // Encendido
+ drawSideButton(0.20, 0.08); // Volume
+ drawSideButton(0.32, 0.12); // Power
ctx.restore();
ctx.save();
@@ -110,7 +110,7 @@ export function drawS24UltraMockup(context: MockupCanvasContext): MockupDrawResu
ctx.font = `500 ${timeFontSize}px "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;
ctx.fillStyle = textAndIconColor;
ctx.textBaseline = "middle";
- ctx.fillText("12:30", screenX + statusBarPaddingX, statusYCenter + 1); // +1 corrección óptica
+ ctx.fillText("12:30", screenX + statusBarPaddingX, statusYCenter + 1); // +1 optical correction
ctx.restore();
let currentRightX = screenX + screenWidth - statusBarPaddingX;
@@ -152,7 +152,7 @@ export function drawS24UltraMockup(context: MockupCanvasContext): MockupDrawResu
ctx.save();
ctx.translate(currentRightX, statusYCenter - wifiSize / 2);
- const wifiScale = wifiSize / 24; // El SVG original de Tailwind es 24x24
+ const wifiScale = wifiSize / 24; // Original Tailwind SVG is 24x24
ctx.scale(wifiScale, wifiScale);
const wifiPath = new Path2D("M12 21l-12-12c5.5-5.5 14.5-5.5 20 0l-8 12z");
ctx.fillStyle = textAndIconColor;
@@ -176,14 +176,14 @@ export function drawS24UltraMockup(context: MockupCanvasContext): MockupDrawResu
ctx.arc(navCenterX, navYCenter, navIconSize / 2, 0, Math.PI * 2);
ctx.stroke();
- const rightIconX = navCenterX + navGap + (4 * headerScale); // Offset visual
+ const rightIconX = navCenterX + navGap + (4 * headerScale); // Visual offset
ctx.translate(rightIconX, navYCenter);
- ctx.rotate(45 * Math.PI / 180); // Rota para formar la flecha
+ ctx.rotate(45 * Math.PI / 180); // Rotate to form the arrow
ctx.beginPath();
const halfIcon = navIconSize / 2;
- ctx.moveTo(-halfIcon, -halfIcon); // Arriba
- ctx.lineTo(-halfIcon, halfIcon); // Esquina inferior izquierda
- ctx.lineTo(halfIcon, halfIcon); // Derecha
+ ctx.moveTo(-halfIcon, -halfIcon); // Top
+ ctx.lineTo(-halfIcon, halfIcon); // Bottom-left corner
+ ctx.lineTo(halfIcon, halfIcon); // Right
ctx.stroke();
ctx.restore();
diff --git a/lib/mockup-canvas/shared.ts b/lib/mockup-canvas/shared.ts
index cf320f4..be14a68 100644
--- a/lib/mockup-canvas/shared.ts
+++ b/lib/mockup-canvas/shared.ts
@@ -36,7 +36,7 @@ export function drawMockupShadow(
ctx.shadowBlur = shadowBlur;
ctx.shadowOffsetY = shadowBlur * 0.3;
- ctx.strokeStyle = 'rgba(0, 0, 0, 0.3)'; // Más visible para sombras notorias
+ ctx.strokeStyle = 'rgba(0, 0, 0, 0.3)'; // More visible for prominent shadows
ctx.lineWidth = 1;
drawRoundedRectPath(ctx, x, y, width, height, cornerRadius);
ctx.stroke();
diff --git a/lib/video.utils.ts b/lib/video.utils.ts
index 75860c4..3765041 100644
--- a/lib/video.utils.ts
+++ b/lib/video.utils.ts
@@ -14,10 +14,10 @@ export function waitForVideoFrame(video: HTMLVideoElement): Promise<void> {
if ('requestVideoFrameCallback' in HTMLVideoElement.prototype) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(video as any).requestVideoFrameCallback(done);
- // Timeout de seguridad largo para evitar bloqueo
+ // Long safety timeout to prevent blocking
setTimeout(done, 2000);
} else {
- // Fallback para navegadores que no soportan requestVideoFrameCallback
+ // Fallback for browsers that do not support requestVideoFrameCallback
if (video.readyState >= 2) {
const handleSeeked = () => {
video.removeEventListener('seeked', handleSeeked);
@@ -33,10 +33,10 @@ export function waitForVideoFrame(video: HTMLVideoElement): Promise<void> {
}
/**
- * Asegura que el video esté listo para exportación
+ * Ensures the video is ready for export
*/
export async function ensureVideoReady(video: HTMLVideoElement): Promise<void> {
- // Si el video no está cargado, esperar
+ // Wait if video is not loaded yet
if (video.readyState < 2) {
await new Promise<void>((resolve) => {
const onReady = () => {
@@ -52,7 +52,7 @@ export async function ensureVideoReady(video: HTMLVideoElement): Promise<void> {
video.pause();
video.currentTime = 0;
- // Esperar breve para que el frame esté listo
+ // Brief wait for the frame to be ready
await new Promise<void>(resolve => setTimeout(resolve, 100));
}
diff --git a/types/mockup.types.ts b/types/mockup.types.ts
index f1a87bb..5fac8e7 100644
--- a/types/mockup.types.ts
+++ b/types/mockup.types.ts
@@ -1,60 +1,60 @@
export type MockupCategory = "browser" | "mobile" | "ide" | "all";
-// Configuraciones disponibles para cada mockup
+// Available configurations for each mockup
export interface MockupFeatures {
hasDarkMode: boolean;
- hasFrameColor: boolean; // Color del encabezado/marco
+ hasFrameColor: boolean; // Header/frame color
hasUrl: boolean;
- hasHeaderScale: boolean; // Escala proporcional del encabezado
- hasHeaderOpacity: boolean; // Opacidad del encabezado/marco
+ hasHeaderScale: boolean; // Proportional header scale
+ hasHeaderOpacity: boolean; // Header/frame opacity
hasCornerRadius: boolean;
}
-// Configuración actual del mockup
+// Current mockup configuration
export interface MockupConfig {
darkMode: boolean;
- frameColor: string; // Color del encabezado/marco
+ frameColor: string; // Header/frame color
url: string;
- headerScale: number; // Escala del encabezado (50-150, donde 100 es normal)
- headerOpacity: number; // Opacidad del encabezado (0-100)
+ headerScale: number; // Header scale (50-150, where 100 is normal)
+ headerOpacity: number; // Header opacity (0-100)
cornerRadius: number;
}
-// Definición de un mockup
+// Mockup definition
export interface Mockup {
id: string;
name: string;
category: Exclude<MockupCategory, "all">;
preview: React.ReactNode;
- features?: MockupFeatures; // Opcional - usa DEFAULT si no está definido
+ features?: MockupFeatures; // Optional - uses DEFAULT if not defined
defaultConfig?: Partial<MockupConfig>;
}
-// Estado del sistema de mockups
+// Mockup system state
export interface MockupState {
enabled: boolean;
selectedMockupId: string;
config: MockupConfig;
}
-// Props para renderizar un mockup en el canvas
+// Props for rendering a mockup on the canvas
export interface MockupRenderProps {
children: React.ReactNode;
config: MockupConfig;
className?: string;
}
-// Configuración por defecto
+// Default configuration
export const DEFAULT_MOCKUP_CONFIG: MockupConfig = {
darkMode: false,
frameColor: "#f6f6f6",
url: "https://openvid.dev",
- headerScale: 60, // 100% = tamaño normal
- headerOpacity: 100, // 100% = totalmente opaco
+ headerScale: 60, // 100% = normal size
+ headerOpacity: 100, // 100% = fully opaque
cornerRadius: 12,
};
-// Features por defecto (ninguna feature habilitada)
+// Default features (no features enabled)
export const DEFAULT_MOCKUP_FEATURES: MockupFeatures = {
hasDarkMode: false,
hasFrameColor: false,
@@ -64,12 +64,12 @@ export const DEFAULT_MOCKUP_FEATURES: MockupFeatures = {
hasHeaderOpacity: false,
};
-// Helper para obtener las features de un mockup con fallback al default
+// Helper to get mockup features with fallback to default
export function getMockupFeatures(mockup: Mockup | undefined): MockupFeatures {
return mockup?.features ?? DEFAULT_MOCKUP_FEATURES;
}
-// Helper para obtener la config inicial de un mockup
+// Helper to get the initial config for a mockup
export function getMockupDefaultConfig(mockup: Mockup | undefined): MockupConfig {
return {
...DEFAULT_MOCKUP_CONFIG,
diff --git a/types/zoom.types.ts b/types/zoom.types.ts
index 6b323ca..398a62e 100644
--- a/types/zoom.types.ts
+++ b/types/zoom.types.ts
@@ -205,7 +205,7 @@ export interface ZoomState {
const DEFAULT_ZOOM_LEVEL = 1.5;
const DEFAULT_ZOOM_SPEED = 5;
-// Helper para crear un nuevo fragmento con valores por defecto
+// Helper to create a new fragment with default values
export function createZoomFragment(
startTime: number,
endTime: number
@@ -222,7 +222,7 @@ export function createZoomFragment(
};
}
-// Helper para generar fragmentos por defecto cuando carga un video
+// Helper to generate default fragments when a video loads
export function generateDefaultZoomFragments(
videoDuration: number
): ZoomFragment[] {
@@ -248,7 +248,7 @@ export function generateDefaultZoomFragments(
return fragments;
}
-// Convertir zoomLevel (1-10) a factor de zoom real
+// Convert zoomLevel (1-10) to actual zoom factor
export function zoomLevelToFactor(level: number): number {
const minZoom = 1.2;
const maxZoom = 4.0;
@@ -256,7 +256,7 @@ export function zoomLevelToFactor(level: number): number {
return minZoom + (maxZoom - minZoom) * normalized;
}
-// Convertir speed (1-10) a duración de transición en milisegundos
+// Convert speed (1-10) to transition duration in milliseconds
export function speedToTransitionMs(speed: number): number {
const minMs = 150;
const maxMs = 2000;