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 📖

fix(editor): hide the generate control while AI meta is still being written

Luis Ortiz732f5301eef8
diff --git a/src/locales/en.yml b/src/locales/en.yml
index 3242fd7..c7cd4f1 100644
--- a/src/locales/en.yml
+++ b/src/locales/en.yml
@@ -127,6 +127,7 @@ fullview:
guideMe: Guide Me
untitledGuide: Untitled Guide
writingTitle: Writing a title from your captured steps...
+ writingDescription: "Writing a description\u2026"
guideNotFound: "Guide not found."
stepCount: "$1 step"
stepCountPlural: "$1 steps"
diff --git a/src/locales/es.yml b/src/locales/es.yml
index 50efd3b..b51abf8 100644
--- a/src/locales/es.yml
+++ b/src/locales/es.yml
@@ -127,6 +127,7 @@ fullview:
guideMe: "¡Guíame!"
untitledGuide: Guía sin título
writingTitle: Escribiendo un título con tus pasos capturados...
+ writingDescription: "Escribiendo una descripci\xF3n\u2026"
guideNotFound: "No se encontró la guía."
stepCount: "$1 paso"
stepCountPlural: "$1 pasos"
diff --git a/src/locales/fr.yml b/src/locales/fr.yml
index f51af43..1ec5f9e 100644
--- a/src/locales/fr.yml
+++ b/src/locales/fr.yml
@@ -127,6 +127,7 @@ fullview:
guideMe: "Guidez-moi !"
untitledGuide: Guide sans titre
writingTitle: "Rédaction du titre à partir de vos étapes..."
+ writingDescription: "R\xE9daction d\u2019une description\u2026"
guideNotFound: Guide introuvable.
stepCount: "$1 étape"
stepCountPlural: "$1 étapes"
diff --git a/src/locales/pt-BR.yml b/src/locales/pt-BR.yml
index 9d0882d..25ef1d3 100644
--- a/src/locales/pt-BR.yml
+++ b/src/locales/pt-BR.yml
@@ -127,6 +127,7 @@ fullview:
guideMe: "Me guia!"
untitledGuide: Guia sem título
writingTitle: Escrevendo um título com os passos capturados...
+ writingDescription: "Escrevendo uma descri\xE7\xE3o\u2026"
guideNotFound: "Guia não encontrado."
stepCount: "$1 passo"
stepCountPlural: "$1 passos"
diff --git a/src/ui/fullview/GuideContent.tsx b/src/ui/fullview/GuideContent.tsx
index 8cfda76..31cb8f4 100644
--- a/src/ui/fullview/GuideContent.tsx
+++ b/src/ui/fullview/GuideContent.tsx
@@ -1,4 +1,4 @@
-import { History, Play, Sparkles } from 'lucide-react';
+import { History, Loader2, Play, Sparkles } from 'lucide-react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { TypeAnimation } from 'react-type-animation';
import { i18n } from '#imports';
@@ -280,6 +280,7 @@ export default function GuideContent({ guideId, initialStepId, initialTool }: Gu
const animatingTitle = preview ? null : typingTitle;
const untitledPending =
!preview && !typingTitle && title === i18n.t('fullview_untitledGuide') && viewSteps.length > 0;
+ const metaGenerating = (untitledPending || animatingTitle !== null) && !description;
return (
<div className="flex flex-col min-h-[calc(100vh-64px)]">
@@ -356,8 +357,12 @@ export default function GuideContent({ guideId, initialStepId, initialTool }: Gu
{!preview && (
<div className="mt-3">
- {editing ? (
- <>
+ {metaGenerating ? (
+ <div className="max-w-[720px] text-[15px] leading-relaxed animate-gradient-text bg-[length:300%_100%] bg-clip-text text-transparent bg-gradient-to-r from-muted-foreground via-violet to-muted-foreground">
+ {i18n.t('fullview_writingDescription')}
+ </div>
+ ) : editing ? (
+ <div className="flex items-start gap-2 max-w-[720px]">
<textarea
ref={(el) => {
if (el) {
@@ -378,26 +383,25 @@ export default function GuideContent({ guideId, initialStepId, initialTool }: Gu
}}
onBlur={handleGuideDescriptionBlur}
placeholder={i18n.t('editor.descriptionPlaceholder')}
- className="w-full max-w-[720px] resize-none overflow-hidden bg-transparent p-0 text-[15px] leading-relaxed text-muted-foreground placeholder:text-muted-foreground/60 border-b-2 border-transparent hover:border-border focus:outline-none focus:border-accent"
+ className="flex-1 resize-none overflow-hidden bg-transparent p-0 text-[15px] leading-relaxed text-muted-foreground placeholder:text-muted-foreground/60 border-b-2 border-transparent hover:border-border focus:outline-none focus:border-accent"
/>
{hasApiKey && (
<button
type="button"
onClick={handleGenerateDescription}
- disabled={generating}
+ disabled={generating || metaGenerating}
title={description ? i18n.t('editor.regenerateDescription') : i18n.t('editor.generateDescription')}
- className="mt-1.5 inline-flex items-center gap-1.5 text-xs font-semibold text-accent hover:text-deep disabled:opacity-50 disabled:cursor-not-allowed"
+ className="shrink-0 mt-0.5 p-1 rounded-md text-muted-foreground hover:text-accent hover:bg-secondary transition-colors disabled:cursor-not-allowed"
>
- <Sparkles size={13} className={generating ? 'animate-pulse' : ''} />
- {generating
- ? i18n.t('editor.generatingDescription')
- : description
- ? i18n.t('editor.regenerateDescription')
- : i18n.t('editor.generateDescription')}
+ {generating || metaGenerating ? (
+ <Loader2 size={15} className="animate-spin text-accent" />
+ ) : (
+ <Sparkles size={15} />
+ )}
</button>
)}
<Toast message={descriptionError} onDismiss={() => setDescriptionError(null)} />
- </>
+ </div>
) : (
description && (
<p className="max-w-[720px] text-[15px] leading-relaxed text-muted-foreground">{description}</p>
diff --git a/src/ui/sidepanel/GuideEditor.tsx b/src/ui/sidepanel/GuideEditor.tsx
index b1a5fab..46116cb 100644
--- a/src/ui/sidepanel/GuideEditor.tsx
+++ b/src/ui/sidepanel/GuideEditor.tsx
@@ -188,6 +188,8 @@ export default function GuideEditor({ guideId, onBack, onGuideMe }: GuideEditorP
);
}
+ const metaGenerating = title === i18n.t('fullview.untitledGuide') && data.steps.length > 0 && !description;
+
return (
<div className="min-h-screen bg-card flex flex-col">
<div className="px-4 pt-3 pb-2">
@@ -270,12 +272,12 @@ export default function GuideEditor({ guideId, onBack, onGuideMe }: GuideEditorP
<button
type="button"
onClick={handleGenerateDescription}
- disabled={generating}
+ disabled={generating || metaGenerating}
title={description ? i18n.t('editor.regenerateDescription') : i18n.t('editor.generateDescription')}
className="mt-1 flex items-center gap-1 text-[11px] font-medium text-accent hover:text-deep disabled:opacity-50 disabled:cursor-not-allowed"
>
- <Sparkles size={11} className={generating ? 'animate-pulse' : ''} />
- {generating
+ <Sparkles size={11} className={generating || metaGenerating ? 'animate-pulse' : ''} />
+ {generating || metaGenerating
? i18n.t('editor.generatingDescription')
: description
? i18n.t('editor.regenerateDescription')