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: UI polish β€” save button, empty state, highlight, settings

Luis Ortiz40693fef8164
diff --git a/.gitignore b/.gitignore
index fa521fa..21cc761 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ dist/
docs/
.source/
.claude/
+mockups/
diff --git a/src/core/capture/start-notification.ts b/src/core/capture/start-notification.ts
index 1e59db2..e945b47 100644
--- a/src/core/capture/start-notification.ts
+++ b/src/core/capture/start-notification.ts
@@ -1,22 +1,6 @@
const ANIMATION_DURATION_MS = 4000;
-
-const MASCOT_FILLED = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="20 50 160 120" width="200" height="150">
- <rect x="30" y="95" width="140" height="68" rx="5" fill="#451a03"/>
- <path d="M30 95 L30 80 Q30 60, 100 60 Q170 60, 170 80 L170 95 Z" fill="#572508"/>
- <rect x="30" y="93" width="140" height="3" fill="#FDE68A"/>
- <path d="M68 122 Q76 112 84 122" stroke="#FDE68A" stroke-width="5" fill="none" stroke-linecap="round"/>
- <path class="wink-eye" d="M116 122 Q124 112 132 122" stroke="#FDE68A" stroke-width="5" fill="none" stroke-linecap="round"/>
- <path d="M84 138 Q100 148 116 138" stroke="#FDE68A" stroke-width="3.5" fill="none" stroke-linecap="round"/>
-</svg>`;
-
-const MASCOT_GHOST = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="20 50 160 120" width="200" height="150">
- <rect x="30" y="95" width="140" height="68" rx="5" fill="#451a03"/>
- <path d="M30 95 L30 80 Q30 60, 100 60 Q170 60, 170 80 L170 95 Z" fill="#572508"/>
- <rect x="30" y="93" width="140" height="3" fill="#FDE68A"/>
- <path d="M68 122 Q76 112 84 122" stroke="#FDE68A" stroke-width="5" fill="none" stroke-linecap="round"/>
- <path d="M116 122 Q124 112 132 122" stroke="#FDE68A" stroke-width="5" fill="none" stroke-linecap="round"/>
- <path d="M84 138 Q100 148 116 138" stroke="#FDE68A" stroke-width="3.5" fill="none" stroke-linecap="round"/>
-</svg>`;
+const FILL_DURATION = '2s';
+const FILL_DELAY = '0.5s';
const STYLES = `
:host {
@@ -56,27 +40,9 @@ const STYLES = `
display: block;
}
- .ghost {
- position: absolute;
- inset: 0;
- opacity: 0.15;
- }
-
- .fill {
- position: absolute;
- inset: 0;
- clip-path: inset(100% 0 0 0);
- animation: fillUp 1.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.8s forwards;
- }
-
- .fill .wink-eye {
+ .wink-eye {
transform-origin: 124px 117px;
- animation: wink 0.45s ease 2.5s;
- }
-
- @keyframes fillUp {
- 0% { clip-path: inset(100% 0 0 0); }
- 100% { clip-path: inset(0 0 0 0); }
+ animation: wink 0.45s ease 2.8s;
}
@keyframes bounceSquash {
@@ -97,6 +63,35 @@ const STYLES = `
}
`;
+function buildMascotSVG(): string {
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="20 50 160 120" width="200" height="150">
+ <defs>
+ <mask id="riseMask">
+ <rect x="20" y="50" width="160" height="120" fill="black"/>
+ <rect x="20" y="170" width="160" height="120" fill="white">
+ <animate attributeName="y" from="170" to="50" dur="${FILL_DURATION}" begin="${FILL_DELAY}" fill="freeze" calcMode="spline" keySplines="0.22 0.61 0.36 1"/>
+ </rect>
+ </mask>
+ </defs>
+ <g opacity="0.3">
+ <rect x="30" y="95" width="140" height="68" rx="5" fill="#3d2a14"/>
+ <path d="M30 95 L30 80 Q30 60, 100 60 Q170 60, 170 80 L170 95 Z" fill="#3d2a14"/>
+ <rect x="30" y="93" width="140" height="3" fill="#6b5630"/>
+ <path d="M68 122 Q76 112 84 122" stroke="#6b5630" stroke-width="5" fill="none" stroke-linecap="round"/>
+ <path d="M116 122 Q124 112 132 122" stroke="#6b5630" stroke-width="5" fill="none" stroke-linecap="round"/>
+ <path d="M84 138 Q100 148 116 138" stroke="#6b5630" stroke-width="3.5" fill="none" stroke-linecap="round"/>
+ </g>
+ <g mask="url(#riseMask)">
+ <rect x="30" y="95" width="140" height="68" rx="5" fill="#451a03"/>
+ <path d="M30 95 L30 80 Q30 60, 100 60 Q170 60, 170 80 L170 95 Z" fill="#572508"/>
+ <rect x="30" y="93" width="140" height="3" fill="#FDE68A"/>
+ <path d="M68 122 Q76 112 84 122" stroke="#FDE68A" stroke-width="5" fill="none" stroke-linecap="round"/>
+ <path class="wink-eye" d="M116 122 Q124 112 132 122" stroke="#FDE68A" stroke-width="5" fill="none" stroke-linecap="round"/>
+ <path d="M84 138 Q100 148 116 138" stroke="#FDE68A" stroke-width="3.5" fill="none" stroke-linecap="round"/>
+ </g>
+ </svg>`;
+}
+
export function showStartNotification(): Promise<void> {
return new Promise((resolve) => {
const host = document.createElement('mimik-notification');
@@ -112,17 +107,8 @@ export function showStartNotification(): Promise<void> {
const mascotWrap = document.createElement('div');
mascotWrap.className = 'mascot-wrap';
+ mascotWrap.innerHTML = buildMascotSVG();
- const ghost = document.createElement('div');
- ghost.className = 'ghost';
- ghost.innerHTML = MASCOT_GHOST;
-
- const fill = document.createElement('div');
- fill.className = 'fill';
- fill.innerHTML = MASCOT_FILLED;
-
- mascotWrap.appendChild(ghost);
- mascotWrap.appendChild(fill);
wrap.appendChild(mascotWrap);
shadow.appendChild(wrap);
document.documentElement.appendChild(host);
diff --git a/src/ui/shared/EmptyGuideState.tsx b/src/ui/shared/EmptyGuideState.tsx
new file mode 100644
index 0000000..daa0784
--- /dev/null
+++ b/src/ui/shared/EmptyGuideState.tsx
@@ -0,0 +1,29 @@
+export default function EmptyGuideState() {
+ return (
+ <div className="flex flex-col items-center justify-center flex-1 min-h-[300px]">
+ <div className="relative">
+ <svg width="72" height="54" viewBox="20 50 160 120" className="block">
+ <rect x="30" y="95" width="140" height="68" rx="5" className="fill-primary" />
+ <path d="M30 95 L30 80 Q30 60, 100 60 Q170 60, 170 80 L170 95 Z" className="fill-brown-dark" />
+ <rect x="30" y="93" width="140" height="3" className="fill-gold" />
+ <line x1="66" y1="120" x2="86" y2="120" className="stroke-gold" strokeWidth="4" strokeLinecap="round" />
+ <line x1="114" y1="120" x2="134" y2="120" className="stroke-gold" strokeWidth="4" strokeLinecap="round" />
+ <path
+ d="M88 140 Q100 145 112 140"
+ className="stroke-gold"
+ strokeWidth="3"
+ fill="none"
+ strokeLinecap="round"
+ />
+ </svg>
+ <div className="absolute -top-2 -right-3 flex gap-0.5 text-muted-foreground/40">
+ <span className="text-sm animate-pulse">z</span>
+ <span className="text-xs animate-pulse [animation-delay:400ms]">z</span>
+ <span className="text-[10px] animate-pulse [animation-delay:800ms]">z</span>
+ </div>
+ </div>
+ <p className="text-sm font-medium text-foreground mt-5">This guide is empty</p>
+ <p className="text-xs text-muted-foreground mt-1">Wake it up by recording some steps</p>
+ </div>
+ );
+}
diff --git a/src/ui/shared/SettingsView.tsx b/src/ui/shared/SettingsView.tsx
index 4b3b99d..9336e93 100644
--- a/src/ui/shared/SettingsView.tsx
+++ b/src/ui/shared/SettingsView.tsx
@@ -1,4 +1,4 @@
-import { ArrowLeft, Shield } from 'lucide-react';
+import { ArrowLeft, Check, Shield } from 'lucide-react';
import { useEffect, useState } from 'react';
import { AI_PROVIDERS, type AIProviderKey } from '@/core/capture/ai/models';
import { localStorage } from '@/lib/browser-api';
@@ -38,7 +38,7 @@ export default function SettingsView({ onBack }: SettingsViewProps) {
const providerConfig = AI_PROVIDERS[provider];
return (
- <div className="min-h-screen bg-card flex flex-col">
+ <div className="bg-card flex flex-col">
{/* Header */}
<div className="flex items-center gap-3 px-4 py-3 border-b border-border">
{onBack && (
@@ -96,8 +96,14 @@ export default function SettingsView({ onBack }: SettingsViewProps) {
</div>
{/* Save */}
- <Button onClick={handleSave} className="w-full">
- {saved ? 'Saved!' : 'Save Settings'}
+ <Button
+ onClick={handleSave}
+ disabled={saved}
+ className="w-full transition-all duration-300"
+ style={saved ? { backgroundColor: '#2d5a27', color: '#d4edda', opacity: 0.9 } : undefined}
+ >
+ {saved && <Check size={16} />}
+ {saved ? 'Saved' : 'Save Settings'}
</Button>
{/* Privacy note */}
diff --git a/src/ui/sidepanel/GuideEditor.tsx b/src/ui/sidepanel/GuideEditor.tsx
index 8320b29..ab4f378 100644
--- a/src/ui/sidepanel/GuideEditor.tsx
+++ b/src/ui/sidepanel/GuideEditor.tsx
@@ -12,6 +12,7 @@ import type { Guide, Screenshot, Step } from '@/core/guides/types';
import { createTab, focusWindow, getExtensionURL, queryTabs, updateTab } from '@/lib/browser-api';
import { getFaviconUrl, getMostCommonDomain } from '@/lib/utils';
import { Input } from '@/ui/components/ui/input';
+import EmptyGuideState from '@/ui/shared/EmptyGuideState';
import BlurCanvas from './BlurCanvas';
import ExportMenu from './ExportMenu';
import StepCard from './StepCard';
@@ -116,7 +117,7 @@ export default function GuideEditor({ guideId, onBack }: GuideEditorProps) {
const blurScreenshot = blurringStepId ? data.screenshots.get(blurringStepId) : undefined;
return (
- <div className="min-h-screen bg-card">
+ <div className="min-h-screen bg-card flex flex-col">
{blurringStepId && blurScreenshot && (
<BlurCanvas screenshot={blurScreenshot} onSave={handleBlurSave} onCancel={() => setBlurringStepId(null)} />
)}
@@ -181,9 +182,9 @@ export default function GuideEditor({ guideId, onBack }: GuideEditorProps) {
})()}
</div>
</div>
- <div className="px-4 pt-1 pb-4">
+ <div className="px-4 pt-1 pb-4 flex-1 flex flex-col">
{data.steps.length === 0 ? (
- <p className="text-sm text-warm">No steps in this guide.</p>
+ <EmptyGuideState />
) : (
data.steps.map((step, idx) => (
<div key={step.id}>
diff --git a/src/ui/sidepanel/LibraryView.tsx b/src/ui/sidepanel/LibraryView.tsx
index b304ae8..b2e7173 100644
--- a/src/ui/sidepanel/LibraryView.tsx
+++ b/src/ui/sidepanel/LibraryView.tsx
@@ -2,14 +2,14 @@ import { FileText, Star, Trash2 } from 'lucide-react';
import { useCallback, useEffect, useState } from 'react';
import {
type GuideChangeEvent,
- getFirstStepUrl,
+ getGuideDomain,
getGuides,
onGuidesChanged,
softDeleteGuide,
toggleStar,
} from '@/core/guides/service';
import type { Guide } from '@/core/guides/types';
-import { extractDomain, formatRelativeTime, getFaviconUrl } from '@/lib/utils';
+import { formatRelativeTime, getFaviconUrl } from '@/lib/utils';
interface LibraryViewProps {
onOpen: (guideId: string) => void;
@@ -33,11 +33,11 @@ export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewPro
const result = await getGuides();
const withMeta: GuideWithMeta[] = await Promise.all(
result.map(async (guide) => {
- const url = await getFirstStepUrl(guide.id);
+ const domain = await getGuideDomain(guide.id);
return {
...guide,
- favicon: url ? getFaviconUrl(url) : '',
- domain: url ? extractDomain(url) : '',
+ favicon: domain ? getFaviconUrl(domain) : '',
+ domain,
};
}),
);
diff --git a/src/ui/sidepanel/ZoomScreenshot.tsx b/src/ui/sidepanel/ZoomScreenshot.tsx
index b4fe81c..0263260 100644
--- a/src/ui/sidepanel/ZoomScreenshot.tsx
+++ b/src/ui/sidepanel/ZoomScreenshot.tsx
@@ -60,8 +60,8 @@ async function renderScreenshot(
const bh = bounds.height * dpr;
fullCtx.strokeStyle = '#F59E0B';
- fullCtx.lineWidth = 6;
- fullCtx.setLineDash([12, 6]);
+ fullCtx.lineWidth = 3.5;
+ fullCtx.setLineDash([8, 5]);
drawRoundedRect(fullCtx, bx, by, bw, bh, 12);
fullCtx.setLineDash([]);
@@ -101,8 +101,8 @@ async function renderScreenshot(
const scaleX = imgW / visW;
const scaleY = imgH / visH;
cropCtx.strokeStyle = '#F59E0B';
- cropCtx.lineWidth = 6;
- cropCtx.setLineDash([12, 6]);
+ cropCtx.lineWidth = 3.5;
+ cropCtx.setLineDash([8, 5]);
drawRoundedRect(cropCtx, (bx - cropX) * scaleX, (by - cropY) * scaleY, bw * scaleX, bh * scaleY, 12);
cropCtx.setLineDash([]);