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(ui): reload the guide after an image is replaced or deleted

Luis Ortizb22f09a4cd38
diff --git a/src/ui/fullview/GuideContent.tsx b/src/ui/fullview/GuideContent.tsx
index 3eedf6c..a085266 100644
--- a/src/ui/fullview/GuideContent.tsx
+++ b/src/ui/fullview/GuideContent.tsx
@@ -350,6 +350,7 @@ export default function GuideContent({ guideId, initialStepId, initialTool }: Gu
onOpenEditor={handleOpenEditor}
onReorder={(newSteps) => setData((prev) => (prev ? { ...prev, steps: newSteps } : prev))}
readOnly={!editing || preview !== null}
+ onChanged={loadGuide}
/>
</div>
diff --git a/src/ui/fullview/components/GuideStepList.tsx b/src/ui/fullview/components/GuideStepList.tsx
index b50bcc6..c153e66 100644
--- a/src/ui/fullview/components/GuideStepList.tsx
+++ b/src/ui/fullview/components/GuideStepList.tsx
@@ -15,6 +15,7 @@ interface GuideStepListProps {
onOpenEditor: (stepId: string, tool: 'annotate' | 'redact' | 'crop' | 'target') => void;
onReorder: (newSteps: Step[]) => void;
readOnly?: boolean;
+ onChanged?: () => void;
}
export default function GuideStepList({
@@ -26,6 +27,7 @@ export default function GuideStepList({
onOpenEditor,
onReorder,
readOnly,
+ onChanged,
}: GuideStepListProps) {
const { scrollToStepId, setActiveStepId } = useFullview((s) => ({
scrollToStepId: s.scrollToStepId,
@@ -100,6 +102,7 @@ export default function GuideStepList({
onDelete={onDelete}
onOpenEditor={onOpenEditor}
readOnly={readOnly}
+ onChanged={onChanged}
dragHandleProps={
readOnly
? undefined
diff --git a/src/ui/shared/ScreenshotView.tsx b/src/ui/shared/ScreenshotView.tsx
index 55679da..85396ea 100644
--- a/src/ui/shared/ScreenshotView.tsx
+++ b/src/ui/shared/ScreenshotView.tsx
@@ -29,6 +29,7 @@ interface ScreenshotViewProps {
crop?: boolean;
readOnly?: boolean;
onOpenEditor?: (tool: 'annotate' | 'redact' | 'crop' | 'target') => void;
+ onChanged?: () => void;
}
interface DragState {
@@ -62,6 +63,7 @@ export default function ScreenshotView({
crop = false,
readOnly = false,
onOpenEditor,
+ onChanged,
}: ScreenshotViewProps) {
const [fullUrl, setFullUrl] = useState<string | null>(null);
const [showViewport, setShowViewport] = useState(false);
@@ -244,6 +246,7 @@ export default function ScreenshotView({
height,
});
setEditsOverride(nextEdits);
+ onChanged?.();
};
const handleDownload = async (which: 'edited' | 'original') => {
@@ -262,6 +265,7 @@ export default function ScreenshotView({
setConfirmDelete(false);
await deleteScreenshot(screenshot.stepId);
setDeleted(true);
+ onChanged?.();
};
const ratio = baseScreenshot.width && baseScreenshot.height ? baseScreenshot.width / baseScreenshot.height : 16 / 9;
diff --git a/src/ui/sidepanel/GuideEditor.tsx b/src/ui/sidepanel/GuideEditor.tsx
index 45cfa5e..193ec84 100644
--- a/src/ui/sidepanel/GuideEditor.tsx
+++ b/src/ui/sidepanel/GuideEditor.tsx
@@ -236,6 +236,7 @@ export default function GuideEditor({ guideId, onBack, onGuideMe }: GuideEditorP
onDelete={handleDeleteStep}
onOpenEditor={(stepId, tool) => openInFullView(guideId, { stepId, tool })}
readOnly={!editing}
+ onChanged={loadGuide}
dragHandleProps={
editing
? {
diff --git a/src/ui/sidepanel/StepCard.tsx b/src/ui/sidepanel/StepCard.tsx
index d308c6c..ef93da5 100644
--- a/src/ui/sidepanel/StepCard.tsx
+++ b/src/ui/sidepanel/StepCard.tsx
@@ -24,6 +24,7 @@ interface StepCardProps {
onCopy?: (stepId: string) => void;
placeholderRatio?: number;
readOnly?: boolean;
+ onChanged?: () => void;
}
export default function StepCard({
@@ -35,6 +36,7 @@ export default function StepCard({
onOpenEditor,
placeholderRatio,
readOnly,
+ onChanged,
}: StepCardProps) {
const [description, setDescription] = useState(step.description);
const [dragOver, setDragOver] = useState(false);
@@ -104,6 +106,7 @@ export default function StepCard({
crop
readOnly={readOnly}
onOpenEditor={!readOnly && onOpenEditor ? (tool) => onOpenEditor(step.id, tool) : undefined}
+ onChanged={onChanged}
/>
) : (
<ImagePlaceholder