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: redesign side panel with amber gradient theme

Luis Ortizd5e08ba70cac
diff --git a/src/shared/guide-service.ts b/src/shared/guide-service.ts
index e7a9316..548c416 100644
--- a/src/shared/guide-service.ts
+++ b/src/shared/guide-service.ts
@@ -91,6 +91,11 @@ export async function deleteStep(guideId: string, stepId: string): Promise<void>
}
}
+export async function getFirstStepUrl(guideId: string): Promise<string | null> {
+ const steps = await db.steps.where('guideId').equals(guideId).sortBy('index');
+ return steps[0]?.url || null;
+}
+
export async function getFirstScreenshot(guideId: string): Promise<Screenshot | null> {
const steps = await db.steps.where('guideId').equals(guideId).sortBy('index');
for (const step of steps) {
diff --git a/src/sidepanel/App.tsx b/src/sidepanel/App.tsx
index 4bd0bdc..dac65e6 100644
--- a/src/sidepanel/App.tsx
+++ b/src/sidepanel/App.tsx
@@ -1,5 +1,5 @@
import { useState, useEffect, useCallback } from 'react';
-import { Video } from 'lucide-react';
+import { Video, Search } from 'lucide-react';
import LibraryView from './LibraryView';
import GuideEditor from './GuideEditor';
import RecordingView from './RecordingView';
@@ -9,10 +9,34 @@ type View =
| { name: 'editor'; guideId: string }
| { name: 'recording'; guideId: string };
+function MascotIcon({ size = 44 }: { size?: number }) {
+ return (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" width={size} height={size}>
+ <defs>
+ <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="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"/>
+ </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"/>
+ </svg>
+ );
+}
+
export default function App() {
const [isAlive, setIsAlive] = useState(false);
const [isRecording, setIsRecording] = useState(false);
const [view, setView] = useState<View>({ name: 'library' });
+ const [search, setSearch] = useState('');
useEffect(() => {
chrome.runtime.sendMessage({ type: 'PING' }, (response) => {
@@ -90,38 +114,68 @@ export default function App() {
}
return (
- <div className="min-h-screen bg-white">
- {/* Header */}
- <div className="px-5 pt-5 pb-4">
- <div className="flex items-center justify-between mb-6">
- <h1 className="text-xl font-bold text-gray-900 tracking-tight">Mimik</h1>
- <span className={`text-xs font-medium px-2 py-0.5 rounded-full ${isAlive ? 'bg-green-50 text-green-600' : 'bg-gray-100 text-gray-400'}`}>
+ <div className="min-h-screen bg-white flex flex-col">
+ {/* Stripe-style gradient 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)' }} />
+
+ {/* 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'}`}>
{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>
+ </div>
+
{/* Start Capture button */}
<button
onClick={handleStartRecording}
disabled={!isAlive}
- className="w-full py-3.5 px-4 bg-blue-600 text-white rounded-xl font-semibold text-base hover:bg-blue-700 active:bg-blue-800 transition-all disabled:opacity-40 disabled:cursor-not-allowed shadow-sm flex items-center justify-center gap-2"
+ 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)' }}
>
- <Video size={20} />
+ <Video size={18} />
Start Capture
</button>
</div>
- {/* Divider */}
- <div className="h-px bg-gray-100" />
+ {/* Body β€” white section */}
+ <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
+ type="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'; }}
+ />
+ </div>
- {/* Recent guides */}
- <div className="px-5 pt-3 pb-1">
- <p className="text-xs font-medium text-gray-400 uppercase tracking-wider">Recent</p>
+ {/* Recent section label */}
+ <p className="text-[11px] font-semibold uppercase tracking-wider mb-2.5" style={{ color: '#92400E' }}>Recent</p>
+
+ {/* Guide list */}
+ <LibraryView
+ onOpen={(guideId) => setView({ name: 'editor', guideId })}
+ isAlive={isAlive}
+ searchQuery={search}
+ />
</div>
- <LibraryView
- onOpen={(guideId) => setView({ name: 'editor', guideId })}
- isAlive={isAlive}
- />
</div>
);
}
diff --git a/src/sidepanel/LibraryView.tsx b/src/sidepanel/LibraryView.tsx
index 8b2d1aa..3c453d2 100644
--- a/src/sidepanel/LibraryView.tsx
+++ b/src/sidepanel/LibraryView.tsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
import { Trash2, FileText } from 'lucide-react';
-import { getGuides, softDeleteGuide } from '../shared/guide-service';
+import { getGuides, softDeleteGuide, getFirstStepUrl } from '../shared/guide-service';
import type { Guide } from '../shared/types';
function formatRelativeTime(timestamp: number): string {
@@ -17,21 +17,53 @@ function formatRelativeTime(timestamp: number): string {
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 '';
+ }
+}
+
interface LibraryViewProps {
onOpen: (guideId: string) => void;
onStartRecording?: () => void;
isAlive?: boolean;
+ searchQuery?: string;
}
-export default function LibraryView({ onOpen, onStartRecording, isAlive }: LibraryViewProps) {
- const [guides, setGuides] = useState<Guide[]>([]);
+interface GuideWithMeta extends Guide {
+ favicon: string;
+ domain: string;
+}
+
+export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewProps) {
+ const [guides, setGuides] = useState<GuideWithMeta[]>([]);
const [loading, setLoading] = useState(true);
const loadGuides = useCallback(async () => {
setLoading(true);
try {
const result = await getGuides();
- setGuides(result);
+ const withMeta: GuideWithMeta[] = await Promise.all(
+ result.map(async (guide) => {
+ const url = await getFirstStepUrl(guide.id);
+ return {
+ ...guide,
+ favicon: url ? getFaviconUrl(url) : '',
+ domain: url ? extractDomain(url) : '',
+ };
+ })
+ );
+ setGuides(withMeta);
} finally {
setLoading(false);
}
@@ -48,47 +80,84 @@ export default function LibraryView({ onOpen, onStartRecording, isAlive }: Libra
await loadGuides();
}, [loadGuides]);
+ const filtered = searchQuery
+ ? guides.filter(g => g.title.toLowerCase().includes(searchQuery.toLowerCase()))
+ : guides;
+
if (loading) {
- return <p className="text-sm text-gray-400 px-5 py-4">Loading...</p>;
+ return <p className="text-sm py-4" style={{ color: '#B5A48B' }}>Loading...</p>;
}
if (guides.length === 0) {
return (
- <div className="px-5 py-8 text-center">
- <div className="w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center mx-auto mb-3">
- <FileText size={20} className="text-gray-400" />
+ <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>
- <p className="text-sm text-gray-500">No guides yet</p>
- <p className="text-xs text-gray-400 mt-1">Start a capture to create your first guide</p>
+ <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>
+ </div>
+ );
+ }
+
+ if (filtered.length === 0) {
+ return (
+ <div className="py-8 text-center">
+ <p className="text-sm" style={{ color: '#B5A48B' }}>No matching guides</p>
</div>
);
}
return (
- <div className="flex flex-col">
- <div className="divide-y divide-gray-50">
- {guides.map((guide) => (
- <div
- key={guide.id}
- className="px-5 py-3 hover:bg-gray-50 cursor-pointer flex items-center justify-between group transition-colors"
- onClick={() => onOpen(guide.id)}
- >
- <div className="flex-1 min-w-0">
- <p className="text-sm font-medium text-gray-900 truncate">{guide.title}</p>
- <p className="text-xs text-gray-400 mt-0.5">
- {guide.stepIds.length} step{guide.stepIds.length !== 1 ? 's' : ''} &middot; {formatRelativeTime(guide.updatedAt)}
- </p>
- </div>
- <button
- onClick={(e) => handleDelete(e, guide.id)}
- className="ml-2 p-1.5 rounded-lg text-gray-300 opacity-0 group-hover:opacity-100 hover:text-red-500 hover:bg-red-50 transition-all flex-shrink-0"
- title="Delete guide"
- >
- <Trash2 size={14} />
- </button>
+ <div className="flex flex-col gap-2 pb-4">
+ {filtered.map((guide) => (
+ <div
+ key={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'; }}
+ 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' }}>
+ {guide.favicon ? (
+ <img
+ src={guide.favicon}
+ alt=""
+ className="w-5 h-5"
+ onError={(e) => {
+ const el = e.target as HTMLImageElement;
+ el.style.display = 'none';
+ el.parentElement!.textContent = guide.title.charAt(0).toUpperCase();
+ }}
+ />
+ ) : (
+ guide.title.charAt(0).toUpperCase()
+ )}
</div>
- ))}
- </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' }}>
+ {guide.stepIds.length} step{guide.stepIds.length !== 1 ? 's' : ''} &middot; {formatRelativeTime(guide.updatedAt)}
+ </p>
+ </div>
+
+ {/* Delete */}
+ <button
+ onClick={(e) => handleDelete(e, guide.id)}
+ className="ml-1 p-1.5 rounded-lg opacity-0 group-hover:opacity-100 hover:bg-red-50 transition-all flex-shrink-0"
+ style={{ color: '#D4BFA8' }}
+ onMouseEnter={(e) => { (e.target as HTMLElement).style.color = '#EF4444'; }}
+ onMouseLeave={(e) => { (e.target as HTMLElement).style.color = '#D4BFA8'; }}
+ title="Delete guide"
+ >
+ <Trash2 size={14} />
+ </button>
+ </div>
+ ))}
</div>
);
}