Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots 📖

feat(export): add video to the export menu and locales

Luis Ortiz7c2c26257f90
diff --git a/src/locales/en.yml b/src/locales/en.yml
index 613a19f..103ecbd 100644
--- a/src/locales/en.yml
+++ b/src/locales/en.yml
@@ -296,11 +296,16 @@ exportPreview:
download: "Export $1"
rendering: "Updating preview"
truncated: "Preview shows the first $1 of $2 steps"
+ modeDocument: "Document"
+ modeVideo: "Video"
+ encodingVideo: "Encoding video preview"
+ videoFailed: "The video preview could not be created"
exportMenu:
docx: DOCX
html: HTML
markdown: Markdown
pdf: PDF
+ video: Video
onboarding:
welcomeBadge: Welcome
diff --git a/src/locales/es.yml b/src/locales/es.yml
index 7b101d8..21e9fc5 100644
--- a/src/locales/es.yml
+++ b/src/locales/es.yml
@@ -296,11 +296,16 @@ exportPreview:
download: "Exportar $1"
rendering: "Actualizando vista previa"
truncated: "La vista previa muestra los primeros $1 de $2 pasos"
+ modeDocument: "Documento"
+ modeVideo: "VĂ­deo"
+ encodingVideo: "Codificando la vista previa del vĂ­deo"
+ videoFailed: "No se pudo crear la vista previa del vĂ­deo"
exportMenu:
docx: DOCX
html: HTML
markdown: Markdown
pdf: PDF
+ video: VĂ­deo
onboarding:
welcomeBadge: Bienvenido
diff --git a/src/locales/fr.yml b/src/locales/fr.yml
index 4de2ebc..2b80964 100644
--- a/src/locales/fr.yml
+++ b/src/locales/fr.yml
@@ -296,11 +296,16 @@ exportPreview:
download: "Exporter $1"
rendering: "Mise à jour de l’aperçu"
truncated: "L’aperçu montre les $1 premiĂšres Ă©tapes sur $2"
+ modeDocument: "Document"
+ modeVideo: "Vidéo"
+ encodingVideo: "Encodage de l’aperçu vidĂ©o"
+ videoFailed: "Impossible de crĂ©er l’aperçu vidĂ©o"
exportMenu:
docx: DOCX
html: HTML
markdown: Markdown
pdf: PDF
+ video: Vidéo
onboarding:
welcomeBadge: Bienvenue
diff --git a/src/locales/pt-BR.yml b/src/locales/pt-BR.yml
index 7c231aa..750f0dd 100644
--- a/src/locales/pt-BR.yml
+++ b/src/locales/pt-BR.yml
@@ -296,11 +296,16 @@ exportPreview:
download: "Exportar $1"
rendering: "Atualizando prévia"
truncated: "A prévia mostra as primeiras $1 de $2 etapas"
+ modeDocument: "Documento"
+ modeVideo: "VĂ­deo"
+ encodingVideo: "Codificando a prévia do vídeo"
+ videoFailed: "Não foi possível criar a prévia do vídeo"
exportMenu:
docx: DOCX
html: HTML
markdown: Markdown
pdf: PDF
+ video: VĂ­deo
onboarding:
welcomeBadge: Bem-vindo
diff --git a/src/ui/sidepanel/ExportMenu.tsx b/src/ui/sidepanel/ExportMenu.tsx
index ae0935d..f594154 100644
--- a/src/ui/sidepanel/ExportMenu.tsx
+++ b/src/ui/sidepanel/ExportMenu.tsx
@@ -1,10 +1,11 @@
-import { Download, FileCode, FileDown, FileText, Loader2 } from 'lucide-react';
+import { Download, FileCode, FileDown, FileText, Loader2, Video } from 'lucide-react';
import { useEffect, useRef, useState } from 'react';
import { i18n } from '#imports';
import { downloadBlob, downloadText, safeFilename } from '@/core/export/download';
import { exportGuideAsHTML } from '@/core/export/html-export';
import { exportGuideAsMarkdown } from '@/core/export/markdown-export';
import { exportGuideAsPDF } from '@/core/export/pdf-export';
+import { canExportVideo } from '@/core/export/video-support';
import { getGuide } from '@/core/guides/service';
import type { Guide, Screenshot, Step } from '@/core/guides/types';
import { Button } from '@/ui/components/ui/button';
@@ -16,7 +17,7 @@ interface ExportMenuProps {
screenshots: Map<string, Screenshot>;
}
-type ExportType = 'docx' | 'html' | 'markdown' | 'pdf';
+type ExportType = 'docx' | 'html' | 'markdown' | 'pdf' | 'video';
export default function ExportMenu({
guideId,
@@ -26,8 +27,19 @@ export default function ExportMenu({
}: ExportMenuProps) {
const [open, setOpen] = useState(false);
const [exporting, setExporting] = useState(false);
+ const [videoSupported, setVideoSupported] = useState(false);
const menuRef = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ let active = true;
+ canExportVideo().then((supported) => {
+ if (active) setVideoSupported(supported);
+ });
+ return () => {
+ active = false;
+ };
+ }, []);
+
useEffect(() => {
function handleClickOutside(e: MouseEvent) {
if (menuRef.current && !menuRef.current.contains(e.target as Node)) setOpen(false);
@@ -54,6 +66,10 @@ export default function ExportMenu({
} else if (type === 'markdown') {
const md = await exportGuideAsMarkdown(guide, steps, screenshots);
downloadText(md, safeFilename(guide.title, 'md'), 'text/markdown');
+ } else if (type === 'video') {
+ const { exportGuideAsVideo } = await import('@/core/export/video-export');
+ const { blob, extension } = await exportGuideAsVideo(guide, steps, screenshots);
+ downloadBlob(blob, safeFilename(guide.title, extension));
} else {
downloadBlob(await exportGuideAsPDF(guide, steps, screenshots), safeFilename(guide.title, 'pdf'));
}
@@ -67,6 +83,7 @@ export default function ExportMenu({
{ type: 'html' as const, icon: FileCode, label: i18n.t('exportMenu.html') },
{ type: 'markdown' as const, icon: FileText, label: i18n.t('exportMenu.markdown') },
{ type: 'pdf' as const, icon: FileDown, label: i18n.t('exportMenu.pdf') },
+ ...(videoSupported ? [{ type: 'video' as const, icon: Video, label: i18n.t('exportMenu.video') }] : []),
];
return (