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 fullview dashboard with centered layout

Luis Ortiz1ff46a267def
diff --git a/src/ui/fullview/App.tsx b/src/ui/fullview/App.tsx
index 9256042..0e51931 100644
--- a/src/ui/fullview/App.tsx
+++ b/src/ui/fullview/App.tsx
@@ -1,10 +1,10 @@
-import { useState, useCallback } from 'react';
+import { useState, useCallback, useEffect } from 'react';
import { useRoute } from './router';
import TopNav from './TopNav';
import LibraryContent from './LibraryContent';
import GuideContent from './GuideContent';
-import GuideOutline from './GuideOutline';
-import type { Step } from '@/core/guides/types';
+import SearchModal from './SearchModal';
+import type { Step, Guide, Screenshot } from '@/core/guides/types';
export default function FullViewApp() {
const route = useRoute();
@@ -17,6 +17,19 @@ export default function FullViewApp() {
const [guideTitle, setGuideTitle] = useState('');
const [activeStepId, setActiveStepId] = useState<string | null>(null);
const [scrollToStepId, setScrollToStepId] = useState<string | null>(null);
+ const [guideExportData, setGuideExportData] = useState<{ guideId: string; guide: Guide; steps: Step[]; screenshots: Map<string, Screenshot> } | null>(null);
+ const [searchOpen, setSearchOpen] = useState(false);
+
+ useEffect(() => {
+ const handler = (e: KeyboardEvent) => {
+ if ((e.metaKey || e.ctrlKey) && e.key === 'k') {
+ e.preventDefault();
+ setSearchOpen(prev => !prev);
+ }
+ };
+ window.addEventListener('keydown', handler);
+ return () => window.removeEventListener('keydown', handler);
+ }, []);
const handleStepsLoaded = useCallback((steps: Step[], domain: string, favicon: string) => {
setGuideSteps(steps);
@@ -35,9 +48,12 @@ export default function FullViewApp() {
route={route}
guideCounts={counts}
guideTitle={route.page === 'guide' ? guideTitle : undefined}
+ guideData={route.page === 'guide' ? guideExportData ?? undefined : undefined}
search={search}
onSearchChange={setSearch}
+ onSearchClick={() => setSearchOpen(true)}
/>
+ <SearchModal open={searchOpen} onClose={() => setSearchOpen(false)} />
{route.page === 'library' && (
<main className="flex-1 p-8 max-w-6xl mx-auto w-full">
@@ -50,29 +66,18 @@ export default function FullViewApp() {
)}
{route.page === 'guide' && (
- <div className="flex-1 flex">
- {/* Step outline panel */}
- <GuideOutline
- steps={guideSteps}
- domain={guideDomain}
- favicon={guideFavicon}
- activeStepId={activeStepId}
- onStepClick={handleStepClick}
- />
-
- {/* Guide content */}
- <main className="flex-1 p-8 overflow-y-auto">
- <div className="max-w-3xl">
- <GuideContent
- guideId={route.guideId}
- onStepsLoaded={handleStepsLoaded}
- scrollToStepId={scrollToStepId}
- onActiveStepChange={setActiveStepId}
- onTitleChange={setGuideTitle}
- />
- </div>
- </main>
- </div>
+ <main className="flex-1 py-10 px-6">
+ <div className="max-w-[720px] mx-auto">
+ <GuideContent
+ guideId={route.guideId}
+ onStepsLoaded={handleStepsLoaded}
+ scrollToStepId={scrollToStepId}
+ onActiveStepChange={setActiveStepId}
+ onTitleChange={setGuideTitle}
+ onGuideDataLoaded={setGuideExportData}
+ />
+ </div>
+ </main>
)}
</div>
);
diff --git a/src/ui/fullview/GuideContent.tsx b/src/ui/fullview/GuideContent.tsx
index b0c80dc..ad3401c 100644
--- a/src/ui/fullview/GuideContent.tsx
+++ b/src/ui/fullview/GuideContent.tsx
@@ -3,8 +3,6 @@ import { getGuide, updateGuideTitle, updateStepDescription, deleteStep, reorderS
import type { Guide, Step, Screenshot } from '@/core/guides/types';
import StepCard from '@/ui/sidepanel/StepCard';
import BlurCanvas from '@/ui/sidepanel/BlurCanvas';
-import ExportMenu from '@/ui/sidepanel/ExportMenu';
-import { navigate } from './router';
interface GuideContentProps {
guideId: string;
@@ -12,6 +10,7 @@ interface GuideContentProps {
scrollToStepId: string | null;
onActiveStepChange: (stepId: string | null) => void;
onTitleChange?: (title: string) => void;
+ onGuideDataLoaded?: (data: { guideId: string; guide: Guide; steps: Step[]; screenshots: Map<string, Screenshot> }) => void;
}
interface GuideData {
@@ -27,7 +26,7 @@ function getFaviconUrl(url: string): string {
try { return `https://www.google.com/s2/favicons?domain=${new URL(url).hostname}&sz=32`; } catch { return ''; }
}
-export default function GuideContent({ guideId, onStepsLoaded, scrollToStepId, onActiveStepChange, onTitleChange }: GuideContentProps) {
+export default function GuideContent({ guideId, onStepsLoaded, scrollToStepId, onActiveStepChange, onTitleChange, onGuideDataLoaded }: GuideContentProps) {
const [data, setData] = useState<GuideData | null>(null);
const [loading, setLoading] = useState(true);
const [title, setTitle] = useState('');
@@ -43,6 +42,7 @@ export default function GuideContent({ guideId, onStepsLoaded, scrollToStepId, o
setTitle(result.guide.title);
document.title = `${result.guide.title} β€” Mimik`;
onTitleChange?.(result.guide.title);
+ onGuideDataLoaded?.({ guideId, guide: result.guide, steps: result.steps, screenshots: result.screenshots });
const firstUrl = result.steps[0]?.url || '';
onStepsLoaded(result.steps, extractDomain(firstUrl), getFaviconUrl(firstUrl));
}
@@ -122,42 +122,27 @@ export default function GuideContent({ guideId, onStepsLoaded, scrollToStepId, o
<BlurCanvas screenshot={blurScreenshot} onSave={handleBlurSave} onCancel={() => setBlurringStepId(null)} />
)}
- {/* Breadcrumb + Export */}
- <div className="flex items-center justify-between mb-6">
- <div className="flex items-center gap-2 text-sm text-gray-400">
- <button onClick={() => navigate({ page: 'library', category: 'all' })} className="hover:text-gray-600">
- All Guides
- </button>
- <span>&gt;</span>
- <span className="text-gray-700 font-medium truncate max-w-xs">{data.guide.title}</span>
- </div>
- <ExportMenu guideId={guideId} guide={data.guide} steps={data.steps} screenshots={data.screenshots} />
- </div>
-
- {/* Created date */}
- <p className="text-sm text-gray-400 mb-2">Created {new Date(data.guide.createdAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })}</p>
-
{/* Title */}
<input
- className="text-3xl font-bold bg-transparent border-b-2 border-transparent hover:border-gray-300 focus:border-amber-500 focus:outline-none w-full mb-6"
+ className="text-[32px] font-extrabold bg-transparent border-b-2 border-transparent hover:border-gray-200 focus:outline-none w-full"
+ style={{ color: '#451a03' }}
value={title}
- onChange={(e) => setTitle(e.target.value)}
+ onChange={(e) => { setTitle(e.target.value); onTitleChange?.(e.target.value); }}
onBlur={handleTitleBlur}
+ onFocus={(e) => { e.target.style.borderColor = '#F59E0B'; }}
+ onBlurCapture={(e) => { e.target.style.borderColor = 'transparent'; }}
/>
- {/* Site card */}
- {domain && (
- <div className="flex items-center gap-3 p-4 border border-gray-200 rounded-xl mb-8">
- {favicon && <img src={favicon} alt="" className="w-6 h-6 rounded" onError={(e) => { (e.target as HTMLImageElement).style.display = 'none'; }} />}
- <span className="text-sm font-medium text-gray-700">{domain}</span>
- </div>
- )}
+ {/* Meta */}
+ <p className="text-xs mt-1 mb-8" style={{ color: '#92400E' }}>
+ Created {new Date(data.guide.createdAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })} Β· {data.steps.length} step{data.steps.length !== 1 ? 's' : ''}{domain ? ` Β· ${domain}` : ''}
+ </p>
{/* Steps */}
{data.steps.length === 0 ? (
<p className="text-sm text-gray-500 text-center py-12">No steps in this guide.</p>
) : (
- <div className="space-y-4">
+ <div className="space-y-6">
{data.steps.map((step, idx) => (
<div
key={step.id}
diff --git a/src/ui/fullview/LibraryContent.tsx b/src/ui/fullview/LibraryContent.tsx
index 35c4620..3ade233 100644
--- a/src/ui/fullview/LibraryContent.tsx
+++ b/src/ui/fullview/LibraryContent.tsx
@@ -108,7 +108,7 @@ export default function LibraryContent({ category, onCountsChange, searchQuery =
) : filtered.length === 0 ? (
<div className="text-center py-20">
<FileText size={40} className="mx-auto text-gray-300 mb-3" />
- <p className="text-lg text-gray-500">{search ? 'No matching guides' : emptyMessages[category]}</p>
+ <p className="text-lg text-gray-500">{searchQuery ? 'No matching guides' : emptyMessages[category]}</p>
</div>
) : display === 'list' ? (
<div className="border border-gray-200 rounded-xl overflow-hidden bg-white">
diff --git a/src/ui/fullview/TopNav.tsx b/src/ui/fullview/TopNav.tsx
index 8ee4990..cb6807b 100644
--- a/src/ui/fullview/TopNav.tsx
+++ b/src/ui/fullview/TopNav.tsx
@@ -1,16 +1,52 @@
-import { FileText, Star, Trash2, ArrowLeft, Search } from 'lucide-react';
-import type { Route } from './router';
-import { navigate } from './router';
+import {
+ FileText,
+ Star,
+ Trash2,
+ ArrowLeft,
+ Search,
+ ChevronRight,
+} from "lucide-react";
+import type { Route } from "./router";
+import { navigate } from "./router";
+import type { Guide, Step, Screenshot } from "@/core/guides/types";
+import ExportMenu from "@/ui/sidepanel/ExportMenu";
function MascotIcon({ size = 22 }: { size?: number }) {
return (
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="20 50 160 120" width={size} height={Math.round(size * 120 / 160)}>
- <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
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="20 50 160 120"
+ width={size}
+ height={Math.round((size * 120) / 160)}
+ style={{ display: "block", flexShrink: 0 }}
+ >
+ <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>
);
}
@@ -19,91 +55,148 @@ interface TopNavProps {
route: Route;
guideCounts: { all: number; starred: number; trash: number };
guideTitle?: string;
+ guideData?: {
+ guideId: string;
+ guide: Guide;
+ steps: Step[];
+ screenshots: Map<string, Screenshot>;
+ };
search: string;
onSearchChange: (value: string) => void;
+ onSearchClick?: () => void;
}
-export default function TopNav({ route, guideCounts, guideTitle, search, onSearchChange }: TopNavProps) {
- const navItems: { key: 'all' | 'starred' | 'trash'; label: string; icon: typeof FileText; count: number }[] = [
- { key: 'all', label: 'All Guides', icon: FileText, count: guideCounts.all },
- { key: 'starred', label: 'Starred', icon: Star, count: guideCounts.starred },
- { key: 'trash', label: 'Trash', icon: Trash2, count: guideCounts.trash },
+export default function TopNav({
+ route,
+ guideCounts,
+ guideTitle,
+ guideData,
+ search,
+ onSearchChange,
+ onSearchClick,
+}: TopNavProps) {
+ const navItems: {
+ key: "all" | "starred" | "trash";
+ label: string;
+ icon: typeof FileText;
+ count: number;
+ }[] = [
+ { key: "all", label: "All Guides", icon: FileText, count: guideCounts.all },
+ {
+ key: "starred",
+ label: "Starred",
+ icon: Star,
+ count: guideCounts.starred,
+ },
+ { key: "trash", label: "Trash", icon: Trash2, count: guideCounts.trash },
];
return (
<header
- className="flex items-center gap-5 px-7 h-14 flex-shrink-0"
- style={{ background: 'linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%)' }}
+ className="flex items-center gap-5 px-7 h-16 flex-shrink-0"
+ style={{
+ background: "linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%)",
+ }}
>
{/* Brand β€” click to go home */}
<button
- onClick={() => navigate({ page: 'library', category: 'all' })}
- className="flex items-center gap-2.5 mr-4 cursor-pointer"
+ onClick={() => navigate({ page: "library", category: "all" })}
+ className="flex items-center gap-2 mr-4 cursor-pointer h-full"
>
- <MascotIcon size={26} />
- <span className="text-[16px] font-bold tracking-tight" style={{ color: '#451a03' }}>Mimik</span>
+ <div className="mb-1">
+ <MascotIcon size={22} />
+ </div>
+ <span
+ className="text-[15px] font-bold tracking-tight"
+ style={{ color: "#451a03" }}
+ >
+ Mimik
+ </span>
</button>
- {route.page === 'guide' ? (
+ {route.page === "guide" ? (
<>
- <button
- onClick={() => navigate({ page: 'library', category: 'all' })}
- className="flex items-center gap-1.5 text-[13px] font-medium rounded-md px-3 py-1.5 transition-colors"
- style={{ color: '#78350F' }}
- onMouseEnter={(e) => { e.currentTarget.style.background = 'rgba(255,255,255,0.3)'; }}
- onMouseLeave={(e) => { e.currentTarget.style.background = 'transparent'; }}
- >
- <ArrowLeft size={15} />
- All Guides
- </button>
{guideTitle && (
<>
- <span style={{ color: '#92400E' }} className="text-xs">&gt;</span>
- <span className="text-[13px] font-medium truncate max-w-xs" style={{ color: '#451a03' }}>
+ <ChevronRight
+ size={14}
+ style={{ color: "#451a03", opacity: 0.25 }}
+ />
+ <span
+ className="text-[13px] font-medium truncate max-w-sm"
+ style={{ color: "#451a03" }}
+ >
{guideTitle}
</span>
</>
)}
</>
) : (
- navItems.map(item => {
- const active = route.page === 'library' && route.category === item.key;
+ navItems.map((item) => {
+ const active =
+ route.page === "library" && route.category === item.key;
return (
<button
key={item.key}
- onClick={() => navigate({ page: 'library', category: item.key })}
- className="flex items-center gap-2 text-[13px] px-3 py-1.5 rounded-md transition-colors"
+ onClick={() => navigate({ page: "library", category: item.key })}
+ className="flex items-center gap-1.5 text-[13px] h-8 px-3 rounded-md transition-all"
style={{
- color: active ? '#451a03' : '#78350F',
- background: active ? 'rgba(255,255,255,0.4)' : 'transparent',
+ color: active ? "#FDE68A" : "#78350F",
+ background: active ? "#451a03" : "transparent",
fontWeight: active ? 600 : 500,
}}
- onMouseEnter={(e) => { if (!active) e.currentTarget.style.background = 'rgba(255,255,255,0.2)'; }}
- onMouseLeave={(e) => { if (!active) e.currentTarget.style.background = 'transparent'; }}
+ onMouseEnter={(e) => {
+ if (!active)
+ e.currentTarget.style.background = "rgba(69,26,3,0.1)";
+ }}
+ onMouseLeave={(e) => {
+ if (!active) e.currentTarget.style.background = "transparent";
+ }}
>
- <item.icon size={15} />
+ <item.icon size={13.5} />
{item.label}
{item.count > 0 && (
- <span className="text-[11px] ml-0.5" style={{ color: '#92400E' }}>{item.count}</span>
+ <span
+ className="text-[11px] ml-0.5"
+ style={{
+ color: active ? "rgba(253,230,138,0.7)" : "#92400E",
+ }}
+ >
+ {item.count}
+ </span>
)}
</button>
);
})
)}
- {/* Search β€” right side */}
- <div className="ml-auto relative">
- <Search size={14} className="absolute left-3 top-1/2 -translate-y-1/2" style={{ color: '#92400E' }} />
- <input
- type="text"
- placeholder="Search guides..."
- value={search}
- onChange={(e) => onSearchChange(e.target.value)}
- className="pl-9 pr-3 py-1.5 text-[13px] rounded-lg border-none outline-none w-52"
- style={{ background: 'rgba(255,255,255,0.4)', color: '#451a03' }}
- onFocus={(e) => { e.target.style.background = 'rgba(255,255,255,0.6)'; }}
- onBlur={(e) => { e.target.style.background = 'rgba(255,255,255,0.4)'; }}
- />
+ {/* Right side */}
+ <div className="ml-auto flex items-center gap-3">
+ <button
+ onClick={onSearchClick}
+ className="flex items-center gap-2 px-3 h-8 rounded-lg w-52 cursor-pointer"
+ style={{ background: "rgba(255,255,255,0.4)", border: 0 }}
+ >
+ <Search
+ size={14}
+ className="flex-shrink-0"
+ style={{ color: "#92400E" }}
+ />
+ <span className="text-[12px] flex-1 text-left" style={{ color: "#92400E" }}>
+ Search guides...
+ </span>
+ <span className="text-[9px] font-semibold px-1.5 py-0.5 rounded" style={{ background: "rgba(69,26,3,0.1)", color: "#92400E" }}>
+ ⌘K
+ </span>
+ </button>
+ {guideData && (
+ <ExportMenu
+ guideId={guideData.guideId}
+ guide={guideData.guide}
+ steps={guideData.steps}
+ screenshots={guideData.screenshots}
+ />
+ )}
</div>
</header>
);
diff --git a/src/ui/sidepanel/App.tsx b/src/ui/sidepanel/App.tsx
index a08e3f0..c9a16e6 100644
--- a/src/ui/sidepanel/App.tsx
+++ b/src/ui/sidepanel/App.tsx
@@ -2,7 +2,7 @@ import { logger } from '@/lib/logger';
import { useState, useEffect, useCallback } from 'react';
import { Video, Search } from 'lucide-react';
import { sendMessage } from '@/lib/messaging';
-import { getActiveTab } from '@/lib/browser-api';
+import { getActiveTab, getExtensionURL, queryTabs, updateTab, focusWindow, createTab } from '@/lib/browser-api';
import { connectToBackground } from '@/lib/port';
import { CaptureState } from '@/core/capture/machine';
import LibraryView from './LibraryView';
@@ -79,10 +79,16 @@ export default function App() {
const res = await sendMessage('stopRecording', undefined);
if (res.success) {
setIsRecording(false);
+ setView({ name: 'library' });
if (res.guideId) {
- setView({ name: 'editor', guideId: res.guideId });
- } else {
- setView({ name: 'library' });
+ const url = getExtensionURL(`/fullview.html?guideId=${res.guideId}`);
+ const tabs = await queryTabs({ url: getExtensionURL('/fullview.html') });
+ if (tabs.length > 0 && tabs[0].id) {
+ await updateTab(tabs[0].id, { active: true, url });
+ if (tabs[0].windowId) await focusWindow(tabs[0].windowId);
+ } else {
+ await createTab({ url });
+ }
}
}
} catch (err) {
diff --git a/src/ui/sidepanel/LibraryView.tsx b/src/ui/sidepanel/LibraryView.tsx
index 1d76776..8f0907d 100644
--- a/src/ui/sidepanel/LibraryView.tsx
+++ b/src/ui/sidepanel/LibraryView.tsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
-import { Trash2, FileText } from 'lucide-react';
-import { getGuides, softDeleteGuide, getFirstStepUrl } from '@/core/guides/service';
+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 {
@@ -73,9 +73,14 @@ export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewPro
loadGuides();
}, [loadGuides]);
+ const handleStar = useCallback(async (e: React.MouseEvent, guideId: string) => {
+ e.stopPropagation();
+ await toggleStar(guideId);
+ await loadGuides();
+ }, [loadGuides]);
+
const handleDelete = useCallback(async (e: React.MouseEvent, guideId: string) => {
e.stopPropagation();
- if (!window.confirm('Delete this guide?')) return;
await softDeleteGuide(guideId);
await loadGuides();
}, [loadGuides]);
@@ -145,17 +150,29 @@ export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewPro
</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>
+ {/* Actions */}
+ <div className="flex items-center gap-0.5 ml-1 flex-shrink-0">
+ <button
+ onClick={(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'; }}
+ title={guide.starred ? 'Unstar' : 'Star'}
+ >
+ <Star size={14} fill={guide.starred ? 'currentColor' : 'none'} />
+ </button>
+ <button
+ onClick={(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'; }}
+ title="Move to trash"
+ >
+ <Trash2 size={14} />
+ </button>
+ </div>
</div>
))}
</div>