Skip to content

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

feat: enhance localization and tooltip functionality across editor components

CristianOlivera1a74e83e7abed
diff --git a/app/components/ui/editor/EditorHoverTooltip.tsx b/app/components/ui/editor/EditorHoverTooltip.tsx
index 5ca311f..68a2467 100644
--- a/app/components/ui/editor/EditorHoverTooltip.tsx
+++ b/app/components/ui/editor/EditorHoverTooltip.tsx
@@ -13,14 +13,17 @@ export function EditorHoverTooltip({ show }: EditorHoverTooltipProps) {
return (
<div className="flex items-center justify-center pointer-events-none animate-in fade-in zoom-in-95 duration-200">
<div className="flex items-center gap-4 px-4 py-2 w-fit h-auto bg-[#0A0A0A]/90 backdrop-blur-md rounded-full border border-white/30 shadow-2xl">
+ <span className="text-[11px] text-white/70 font-medium tracking-tight whitespace-nowrap">
+ {t("zoom")}
+ </span>
<div className="flex items-center gap-3 shrink-0">
<div className="flex items-center gap-1">
<kbd className="h-5 px-1.5 flex items-center justify-center bg-[#171717] rounded border border-white/30 text-[9px] text-white font-mono">
- Ctrl
+ {t("ctrl")}
</kbd>
<span className="text-white/70 text-[11px]">+</span>
<kbd className="h-5 px-1.5 flex items-center justify-center bg-[#171717] rounded border border-white/30 text-[9px] text-white font-mono">
- Scroll
+ {t("scroll")}
</kbd>
</div>
</div>
@@ -33,11 +36,11 @@ export function EditorHoverTooltip({ show }: EditorHoverTooltipProps) {
</span>
<div className="flex items-center gap-1">
<kbd className="h-5 px-1.5 flex items-center justify-center bg-[#171717] rounded border border-white/30 text-[9px] text-white font-mono">
- Ctrl
+ {t("ctrl")}
</kbd>
<span className="text-white/70 text-[11px]">+</span>
<kbd className="w-5 h-5 flex items-center justify-center bg-[#171717] rounded border border-white/30 text-[9px] text-white font-mono">
- V
+ {t("keyV")}
</kbd>
</div>
</div>
diff --git a/app/components/ui/editor/ImageCropperModal.tsx b/app/components/ui/editor/ImageCropperModal.tsx
index 2b3db2c..9ff483a 100644
--- a/app/components/ui/editor/ImageCropperModal.tsx
+++ b/app/components/ui/editor/ImageCropperModal.tsx
@@ -23,6 +23,7 @@ export function ImageCropperModal({
initialCrop,
}: ImageCropperModalProps) {
const t = useTranslations("videoCropper");
+ const t2 = useTranslations("editor");
const containerRef = useRef<HTMLDivElement>(null);
const imageRef = useRef<HTMLImageElement>(null);
const [cropArea, setCropArea] = useState<CropArea>(initialCrop ?? { x: 0, y: 0, width: 100, height: 100 });
@@ -232,7 +233,7 @@ export function ImageCropperModal({
<div className="w-6 h-6 rounded-md bg-white/10 flex items-center justify-center">
<Icon icon="mdi:crop" className="text-sm text-white/70" />
</div>
- <span className="text-sm font-medium text-white">Recortar Imagen</span>
+ <span className="text-sm font-medium text-white">{t2("cropper.button")}</span>
{imageDimensions.width > 0 && (
<span className="text-[11px] font-mono text-white/70 bg-white/4 px-2 py-0.5 rounded-md border border-white/10">
{imageDimensions.width} × {imageDimensions.height}
diff --git a/app/components/ui/editor/Mockup2dMenu.tsx b/app/components/ui/editor/Mockup2dMenu.tsx
index 434df94..1b5fc48 100644
--- a/app/components/ui/editor/Mockup2dMenu.tsx
+++ b/app/components/ui/editor/Mockup2dMenu.tsx
@@ -81,7 +81,7 @@ export function Mockup2dMenu({
</div>
<div className="absolute bottom-0 left-0 right-0 px-3 py-2 bg-gradient-to-t from-black/80 to-transparent">
<span className="text-[11px] font-bold text-white/90 tracking-wide">
- {currentMockup.name}
+ {t(`mockups.${currentMockup.id}`)}
</span>
</div>
</div>
diff --git a/app/components/ui/editor/MockupMenu.tsx b/app/components/ui/editor/MockupMenu.tsx
index 0952a62..3e19141 100644
--- a/app/components/ui/editor/MockupMenu.tsx
+++ b/app/components/ui/editor/MockupMenu.tsx
@@ -341,7 +341,7 @@ export function MockupMenu({
</div>
<div className="flex items-center gap-1.5">
<span className="text-[11px] font-bold tracking-wider">
- {currentMockup?.name || t("none")}
+ {t(`mockups.${currentMockup?.id}`) || t("none")}
</span>
</div>
</div>
@@ -364,7 +364,7 @@ export function MockupMenu({
}`}
>
<Icon icon={cat.icon} width="12" />
- <span>{cat.label}</span>
+ <span>{t(`categories.${cat.id}`)}</span>
</button>
))}
<span className="ml-auto text-[11px] text-white/70">
@@ -407,7 +407,7 @@ export function MockupMenu({
</div>
<div className="absolute inset-0 group-hover:bg-black/5 transition-colors pointer-events-none" />
<div className="absolute bottom-0 left-0 bg-black/60 border-t border-r border-white/10 px-1 py-0.5 text-[11px] text-white/80 font-semibold tracking-tight rounded-tr-md rounded-bl-lg z-30">
- {mockup.name}
+ {t(`mockups.${currentMockup?.id}`) || t("none")}
</div>
{isActive && (
<div className="absolute top-2 right-2 rounded-full shadow-[0_0_10px_rgba(96,165,250,0.8)] z-30">
@@ -448,7 +448,7 @@ export function MockupMenu({
</div>
</div>
<div className="absolute bottom-0 left-0 bg-black/60 border-t border-r border-white/10 px-1 py-0.5 text-[9px] text-white/80 font-semibold tracking-tight rounded-tr-md rounded-bl-lg z-30">
- {mockup.name}
+ {t(`mockups.${currentMockup?.id}`) || t("none")}
</div>
{isActive && (
<div className="absolute top-1.5 right-1.5 rounded-full shadow-[0_0_8px_rgba(96,165,250,0.7)] z-30 flex items-center justify-center size-4">
@@ -462,60 +462,60 @@ export function MockupMenu({
</div>
</div>
</div>
- {mediaType === "image" && (
- <>
- <div className="h-px bg-white/6" />
- <div className="flex flex-col gap-3">
- <div className="flex items-center justify-between">
- <p className="text-[11px] uppercase tracking-widest text-white/40 font-bold">
- {t("devices3D")}
- </p>
- <div className="flex items-center gap-2">
- <div className="flex items-center squircle-element border border-white/8 bg-white/3 p-0.5">
- <button
- type="button"
- onClick={() => scrollDevices("left")}
- disabled={!canScrollLeft}
- className="flex size-7 items-center justify-center squircle-element text-white/70 transition-all hover:bg-white/6 hover:text-white disabled:pointer-events-none disabled:opacity-30"
- >
- <Icon icon="ph:caret-left-bold" width="12" />
- </button>
- <button
- type="button"
- onClick={() => scrollDevices("right")}
- disabled={!canScrollRight}
- className="flex size-7 items-center justify-center rounded-full text-white/70 transition-all hover:bg-white/6 hover:text-white disabled:pointer-events-none disabled:opacity-30"
- >
- <Icon icon="ph:caret-right-bold" width="12" />
- </button>
- </div>
+
+ <>
+ <div className="h-px bg-white/6" />
+ <div className="flex flex-col gap-3">
+ <div className="flex items-center justify-between">
+ <p className="text-[11px] uppercase tracking-widest text-white/40 font-bold">
+ {t("devices3D")}
+ </p>
+ <div className="flex items-center gap-2">
+ <div className="flex items-center squircle-element border border-white/8 bg-white/3 p-0.5">
+ <button
+ type="button"
+ onClick={() => scrollDevices("left")}
+ disabled={!canScrollLeft}
+ className="flex size-7 items-center justify-center squircle-element text-white/70 transition-all hover:bg-white/6 hover:text-white disabled:pointer-events-none disabled:opacity-30"
+ >
+ <Icon icon="ph:caret-left-bold" width="12" />
+ </button>
+ <button
+ type="button"
+ onClick={() => scrollDevices("right")}
+ disabled={!canScrollRight}
+ className="flex size-7 items-center justify-center rounded-full text-white/70 transition-all hover:bg-white/6 hover:text-white disabled:pointer-events-none disabled:opacity-30"
+ >
+ <Icon icon="ph:caret-right-bold" width="12" />
+ </button>
</div>
</div>
+ </div>
- <div className="relative">
- <div
- className={`pointer-events-none absolute inset-y-0 right-0 z-20 w-12 bg-gradient-to-l from-[#141417] to-transparent transition-opacity duration-200 ${canScrollRight ? "opacity-100" : "opacity-0"
- }`}
- />
- <div
- ref={devicesScrollRef}
- className="grid grid-rows-2 grid-flow-col gap-2 overflow-x-auto overflow-y-hidden snap-x snap-mandatory scroll-smooth pb-2 pl-1 pr-12 custom-scrollbar"
- style={{ scrollbarWidth: "none", msOverflowStyle: "none" }}
- onScroll={handleDevicesScroll}
- >
- {IMAGE_DEVICE_TEMPLATES.map((tpl) => (
- <DeviceCard
- key={tpl.id}
- tpl={tpl}
- isActive={activeDeviceId === tpl.id}
- onClick={() => handleDeviceClick(tpl.id)}
- />
- ))}
- </div>
+ <div className="relative">
+ <div
+ className={`pointer-events-none absolute inset-y-0 right-0 z-20 w-12 bg-gradient-to-l from-[#141417] to-transparent transition-opacity duration-200 ${canScrollRight ? "opacity-100" : "opacity-0"
+ }`}
+ />
+ <div
+ ref={devicesScrollRef}
+ className="grid grid-rows-2 grid-flow-col gap-2 overflow-x-auto overflow-y-hidden snap-x snap-mandatory scroll-smooth pb-2 pl-1 pr-12 custom-scrollbar"
+ style={{ scrollbarWidth: "none", msOverflowStyle: "none" }}
+ onScroll={handleDevicesScroll}
+ >
+ {IMAGE_DEVICE_TEMPLATES.map((tpl) => (
+ <DeviceCard
+ key={tpl.id}
+ tpl={tpl}
+ isActive={activeDeviceId === tpl.id}
+ onClick={() => handleDeviceClick(tpl.id)}
+ />
+ ))}
</div>
</div>
- </>
- )}
+ </div>
+ </>
+
{hasActiveFrame && (
<Button onClick={handleRemoveAll} variant="outline" className="w-full text-xs" aria-label={t("remove")}>
<Icon icon="ph:trash-bold" width="13" aria-hidden="true" />
diff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsx
index 26e45c9..5a6d30f 100644
--- a/app/components/ui/editor/VideoCanvas.tsx
+++ b/app/components/ui/editor/VideoCanvas.tsx
@@ -406,7 +406,7 @@ function VideoCanvasInner({
const PADDING_MAX = 30;
const base = pendingPaddingRef.current ?? padding;
const step = Math.min(1.5, Math.max(0.15, Math.abs(e.deltaY) * 0.015));
- const next = Math.max(PADDING_MIN, Math.min(PADDING_MAX, base + (e.deltaY < 0 ? step : -step)));
+ const next = Math.max(PADDING_MIN, Math.min(PADDING_MAX, base + (e.deltaY < 0 ? -step : step)));
pendingPaddingRef.current = next;
if (paddingWheelRafRef.current === null) {
diff --git a/app/components/ui/editor/mockups/MacosMockup.tsx b/app/components/ui/editor/mockups/MacosMockup.tsx
index 6b5c4c9..4bb44ed 100644
--- a/app/components/ui/editor/mockups/MacosMockup.tsx
+++ b/app/components/ui/editor/mockups/MacosMockup.tsx
@@ -95,7 +95,7 @@ export function MacosMockup({
>
<Icon icon="mdi:lock" className="opacity-60 shrink-0" style={{ width: `${buttonSize}px`, height: `${buttonSize}px` }} />
<span
- className="flex-1 text-center font-medium truncate min-w-0"
+ className="flex-1 text-center font-medium truncate min-w-0 mt-0.5"
style={{
fontSize: `${fontSize}px`,
padding: `0 ${urlBarPadding}px`,
diff --git a/components/ui/DeviceCard.tsx b/components/ui/DeviceCard.tsx
index 8da183f..0fc7316 100644
--- a/components/ui/DeviceCard.tsx
+++ b/components/ui/DeviceCard.tsx
@@ -1,6 +1,7 @@
import { useEffect, useRef, useState } from "react";
import { Icon } from "@iconify/react";
import { IMAGE_DEVICE_TEMPLATES } from "@/types";
+import { useTranslations } from "next-intl";
export function DeviceCard({
tpl,
@@ -11,6 +12,7 @@ export function DeviceCard({
isActive: boolean;
onClick: () => void;
}) {
+ const t = useTranslations("mockupMenu");
const videoRef = useRef<HTMLVideoElement | null>(null);
const [isHovering, setIsHovering] = useState(false);
const [videoReady, setVideoReady] = useState(false);
@@ -89,7 +91,7 @@ export function DeviceCard({
<div className="absolute inset-0 h-24 bg-gradient-to-t from-black via-black/70 to-transparent" />
<div className="relative flex items-center gap-2 p-3">
<Icon icon={tpl.icon} width={10} />
- <span className="truncate text-[11px] text-white">{tpl.title}</span>
+ <span className="truncate text-[11px] text-white">{t(`devices.${tpl.id}`)}</span>
</div>
</div>
{isActive && (
diff --git a/messages/en.json b/messages/en.json
index 6bba8c0..006ee2f 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -642,6 +642,44 @@
"sliders": {
"headerScale": "Header scale",
"headerOpacity": "Header opacity"
+ },
+ "categories": {
+ "all": "Todos",
+ "browser": "Navegador",
+ "mobile": "Móvil",
+ "ide": "Editor de Código"
+ },
+ "mockups": {
+ "none": "Ninguno",
+ "macos": "MacOS",
+ "macos-glass": "MacOS Cristal",
+ "outline": "Contorno",
+ "glass-ui-container": "Contenedor UI Cristal",
+ "macos-ghost": "MacOS Fantasma",
+ "macos-ghost-glass": "MacOS Fantasma Cristal",
+ "macos-container-glass": "Contenedor MacOS Cristal",
+ "brave": "Brave",
+ "brave-glass": "Brave Cristal",
+ "browser-tab-glass": "Pestaña de Navegador Cristal",
+ "chrome": "Chrome",
+ "chrome-glass": "Chrome Cristal",
+ "iphone-slim": "iPhone Delgado",
+ "glass-curve": "Cristal Curvo",
+ "glass-full": "Cristal Completo",
+ "hard-shell": "Carcasa Dura",
+ "s24-ultra": "S24 Ultra",
+ "vscode": "VS Code",
+ "macos-dark-ide": "VS Code MacOS",
+ "macos-ghost-ide": "MacOS Fantasma IDE"
+ },
+ "devices": {
+ "iphone-13-pro-max": "iPhone 13 Pro",
+ "double_iphone_13_pro": "Doble iPhone 13 Pro",
+ "iphone-17-pro-max": "iPhone 17 Pro",
+ "iphone": "iPhone 15 Pro",
+ "phone": "Teléfono genérico",
+ "laptop": "Portátil macOS",
+ "ipad_mini_6_2021": "iPad mini 6 (2021)"
}
},
"videosMenu": {
@@ -993,7 +1031,11 @@
}
},
"hoverTooltip": {
- "paste": "Paste"
+ "zoom": "Zoom",
+ "paste": "Paste",
+ "ctrl": "Ctrl",
+ "scroll": "Scroll",
+ "keyV": "V"
},
"layerPanel": {
"tooltips": {
diff --git a/messages/es.json b/messages/es.json
index 0d13a7d..52e9b9e 100644
--- a/messages/es.json
+++ b/messages/es.json
@@ -598,6 +598,44 @@
"sliders": {
"headerScale": "Escala del encabezado",
"headerOpacity": "Transparencia del encabezado"
+ },
+ "categories": {
+ "all": "Todos",
+ "browser": "Navegador",
+ "mobile": "Móvil",
+ "ide": "Editor de Código"
+ },
+ "mockups": {
+ "none": "Ninguno",
+ "macos": "MacOS",
+ "macos-glass": "MacOS Cristal",
+ "outline": "Contorno",
+ "glass-ui-container": "Contenedor UI Cristal",
+ "macos-ghost": "MacOS Fantasma",
+ "macos-ghost-glass": "MacOS Fantasma Cristal",
+ "macos-container-glass": "Contenedor MacOS Cristal",
+ "brave": "Brave",
+ "brave-glass": "Brave Cristal",
+ "browser-tab-glass": "Pestaña de Navegador Cristal",
+ "chrome": "Chrome",
+ "chrome-glass": "Chrome Cristal",
+ "iphone-slim": "iPhone Delgado",
+ "glass-curve": "Cristal Curvo",
+ "glass-full": "Cristal Completo",
+ "hard-shell": "Carcasa Dura",
+ "s24-ultra": "S24 Ultra",
+ "vscode": "VS Code",
+ "macos-dark-ide": "VS Code MacOS",
+ "macos-ghost-ide": "MacOS Fantasma IDE"
+ },
+ "devices": {
+ "iphone-13-pro-max": "iPhone 13 Pro",
+ "double_iphone_13_pro": "Double iPhone 13 Pro",
+ "iphone-17-pro-max": "iPhone 17 Pro",
+ "iphone": "iPhone 15 Pro",
+ "phone": "Generic Phone",
+ "laptop": "macOS Laptop",
+ "ipad_mini_6_2021": "iPad mini 6 (2021)"
}
},
"videosMenu": {
@@ -949,7 +987,11 @@
}
},
"hoverTooltip": {
- "paste": "Pegar"
+ "zoom": "Zoom",
+ "paste": "Pegar",
+ "ctrl": "Ctrl",
+ "scroll": "Scroll",
+ "keyV": "V"
},
"layerPanel": {
"tooltips": {
diff --git a/messages/ko.json b/messages/ko.json
index 9314005..3d41f77 100644
--- a/messages/ko.json
+++ b/messages/ko.json
@@ -642,6 +642,44 @@
"sliders": {
"headerScale": "헤더 크기",
"headerOpacity": "헤더 불투명도"
+ },
+ "categories": {
+ "all": "모두",
+ "browser": "브라우저",
+ "mobile": "모바일",
+ "ide": "IDE"
+ },
+ "mockups": {
+ "none": "없음",
+ "macos": "MacOS",
+ "macos-glass": "MacOS 글래스",
+ "outline": "윤곽선",
+ "glass-ui-container": "글래스 UI 컨테이너",
+ "macos-ghost": "MacOS 고스트",
+ "macos-ghost-glass": "MacOS 고스트 글래스",
+ "macos-container-glass": "MacOS 컨테이너 글래스",
+ "brave": "Brave",
+ "brave-glass": "Brave 글래스",
+ "browser-tab-glass": "브라우저 탭 글래스",
+ "chrome": "Chrome",
+ "chrome-glass": "Chrome 글래스",
+ "iphone-slim": "iPhone 슬림",
+ "glass-curve": "글래스 커브",
+ "glass-full": "풀 글래스",
+ "hard-shell": "하드 쉘",
+ "s24-ultra": "S24 Ultra",
+ "vscode": "VS Code",
+ "macos-dark-ide": "VS Code MacOS",
+ "macos-ghost-ide": "MacOS 고스트 IDE"
+ },
+ "devices": {
+ "iphone-13-pro-max": "iPhone 13 Pro",
+ "double_iphone_13_pro": "더블 iPhone 13 Pro",
+ "iphone-17-pro-max": "iPhone 17 Pro",
+ "iphone": "iPhone 15 Pro",
+ "phone": "휴대폰",
+ "laptop": "macOS 노트북",
+ "ipad_mini_6_2021": "iPad mini 6 (2021)"
}
},
"videosMenu": {
@@ -993,7 +1031,11 @@
}
},
"hoverTooltip": {
- "paste": "붙여넣기"
+ "zoom": "줌",
+ "paste": "붙여넣기",
+ "ctrl": "Ctrl",
+ "scroll": "스크롤",
+ "keyV": "V"
},
"layerPanel": {
"tooltips": {
diff --git a/messages/ru.json b/messages/ru.json
index 796107f..64364a4 100644
--- a/messages/ru.json
+++ b/messages/ru.json
@@ -610,6 +610,44 @@
"sliders": {
"headerScale": "Масштаб заголовка",
"headerOpacity": "Прозрачность заголовка"
+ },
+ "categories": {
+ "all": "Все",
+ "browser": "Браузер",
+ "mobile": "Мобильные",
+ "ide": "Редакторы (IDE)"
+ },
+ "mockups": {
+ "none": "Без рамки",
+ "macos": "MacOS",
+ "macos-glass": "MacOS Стекло",
+ "outline": "Контур",
+ "glass-ui-container": "Стеклянный контейнер UI",
+ "macos-ghost": "MacOS Призрак",
+ "macos-ghost-glass": "MacOS Призрак Стекло",
+ "macos-container-glass": "MacOS Стеклянный контейнер",
+ "brave": "Brave",
+ "brave-glass": "Brave Стекло",
+ "browser-tab-glass": "Вкладка браузера Стекло",
+ "chrome": "Chrome",
+ "chrome-glass": "Chrome Стекло",
+ "iphone-slim": "iPhone Тонкий",
+ "glass-curve": "Стеклянная кривая",
+ "glass-full": "Полное стекло",
+ "hard-shell": "Жесткий корпус",
+ "s24-ultra": "S24 Ultra",
+ "vscode": "VS Code",
+ "macos-dark-ide": "VS Code MacOS",
+ "macos-ghost-ide": "MacOS Призрак IDE"
+ },
+ "devices": {
+ "iphone-13-pro-max": "iPhone 13 Pro",
+ "double_iphone_13_pro": "Двойной iPhone 13 Pro",
+ "iphone-17-pro-max": "iPhone 17 Pro",
+ "iphone": "iPhone 15 Pro",
+ "phone": "Телефон",
+ "laptop": "Ноутбук macOS",
+ "ipad_mini_6_2021": "iPad mini 6 (2021)"
}
},
"videosMenu": {
@@ -961,7 +999,11 @@
}
},
"hoverTooltip": {
- "paste": "Вставить"
+ "zoom": "Масштаб",
+ "paste": "Вставить",
+ "ctrl": "Ctrl",
+ "scroll": "Скролл",
+ "keyV": "V"
},
"layerPanel": {
"tooltips": {