π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
refactor: replace hardcoded colors with theme tokens and deduplicate utils
Luis Ortiz2e4bde9d1bb1
diff --git a/src/lib/utils.ts b/src/lib/utils.tsindex 9ad0df4..1b0905f 100644--- a/src/lib/utils.ts+++ b/src/lib/utils.ts@@ -1,6 +1,30 @@import { type ClassValue, clsx } from 'clsx';import { twMerge } from 'tailwind-merge';+import dayjs from 'dayjs';+import relativeTime from 'dayjs/plugin/relativeTime';++dayjs.extend(relativeTime);export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs));}++export function formatDate(ts: number): string {+ return dayjs(ts).format('MMM D, YYYY');+}++export function formatDateShort(ts: number): string {+ return dayjs(ts).format('MMM D');+}++export function formatRelativeTime(ts: number): string {+ return dayjs(ts).fromNow();+}++export function extractDomain(url: string): string {+ try { return new URL(url).hostname.replace(/^www\./, ''); } catch { return ''; }+}++export function getFaviconUrl(url: string): string {+ try { return `https://www.google.com/s2/favicons?domain=${new URL(url).hostname}&sz=32`; } catch { return ''; }+}diff --git a/src/ui/options/App.tsx b/src/ui/options/App.tsxindex 74bb639..4e2f305 100644--- a/src/ui/options/App.tsx+++ b/src/ui/options/App.tsx@@ -1,5 +1,7 @@import { useState, useEffect } from 'react';import { localStorage } from '@/lib/browser-api';+import { Button } from '@/ui/components/ui/button';+import { Input } from '@/ui/components/ui/input';export default function App() {const [apiKey, setApiKey] = useState('');@@ -21,18 +23,18 @@ export default function App() {return (<div className="p-6 max-w-md mx-auto">- <h1 className="text-lg font-bold text-gray-900 mb-4">Mimik Settings</h1>+ <h1 className="text-lg font-bold text-foreground mb-4">Mimik Settings</h1><div className="space-y-4"><div>- <label htmlFor="provider" className="block text-sm font-medium text-gray-700 mb-1">+ <label htmlFor="provider" className="block text-sm font-medium text-foreground mb-1">AI Provider</label><selectid="provider"value={provider}onChange={(e) => setProvider(e.target.value as 'openai' | 'anthropic')}- className="w-full border border-gray-300 rounded-md px-3 py-2 text-sm"+ className="w-full border border-border rounded-md px-3 py-2 text-sm text-foreground bg-card"><option value="openai">OpenAI</option><option value="anthropic">Anthropic</option>@@ -40,28 +42,24 @@ export default function App() {</div><div>- <label htmlFor="apiKey" className="block text-sm font-medium text-gray-700 mb-1">+ <label htmlFor="apiKey" className="block text-sm font-medium text-foreground mb-1">API Key</label>- <input+ <Inputid="apiKey"type="password"value={apiKey}onChange={(e) => setApiKey(e.target.value)}placeholder="sk-..."- className="w-full border border-gray-300 rounded-md px-3 py-2 text-sm"/>- <p className="mt-1 text-xs text-gray-500">+ <p className="mt-1 text-xs text-muted-foreground">Your key is stored locally and never sent to any server except the AI provider.</p></div>- <button- onClick={handleSave}- className="w-full py-2 px-4 bg-amber-600 text-white rounded-md font-medium hover:bg-amber-700 transition-colors text-sm"- >+ <Button onClick={handleSave} className="w-full">{saved ? 'Saved!' : 'Save Settings'}- </button>+ </Button></div></div>);diff --git a/src/ui/sidepanel/App.tsx b/src/ui/sidepanel/App.tsxindex c9a16e6..f9cc40c 100644--- a/src/ui/sidepanel/App.tsx+++ b/src/ui/sidepanel/App.tsx@@ -5,6 +5,8 @@ import { sendMessage } from '@/lib/messaging';import { getActiveTab, getExtensionURL, queryTabs, updateTab, focusWindow, createTab } from '@/lib/browser-api';import { connectToBackground } from '@/lib/port';import { CaptureState } from '@/core/capture/machine';+import { Button } from '@/ui/components/ui/button';+import { Input } from '@/ui/components/ui/input';import LibraryView from './LibraryView';import GuideEditor from './GuideEditor';import RecordingView from './RecordingView';@@ -21,18 +23,18 @@ function MascotIcon({ size = 44 }: { size?: number }) {<clipPath id="cc"><circle cx="100" cy="100" r="95"/></clipPath></defs><g clipPath="url(#cc)">- <rect x="-50" y="-50" width="300" height="300" fill="#FDE68A"/>- <rect x="30" y="-80" width="50" height="400" fill="#F59E0B" transform="rotate(45, 100, 100)" opacity="0.15"/>+ <rect x="-50" y="-50" width="300" height="300" className="fill-gold" />+ <rect x="30" y="-80" width="50" height="400" className="fill-accent" transform="rotate(45, 100, 100)" opacity="0.15"/><rect x="90" y="-80" width="50" height="400" fill="#D97706" transform="rotate(45, 100, 100)" opacity="0.12"/><rect x="-30" y="-80" width="50" height="400" fill="#FCD34D" transform="rotate(45, 100, 100)" opacity="0.15"/>- <rect x="150" y="-80" width="50" height="400" fill="#FBBF24" transform="rotate(45, 100, 100)" opacity="0.1"/>+ <rect x="150" y="-80" width="50" height="400" className="fill-amber-light" transform="rotate(45, 100, 100)" opacity="0.1"/></g>- <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" strokeWidth="5" fill="none" strokeLinecap="round"/>- <path d="M116 122 Q124 112 132 122" stroke="#FDE68A" strokeWidth="5" fill="none" strokeLinecap="round"/>- <path d="M84 138 Q100 148 116 138" stroke="#FDE68A" strokeWidth="3.5" fill="none" strokeLinecap="round"/>+ <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" />+ <path d="M68 122 Q76 112 84 122" className="stroke-gold" strokeWidth="5" fill="none" strokeLinecap="round"/>+ <path d="M116 122 Q124 112 132 122" className="stroke-gold" strokeWidth="5" fill="none" strokeLinecap="round"/>+ <path d="M84 138 Q100 148 116 138" className="stroke-gold" strokeWidth="3.5" fill="none" strokeLinecap="round"/></svg>);}@@ -97,80 +99,59 @@ export default function App() {}, []);if (view.name === 'recording') {- return (- <RecordingView- guideId={view.guideId}- onStop={handleStopRecording}- />- );+ return <RecordingView guideId={view.guideId} onStop={handleStopRecording} />;}if (view.name === 'editor') {- return (- <GuideEditor- guideId={view.guideId}- onBack={() => setView({ name: 'library' })}- />- );+ return <GuideEditor guideId={view.guideId} onBack={() => setView({ name: 'library' })} />;}return (- <div className="min-h-screen bg-white flex flex-col">+ <div className="min-h-screen bg-card flex flex-col">{/* Header */}- <div className="relative overflow-hidden px-6 pt-6 pb-7" style={{ background: 'linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%)' }}>- {/* Glow accent */}- <div className="absolute -top-12 -right-8 w-44 h-44 rounded-full opacity-15 blur-[40px]" style={{ background: 'linear-gradient(135deg, #FDE68A, #fff)' }} />+ <div className="relative overflow-hidden px-6 pt-6 pb-7 bg-gradient-to-br from-amber to-amber-light">+ <div className="absolute -top-12 -right-8 w-44 h-44 rounded-full opacity-15 blur-[40px] bg-gradient-to-br from-gold to-white" />- {/* Top bar */}<div className="relative flex items-center justify-between mb-6">- <span className="text-[17px] font-bold tracking-tight" style={{ color: '#451a03' }}>Mimik</span>- <span className={`text-[10px] font-medium px-2.5 py-0.5 rounded-full ${isAlive ? 'text-amber-900 bg-white/30' : 'text-amber-700/50 bg-white/15'}`}>+ <span className="text-[17px] font-bold tracking-tight text-foreground">Mimik</span>+ <span className={`text-[10px] font-medium px-2.5 py-0.5 rounded-full ${isAlive ? 'text-foreground bg-white/30' : 'text-brown/50 bg-white/15'}`}>{isAlive ? 'Connected' : 'Connecting...'}</span></div>- {/* Mascot + message */}<div className="relative text-center mb-5"><div className="flex justify-center mb-2"><MascotIcon size={44} /></div>- <h3 className="text-base font-medium" style={{ color: '#451a03' }}>What would you like to capture?</h3>- <p className="text-xs mt-1" style={{ color: '#92400E' }}>Record any workflow automatically</p>+ <h3 className="text-base font-medium text-foreground">What would you like to capture?</h3>+ <p className="text-xs mt-1 text-amber-dark">Record any workflow automatically</p></div>- {/* Start Capture button */}- <button+ <ButtononClick={handleStartRecording}disabled={!isAlive}- className="relative w-full py-3 px-4 rounded-lg font-semibold text-sm transition-all disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center gap-2 hover:-translate-y-px"- style={{ background: '#451a03', color: '#FDE68A', boxShadow: '0 4px 12px rgba(69,26,3,0.3)' }}+ className="w-full py-3 px-4 h-auto rounded-lg font-semibold text-sm hover:-translate-y-px shadow-lg"><Video size={18} />Start Capture- </button>+ </Button></div>- {/* Body β white section */}+ {/* Body */}<div className="flex-1 px-5 pt-5">- {/* Search bar */}<div className="relative mb-5">- <Search size={15} className="absolute left-3.5 top-1/2 -translate-y-1/2" style={{ color: '#B5A48B' }} />- <input+ <Search size={15} className="absolute left-3.5 top-1/2 -translate-y-1/2 text-warm" />+ <Inputtype="text"placeholder="Search guides..."value={search}onChange={(e) => setSearch(e.target.value)}- className="w-full pl-10 pr-3 py-2.5 text-sm rounded-lg outline-none transition-colors"- style={{ border: '1px solid #E8E2DA', color: '#451a03', background: '#fff' }}- onFocus={(e) => { e.target.style.borderColor = '#F59E0B'; }}- onBlur={(e) => { e.target.style.borderColor = '#E8E2DA'; }}+ className="w-full pl-10 pr-3"/></div>- {/* Recent section label */}- <p className="text-[11px] font-semibold uppercase tracking-wider mb-2.5" style={{ color: '#92400E' }}>Recent</p>+ <p className="text-[11px] font-semibold uppercase tracking-wider mb-2.5 text-muted-foreground">Recent</p>- {/* Guide list */}<LibraryViewonOpen={(guideId) => setView({ name: 'editor', guideId })}isAlive={isAlive}diff --git a/src/ui/sidepanel/ExportMenu.tsx b/src/ui/sidepanel/ExportMenu.tsxindex ff5b6da..a7b3b0c 100644--- a/src/ui/sidepanel/ExportMenu.tsx+++ b/src/ui/sidepanel/ExportMenu.tsx@@ -4,6 +4,7 @@ import type { Guide, Step, Screenshot } from '@/core/guides/types';import { exportGuideAsHTML } from '@/core/export/html-export';import { exportGuideAsMarkdown } from '@/core/export/markdown-export';import { exportGuideAsPDF } from '@/core/export/pdf-export';+import { Button } from '@/ui/components/ui/button';interface ExportMenuProps {guideId: string;@@ -29,96 +30,65 @@ export default function ExportMenu({ guide, steps, screenshots }: ExportMenuPropuseEffect(() => {function handleClickOutside(e: MouseEvent) {- if (menuRef.current && !menuRef.current.contains(e.target as Node)) {- setOpen(false);- }- }- if (open) {- document.addEventListener('mousedown', handleClickOutside);+ if (menuRef.current && !menuRef.current.contains(e.target as Node)) setOpen(false);}- return () => {- document.removeEventListener('mousedown', handleClickOutside);- };+ if (open) document.addEventListener('mousedown', handleClickOutside);+ return () => document.removeEventListener('mousedown', handleClickOutside);}, [open]);- async function handleExportHTML() {- setOpen(false);- setExporting(true);- try {- const html = await exportGuideAsHTML(guide, steps, screenshots);- downloadFile(html, `${guide.title}.html`, 'text/html');- } finally {- setExporting(false);- }- }-- async function handleExportMarkdown() {+ async function handleExport(type: 'html' | 'markdown' | 'pdf') {setOpen(false);setExporting(true);try {- const md = await exportGuideAsMarkdown(guide, steps, screenshots);- downloadFile(md, `${guide.title}.md`, 'text/markdown');+ if (type === 'html') {+ const html = await exportGuideAsHTML(guide, steps, screenshots);+ downloadFile(html, `${guide.title}.html`, 'text/html');+ } else if (type === 'markdown') {+ const md = await exportGuideAsMarkdown(guide, steps, screenshots);+ downloadFile(md, `${guide.title}.md`, 'text/markdown');+ } else {+ const blob = await exportGuideAsPDF(guide, steps, screenshots);+ const url = URL.createObjectURL(blob);+ const a = document.createElement('a');+ a.href = url;+ a.download = `${guide.title}.pdf`;+ a.click();+ URL.revokeObjectURL(url);+ }} finally {setExporting(false);}}- async function handleExportPDF() {- setOpen(false);- setExporting(true);- try {- const blob = await exportGuideAsPDF(guide, steps, screenshots);- const url = URL.createObjectURL(blob);- const a = document.createElement('a');- a.href = url;- a.download = `${guide.title}.pdf`;- a.click();- URL.revokeObjectURL(url);- } finally {- setExporting(false);- }- }+ const items = [+ { type: 'html' as const, icon: FileCode, label: 'HTML' },+ { type: 'markdown' as const, icon: FileText, label: 'Markdown' },+ { type: 'pdf' as const, icon: FileDown, label: 'PDF' },+ ];return (<div ref={menuRef} className="relative">- <button- className="flex items-center gap-1 px-3 py-1.5 text-sm rounded-lg disabled:opacity-50 disabled:cursor-not-allowed"- style={{ background: '#451a03', color: '#FDE68A' }}+ <Button+ size="sm"onClick={() => setOpen(prev => !prev)}disabled={exporting}- title="Export guide">- {exporting ? (- <Loader2 size={14} className="animate-spin" />- ) : (- <Download size={14} />- )}+ {exporting ? <Loader2 size={14} className="animate-spin" /> : <Download size={14} />}Export- </button>+ </Button>{open && !exporting && (- <div className="absolute right-0 mt-1 w-40 bg-white border border-gray-200 rounded-lg shadow-lg py-1 z-10">- <button- className="flex items-center gap-2 w-full px-3 py-2 text-sm text-gray-700 hover:bg-gray-50"- onClick={handleExportHTML}- >- <FileCode size={14} />- HTML- </button>- <button- className="flex items-center gap-2 w-full px-3 py-2 text-sm text-gray-700 hover:bg-gray-50"- onClick={handleExportMarkdown}- >- <FileText size={14} />- Markdown- </button>- <button- className="flex items-center gap-2 w-full px-3 py-2 text-sm text-gray-700 hover:bg-gray-50"- onClick={handleExportPDF}- >- <FileDown size={14} />- </button>+ <div className="absolute right-0 mt-1 w-40 bg-card border border-border rounded-lg shadow-lg py-1 z-10">+ {items.map((item) => (+ <button+ key={item.type}+ className="flex items-center gap-2 w-full px-3 py-2 text-sm text-foreground hover:bg-secondary"+ onClick={() => handleExport(item.type)}+ >+ <item.icon size={14} />+ {item.label}+ </button>+ ))}</div>)}</div>diff --git a/src/ui/sidepanel/GuideEditor.tsx b/src/ui/sidepanel/GuideEditor.tsxindex 26da08f..2f5b14b 100644--- a/src/ui/sidepanel/GuideEditor.tsx+++ b/src/ui/sidepanel/GuideEditor.tsx@@ -3,6 +3,7 @@ import { ArrowLeft, Maximize2, Layers } from 'lucide-react';import { getExtensionURL, queryTabs, updateTab, focusWindow, createTab } from '@/lib/browser-api';import { getGuide, updateGuideTitle, updateStepDescription, deleteStep, reorderSteps, updateScreenshotBlob } from '@/core/guides/service';import type { Guide, Step, Screenshot } from '@/core/guides/types';+import { Input } from '@/ui/components/ui/input';import StepCard from './StepCard';import BlurCanvas from './BlurCanvas';import ExportMenu from './ExportMenu';@@ -39,9 +40,7 @@ export default function GuideEditor({ guideId, onBack }: GuideEditorProps) {setLoading(false);}, [guideId]);- useEffect(() => {- loadGuide();- }, [loadGuide]);+ useEffect(() => { loadGuide(); }, [loadGuide]);const handleTitleBlur = useCallback(async () => {if (!data || title === data.guide.title) return;@@ -53,10 +52,7 @@ export default function GuideEditor({ guideId, onBack }: GuideEditorProps) {await updateStepDescription(stepId, description);setData(prev => {if (!prev) return prev;- return {- ...prev,- steps: prev.steps.map(s => s.id === stepId ? { ...s, description } : s),- };+ return { ...prev, steps: prev.steps.map(s => s.id === stepId ? { ...s, description } : s) };});}, []);@@ -87,18 +83,16 @@ export default function GuideEditor({ guideId, onBack }: GuideEditorProps) {setBlurringStepId(null);}, [blurringStepId, data]);- if (loading) {- return <p className="text-sm text-gray-500 p-4">Loading...</p>;- }+ if (loading) return <p className="text-sm text-warm p-4">Loading...</p>;if (notFound || !data) {return (<div className="p-4">- <button onClick={onBack} className="flex items-center gap-1 text-sm text-gray-500 hover:text-gray-700 mb-4">+ <button onClick={onBack} className="flex items-center gap-1 text-sm text-warm hover:text-foreground mb-4"><ArrowLeft size={18} />Back</button>- <p className="text-sm text-red-500">Guide not found</p>+ <p className="text-sm text-destructive">Guide not found</p></div>);}@@ -106,32 +100,20 @@ export default function GuideEditor({ guideId, onBack }: GuideEditorProps) {const blurScreenshot = blurringStepId ? data.screenshots.get(blurringStepId) : undefined;return (- <div className="min-h-screen bg-white">+ <div className="min-h-screen bg-card">{blurringStepId && blurScreenshot && (- <BlurCanvas- screenshot={blurScreenshot}- onSave={handleBlurSave}- onCancel={() => setBlurringStepId(null)}- />+ <BlurCanvas screenshot={blurScreenshot} onSave={handleBlurSave} onCancel={() => setBlurringStepId(null)} />)}<div className="px-4 pt-3 pb-2"><div className="flex items-center gap-2">- <button- onClick={onBack}- className="flex-shrink-0 p-1 rounded"- style={{ color: '#9ca3af' }}- title="Back to library"- >+ <button onClick={onBack} className="shrink-0 p-1 rounded text-warm hover:text-foreground" title="Back to library"><ArrowLeft size={18} /></button>- <input- className="text-lg font-bold bg-transparent border-b border-transparent hover:border-gray-300 focus:outline-none w-full"- style={{ color: '#451a03' }}+ <Inputvalue={title}onChange={(e) => setTitle(e.target.value)}onBlur={handleTitleBlur}- onFocus={(e) => { e.target.style.borderColor = '#F59E0B'; }}- onBlurCapture={(e) => { e.target.style.borderColor = 'transparent'; }}+ className="text-lg font-bold bg-transparent border-0 border-b border-transparent hover:border-border focus-visible:ring-0 focus-visible:border-accent shadow-none p-0 h-auto text-foreground"/><buttononClick={() => {@@ -145,36 +127,28 @@ export default function GuideEditor({ guideId, onBack }: GuideEditorProps) {}});}}- className="flex-shrink-0 p-1.5 rounded-md transition-colors hover:bg-amber-50"- style={{ color: '#9ca3af' }}- onMouseEnter={(e) => { e.currentTarget.style.color = '#F59E0B'; }}- onMouseLeave={(e) => { e.currentTarget.style.color = '#9ca3af'; }}+ className="shrink-0 p-1.5 rounded-md transition-colors text-warm hover:text-accent hover:bg-secondary"title="Open in full view"><Maximize2 size={15} /></button>- <div className="ml-auto flex-shrink-0">- <ExportMenu- guideId={guideId}- guide={data.guide}- steps={data.steps}- screenshots={data.screenshots}- />+ <div className="ml-auto shrink-0">+ <ExportMenu guideId={guideId} guide={data.guide} steps={data.steps} screenshots={data.screenshots} /></div></div>- <p className="text-[11px] flex items-center gap-1" style={{ color: '#92400E', marginLeft: '34px' }}>+ <p className="text-[11px] flex items-center gap-1 text-muted-foreground" style={{ marginLeft: '34px' }}><Layers size={11} />{data.steps.length} step{data.steps.length !== 1 ? 's' : ''}</p></div><div className="px-4 pt-1 pb-4">{data.steps.length === 0 ? (- <p className="text-sm text-gray-500">No steps in this guide.</p>+ <p className="text-sm text-warm">No steps in this guide.</p>) : (data.steps.map((step, idx) => (<div key={step.id}>{dragOverIndex === idx && dragIndex !== null && dragIndex !== idx && (- <div className="h-1 bg-amber-500 rounded-full mx-4 mb-1" />+ <div className="h-1 bg-accent rounded-full mx-4 mb-1" />)}<StepCardstep={step}@@ -183,14 +157,8 @@ export default function GuideEditor({ guideId, onBack }: GuideEditorProps) {onDelete={handleDeleteStep}onBlur={(stepId) => setBlurringStepId(stepId)}dragHandleProps={{- onDragStart: (e: React.DragEvent) => {- setDragIndex(idx);- e.dataTransfer.effectAllowed = 'move';- },- onDragOver: (e: React.DragEvent) => {- e.preventDefault();- setDragOverIndex(idx);- },+ onDragStart: (e: React.DragEvent) => { setDragIndex(idx); e.dataTransfer.effectAllowed = 'move'; },+ onDragOver: (e: React.DragEvent) => { e.preventDefault(); setDragOverIndex(idx); },onDragEnd: () => {if (dragIndex !== null && dragOverIndex !== null && dragIndex !== dragOverIndex) {setData(prev => {diff --git a/src/ui/sidepanel/LibraryView.tsx b/src/ui/sidepanel/LibraryView.tsxindex 8f0907d..6a5bd2b 100644--- a/src/ui/sidepanel/LibraryView.tsx+++ b/src/ui/sidepanel/LibraryView.tsx@@ -2,36 +2,7 @@ import { useState, useEffect, useCallback } from 'react';import { Trash2, FileText, Star } from 'lucide-react';import { getGuides, softDeleteGuide, toggleStar, getFirstStepUrl } from '@/core/guides/service';import type { Guide } from '@/core/guides/types';--function formatRelativeTime(timestamp: number): string {- const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });- const diffMs = timestamp - Date.now();- const diffSec = Math.round(diffMs / 1000);- const diffMin = Math.round(diffMs / (1000 * 60));- const diffHour = Math.round(diffMs / (1000 * 60 * 60));- const diffDay = Math.round(diffMs / (1000 * 60 * 60 * 24));-- if (Math.abs(diffSec) < 60) return rtf.format(diffSec, 'second');- if (Math.abs(diffMin) < 60) return rtf.format(diffMin, 'minute');- if (Math.abs(diffHour) < 24) return rtf.format(diffHour, 'hour');- return rtf.format(diffDay, 'day');-}--function getFaviconUrl(url: string): string {- try {- return `https://www.google.com/s2/favicons?domain=${new URL(url).hostname}&sz=32`;- } catch {- return '';- }-}--function extractDomain(url: string): string {- try {- return new URL(url).hostname.replace(/^www\./, '');- } catch {- return '';- }-}+import { getFaviconUrl, extractDomain, formatRelativeTime } from '@/lib/utils';interface LibraryViewProps {onOpen: (guideId: string) => void;@@ -69,9 +40,7 @@ export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewPro}}, []);- useEffect(() => {- loadGuides();- }, [loadGuides]);+ useEffect(() => { loadGuides(); }, [loadGuides]);const handleStar = useCallback(async (e: React.MouseEvent, guideId: string) => {e.stopPropagation();@@ -90,17 +59,17 @@ export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewPro: guides;if (loading) {- return <p className="text-sm py-4" style={{ color: '#B5A48B' }}>Loading...</p>;+ return <p className="text-sm py-4 text-warm">Loading...</p>;}if (guides.length === 0) {return (<div className="py-10 text-center">- <div className="w-12 h-12 rounded-lg flex items-center justify-center mx-auto mb-3" style={{ background: '#FDE68A', border: '1px solid #FBBF24' }}>- <FileText size={20} style={{ color: '#92400E' }} />+ <div className="w-12 h-12 rounded-lg flex items-center justify-center mx-auto mb-3 bg-gold border border-amber-light">+ <FileText size={20} className="text-muted-foreground" /></div>- <p className="text-sm font-medium" style={{ color: '#451a03' }}>No guides yet</p>- <p className="text-xs mt-1" style={{ color: '#B45309' }}>Start a capture to create your first guide</p>+ <p className="text-sm font-medium text-foreground">No guides yet</p>+ <p className="text-xs mt-1 text-warm">Start a capture to create your first guide</p></div>);}@@ -108,7 +77,7 @@ export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewProif (filtered.length === 0) {return (<div className="py-8 text-center">- <p className="text-sm" style={{ color: '#B5A48B' }}>No matching guides</p>+ <p className="text-sm text-warm">No matching guides</p></div>);}@@ -118,14 +87,10 @@ export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewPro{filtered.map((guide) => (<divkey={guide.id}- className="flex items-center gap-3 px-3.5 py-3 rounded-lg cursor-pointer group transition-all"- style={{ border: '1px solid #FDE68A' }}- onMouseEnter={(e) => { e.currentTarget.style.borderColor = '#F59E0B'; e.currentTarget.style.boxShadow = '0 2px 8px rgba(245,158,11,0.12)'; }}- onMouseLeave={(e) => { e.currentTarget.style.borderColor = '#FDE68A'; e.currentTarget.style.boxShadow = 'none'; }}+ className="flex items-center gap-3 px-3.5 py-3 rounded-lg cursor-pointer group transition-all border border-gold hover:border-accent hover:shadow-sm"onClick={() => onOpen(guide.id)}>- {/* Favicon */}- <div className="w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0 overflow-hidden text-xs font-semibold" style={{ background: '#FDE68A', border: '1px solid #FBBF24', color: '#78350F' }}>+ <div className="w-8 h-8 rounded-lg flex items-center justify-center shrink-0 overflow-hidden text-xs font-semibold bg-gold border border-amber-light text-brown">{guide.favicon ? (<imgsrc={guide.favicon}@@ -142,32 +107,24 @@ export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewPro)}</div>- {/* Text */}<div className="flex-1 min-w-0">- <p className="text-sm font-medium truncate" style={{ color: '#451a03' }}>{guide.title}</p>- <p className="text-xs mt-0.5" style={{ color: '#B45309' }}>+ <p className="text-sm font-medium truncate text-foreground">{guide.title}</p>+ <p className="text-xs mt-0.5 text-warm">{guide.stepIds.length} step{guide.stepIds.length !== 1 ? 's' : ''} · {formatRelativeTime(guide.updatedAt)}</p></div>- {/* Actions */}- <div className="flex items-center gap-0.5 ml-1 flex-shrink-0">+ <div className="flex items-center gap-0.5 ml-1 shrink-0"><buttononClick={(e) => handleStar(e, guide.id)}- className={`p-1.5 rounded-lg transition-all ${guide.starred ? 'opacity-100' : 'opacity-0 group-hover:opacity-100'}`}- style={{ color: guide.starred ? '#F59E0B' : '#D4BFA8' }}- onMouseEnter={(e) => { e.currentTarget.style.color = '#F59E0B'; }}- onMouseLeave={(e) => { e.currentTarget.style.color = guide.starred ? '#F59E0B' : '#D4BFA8'; }}+ className={`p-1.5 rounded-lg transition-all hover:text-accent ${guide.starred ? 'opacity-100 text-accent' : 'opacity-0 group-hover:opacity-100 text-border'}`}title={guide.starred ? 'Unstar' : 'Star'}><Star size={14} fill={guide.starred ? 'currentColor' : 'none'} /></button><buttononClick={(e) => handleDelete(e, guide.id)}- className="p-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-all"- style={{ color: '#D4BFA8' }}- onMouseEnter={(e) => { e.currentTarget.style.color = '#EF4444'; }}- onMouseLeave={(e) => { e.currentTarget.style.color = '#D4BFA8'; }}+ className="p-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-all text-border hover:text-red-500"title="Move to trash"><Trash2 size={14} />diff --git a/src/ui/sidepanel/RecordingView.tsx b/src/ui/sidepanel/RecordingView.tsxindex 2dfca71..84b8d0a 100644--- a/src/ui/sidepanel/RecordingView.tsx+++ b/src/ui/sidepanel/RecordingView.tsx@@ -3,6 +3,8 @@ import { Check, X } from 'lucide-react';import { getActiveTab } from '@/lib/browser-api';import { getStepsForGuide, getScreenshotsForSteps, deleteStep } from '@/core/guides/service';import type { Step, Screenshot } from '@/core/guides/types';+import { extractDomain } from '@/lib/utils';+import { Button } from '@/ui/components/ui/button';import ZoomScreenshot from './ZoomScreenshot';interface RecordingViewProps {@@ -10,14 +12,6 @@ interface RecordingViewProps {onStop: () => void;}-function extractDomain(url: string): string {- try {- return new URL(url).hostname.replace(/^www\./, '');- } catch {- return '';- }-}-function timeAgo(createdAt: number): string {const diff = Math.floor((Date.now() - createdAt) / 1000);if (diff < 3) return 'Just now';@@ -83,11 +77,11 @@ export default function RecordingView({ guideId, onStop }: RecordingViewProps) {const domain = extractDomain(siteUrl);return (- <div className="flex flex-col h-screen bg-white relative">+ <div className="flex flex-col h-screen bg-card relative">{/* Floating recording pill */}- <div className="absolute top-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-2 px-4 py-1.5 rounded-full bg-white/90 backdrop-blur-sm border shadow-sm" style={{ borderColor: '#E8E2DA' }}>+ <div className="absolute top-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-2 px-4 py-1.5 rounded-full bg-white/90 backdrop-blur-sm border border-border shadow-sm"><span className="w-2 h-2 rounded-full bg-red-500 animate-pulse" />- <span className="text-xs font-semibold" style={{ color: '#451a03' }}>+ <span className="text-xs font-semibold text-foreground">Recording Β· {steps.length} {steps.length === 1 ? 'step' : 'steps'}</span></div>@@ -96,14 +90,13 @@ export default function RecordingView({ guideId, onStop }: RecordingViewProps) {<div className="flex-1 overflow-y-auto pt-12">{steps.length === 0 ? (<div className="flex flex-col items-center justify-center h-full gap-1">- <span className="text-sm font-medium" style={{ color: '#9ca3af' }}>Ready to capture!</span>- <span className="text-xs" style={{ color: '#d1d5db' }}>Click on the page to start</span>+ <span className="text-sm font-medium text-warm">Ready to capture!</span>+ <span className="text-xs text-border">Click on the page to start</span></div>) : (<div>{steps.map((liveStep, idx) => (<div key={liveStep.step.id}>- {/* Post */}<div className="px-4 pb-4 group">{liveStep.screenshot && (<div className="mb-2">@@ -116,26 +109,24 @@ export default function RecordingView({ guideId, onStop }: RecordingViewProps) {)}<div className="flex items-start justify-between gap-2"><div>- <p className="text-[13px] font-medium leading-snug" style={{ color: '#451a03' }}>+ <p className="text-[13px] font-medium leading-snug text-foreground">{liveStep.step.description}</p>- <span className="text-[10px]" style={{ color: '#9ca3af' }}>+ <span className="text-[10px] text-warm">{timeAgo(liveStep.step.timestamp)} Β· {extractDomain(liveStep.step.url || siteUrl)}</span></div><buttononClick={() => handleDeleteStep(liveStep.step.id)}- className="opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded"- style={{ color: '#d1d5db' }}+ className="opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded text-border hover:text-red-500"title="Delete step"><X size={13} /></button></div></div>- {/* Divider */}{idx < steps.length - 1 && (- <div className="mx-4 mb-4" style={{ height: 1, background: '#E8E2DA' }} />+ <div className="mx-4 mb-4 h-px bg-border" />)}</div>))}@@ -145,19 +136,14 @@ export default function RecordingView({ guideId, onStop }: RecordingViewProps) {</div>{/* Bottom bar */}- <div className="flex-shrink-0 border-t px-4 py-2.5 flex items-center gap-2" style={{ borderColor: '#E8E2DA' }}>- <button- onClick={onStop}- className="flex-1 h-10 rounded-full font-semibold text-[13px] flex items-center justify-center gap-2 transition-colors"- style={{ background: '#451a03', color: '#FDE68A' }}- >+ <div className="shrink-0 border-t border-border px-4 py-2.5 flex items-center gap-2">+ <Button onClick={onStop} className="flex-1 h-10 rounded-full font-semibold text-[13px]"><Check size={16} strokeWidth={3} />Finish Recording- </button>+ </Button><buttononClick={onStop}- className="w-10 h-10 rounded-full border flex items-center justify-center transition-colors hover:border-red-300 hover:text-red-400"- style={{ borderColor: '#E8E2DA', color: '#9ca3af' }}+ className="w-10 h-10 rounded-full border border-border flex items-center justify-center transition-colors text-warm hover:border-red-300 hover:text-red-400"title="Discard"><X size={16} />diff --git a/src/ui/sidepanel/StepCard.tsx b/src/ui/sidepanel/StepCard.tsxindex 914a47e..955ee81 100644--- a/src/ui/sidepanel/StepCard.tsx+++ b/src/ui/sidepanel/StepCard.tsx@@ -1,6 +1,6 @@import { logger } from '@/lib/logger';import { useState, useEffect } from 'react';-import { Trash2, GripVertical, EyeOff, Copy, Check } from 'lucide-react';+import { Trash2, EyeOff, Copy, Check } from 'lucide-react';import type { Step, Screenshot } from '@/core/guides/types';import ZoomScreenshot from './ZoomScreenshot';@@ -21,42 +21,20 @@ interface StepCardProps {}export default function StepCard({- step,- screenshot,- onDescriptionChange,- onDelete,- dragHandleProps,- onBlur,+ step, screenshot, onDescriptionChange, onDelete, dragHandleProps, onBlur,}: StepCardProps) {const [description, setDescription] = useState(step.description);- const [objectUrl, setObjectUrl] = useState<string | null>(null);const [dragOver, setDragOver] = useState(false);const [copied, setCopied] = useState(false);- useEffect(() => {- if (screenshot?.blob) {- const url = URL.createObjectURL(screenshot.blob);- setObjectUrl(url);- return () => {- URL.revokeObjectURL(url);- };- }- }, [screenshot]);-- useEffect(() => {- setDescription(step.description);- }, [step.description]);+ useEffect(() => { setDescription(step.description); }, [step.description]);const handleDescriptionBlur = () => {- if (description !== step.description) {- onDescriptionChange(step.id, description);- }+ if (description !== step.description) onDescriptionChange(step.id, description);};const handleDelete = () => {- if (window.confirm('Delete this step?')) {- onDelete(step.id);- }+ if (window.confirm('Delete this step?')) onDelete(step.id);};const handleCopy = async () => {@@ -77,50 +55,30 @@ export default function StepCard({dragHandleProps?.onDragOver(e);};- const handleDragLeave = () => {- setDragOver(false);- };-- const handleDragEnd = () => {- setDragOver(false);- dragHandleProps?.onDragEnd();- };-return (<divdraggable={!!dragHandleProps}onDragStart={dragHandleProps?.onDragStart}onDragOver={handleDragOver}- onDragLeave={handleDragLeave}- onDragEnd={handleDragEnd}- className={`rounded-xl mb-3 overflow-hidden transition-shadow ${dragOver ? 'ring-2 ring-amber-500' : ''}`}- style={{ border: '1px solid #E8E2DA', background: '#fff' }}+ onDragLeave={() => setDragOver(false)}+ onDragEnd={() => { setDragOver(false); dragHandleProps?.onDragEnd(); }}+ className={`rounded-xl mb-3 overflow-hidden transition-shadow border border-border bg-card ${dragOver ? 'ring-2 ring-accent' : ''}`}>- {/* Screenshot */}{screenshot ? (- <ZoomScreenshot- screenshot={screenshot}- alt={`Step ${step.index + 1} screenshot`}- className="!rounded-none !border-0"- />+ <ZoomScreenshot screenshot={screenshot} alt={`Step ${step.index + 1} screenshot`} className="!rounded-none !border-0" />) : (- <div className="w-full h-32 flex items-center justify-center text-sm" style={{ background: '#f5f3ef', color: '#9ca3af' }}>+ <div className="w-full h-32 flex items-center justify-center text-sm bg-secondary text-warm">No screenshot</div>)}- {/* Body */}<div className="px-3 pt-2 pb-2"><div className="flex items-center gap-2">- <span- className="flex items-center justify-center w-[22px] h-[22px] rounded-full text-[11px] font-bold flex-shrink-0"- style={{ background: '#451a03', color: '#FDE68A' }}- >+ <span className="flex items-center justify-center w-[22px] h-[22px] rounded-full text-[11px] font-bold shrink-0 bg-primary text-primary-foreground">{step.index + 1}</span><textarea- className="w-full text-[13px] font-medium resize-none outline-none border-0 bg-transparent p-0 leading-snug flex-1"- style={{ color: '#451a03' }}+ className="w-full text-[13px] font-medium resize-none outline-none border-0 bg-transparent p-0 leading-snug flex-1 text-foreground"value={description}rows={1}onChange={(e) => setDescription(e.target.value)}@@ -133,20 +91,14 @@ export default function StepCard({<><buttononClick={() => onBlur?.(step.id)}- className="p-1 rounded-md transition-colors"- style={{ color: '#d1d5db' }}- onMouseEnter={(e) => { e.currentTarget.style.color = '#F59E0B'; }}- onMouseLeave={(e) => { e.currentTarget.style.color = '#d1d5db'; }}+ className="p-1 rounded-md transition-colors text-border hover:text-accent"title="Blur sensitive area"><EyeOff size={13} /></button><buttononClick={handleCopy}- className="p-1 rounded-md transition-colors"- style={{ color: copied ? '#16a34a' : '#d1d5db' }}- onMouseEnter={(e) => { if (!copied) e.currentTarget.style.color = '#16a34a'; }}- onMouseLeave={(e) => { if (!copied) e.currentTarget.style.color = '#d1d5db'; }}+ className={`p-1 rounded-md transition-colors ${copied ? 'text-green-600' : 'text-border hover:text-green-600'}`}title="Copy screenshot">{copied ? <Check size={13} /> : <Copy size={13} />}@@ -155,10 +107,7 @@ export default function StepCard({)}<buttononClick={handleDelete}- className="p-1 rounded-md transition-colors"- style={{ color: '#d1d5db' }}- onMouseEnter={(e) => { e.currentTarget.style.color = '#ef4444'; }}- onMouseLeave={(e) => { e.currentTarget.style.color = '#d1d5db'; }}+ className="p-1 rounded-md transition-colors text-border hover:text-red-500"title="Delete step"><Trash2 size={13} />