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: mascot illustrations for empty states β€” floating sparkles, holding star, sweeping broom

Luis Ortiz5471f16e60ea
diff --git a/src/ui/fullview/LibraryContent.tsx b/src/ui/fullview/LibraryContent.tsx
index 81b9fd5..4951112 100644
--- a/src/ui/fullview/LibraryContent.tsx
+++ b/src/ui/fullview/LibraryContent.tsx
@@ -1,12 +1,4 @@
-import {
- ArrowDownWideNarrow,
- ChevronDown,
- ChevronLeft,
- ChevronRight,
- FileText,
- LayoutGrid,
- LayoutList,
-} from 'lucide-react';
+import { ArrowDownWideNarrow, ChevronDown, ChevronLeft, ChevronRight, LayoutGrid, LayoutList } from 'lucide-react';
import { useCallback, useEffect, useRef, useState } from 'react';
import {
type GuideChangeEvent,
@@ -22,6 +14,7 @@ import {
} from '@/core/guides/service';
import type { Guide, Screenshot } from '@/core/guides/types';
import { useFullview } from '@/stores/fullview';
+import ConfirmDeleteModal from './components/ConfirmDeleteModal';
import GuideGridView from './components/GuideGridView';
import GuideListView from './components/GuideListView';
@@ -29,12 +22,99 @@ interface LibraryContentProps {
category: 'all' | 'starred' | 'trash';
}
-const emptyMessages: Record<string, string> = {
- all: 'No guides yet. Start a capture from the Mimik extension.',
- starred: 'No starred guides. Star a guide to find it quickly.',
- trash: 'Trash is empty.',
+const emptyConfig: Record<string, { title: string; sub: string }> = {
+ all: { title: 'No guides yet', sub: 'Start a capture to create your first guide' },
+ starred: { title: 'No starred guides', sub: 'Star a guide to find it quickly' },
+ trash: { title: 'Trash is empty', sub: 'Squeaky clean!' },
};
+function EmptyMascot({ category }: { category: string }) {
+ if (category === 'starred') return <StarredMascot />;
+ if (category === 'trash') return <TrashMascot />;
+ return <NoGuidesMascot />;
+}
+
+function NoGuidesMascot() {
+ return (
+ <svg viewBox="0 0 200 200" className="w-24 h-24 animate-[float_3s_ease-in-out_infinite]">
+ <style>{`
+ @keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
+ @keyframes sparkle{0%,100%{opacity:.3;transform:scale(.8)}50%{opacity:1;transform:scale(1.1)}}
+ `}</style>
+ <circle cx="45" cy="80" r="3" fill="#818CF8" style={{ animation: 'sparkle 1.5s ease-in-out infinite' }} />
+ <circle cx="160" cy="70" r="2.5" fill="#38BDF8" style={{ animation: 'sparkle 1.5s ease-in-out infinite 0.3s' }} />
+ <circle cx="50" cy="140" r="2" fill="#A5B4FC" style={{ animation: 'sparkle 1.5s ease-in-out infinite 0.6s' }} />
+ <circle
+ cx="155"
+ cy="145"
+ r="2.5"
+ fill="#818CF8"
+ style={{ animation: 'sparkle 1.5s ease-in-out infinite 0.9s' }}
+ />
+ <circle cx="100" cy="110" r="50" fill="#C7D2FE" />
+ <rect x="58" y="110" width="84" height="40" rx="5" fill="#1E1B4B" />
+ <path d="M58 110 L58 98 Q58 82 100 82 Q142 82 142 98 L142 110Z" fill="#3730A3" />
+ <path d="M58 110 L58 98 Q58 82 100 82 Q142 82 142 98 L142 110Z" fill="#4F46E5" />
+ <rect x="58" y="109" width="84" height="2" fill="#C7D2FE" />
+ <path d="M82 126 Q88 118 94 126" stroke="#C7D2FE" strokeWidth="3" fill="none" strokeLinecap="round" />
+ <path d="M106 126 Q112 118 118 126" stroke="#C7D2FE" strokeWidth="3" fill="none" strokeLinecap="round" />
+ <path d="M90 138 Q100 146 110 138" stroke="#C7D2FE" strokeWidth="2.5" fill="none" strokeLinecap="round" />
+ </svg>
+ );
+}
+
+function StarredMascot() {
+ return (
+ <svg viewBox="0 0 200 200" className="w-24 h-24">
+ <style>{`
+ @keyframes twinkle{0%,100%{opacity:.4;transform:scale(.9)}50%{opacity:1;transform:scale(1.15)}}
+ `}</style>
+ <circle cx="100" cy="115" r="50" fill="#C7D2FE" />
+ <rect x="58" y="115" width="84" height="40" rx="5" fill="#1E1B4B" />
+ <path d="M58 115 L58 103 Q58 87 100 87 Q142 87 142 103 L142 115Z" fill="#3730A3" />
+ <path d="M58 115 L58 103 Q58 87 100 87 Q142 87 142 103 L142 115Z" fill="#4F46E5" />
+ <rect x="58" y="114" width="84" height="2" fill="#C7D2FE" />
+ <path d="M82 131 Q88 124 94 131" stroke="#C7D2FE" strokeWidth="3" fill="none" strokeLinecap="round" />
+ <path d="M106 131 Q112 124 118 131" stroke="#C7D2FE" strokeWidth="3" fill="none" strokeLinecap="round" />
+ <path d="M92 143 Q100 150 108 143" stroke="#C7D2FE" strokeWidth="2.5" fill="none" strokeLinecap="round" />
+ <g style={{ animation: 'twinkle 1.5s ease-in-out infinite' }}>
+ <polygon
+ points="155,70 159,80 170,81 162,88 164,99 155,93 146,99 148,88 140,81 151,80"
+ fill="#FBBF24"
+ stroke="#F59E0B"
+ strokeWidth="1"
+ />
+ </g>
+ <line x1="142" y1="120" x2="153" y2="90" stroke="#C7D2FE" strokeWidth="3" strokeLinecap="round" />
+ </svg>
+ );
+}
+
+function TrashMascot() {
+ return (
+ <svg viewBox="0 0 200 200" className="w-24 h-24">
+ <style>{`
+ @keyframes sweep{0%,100%{transform:rotate(-10deg)}50%{transform:rotate(10deg)}}
+ @keyframes sparkle{0%,100%{opacity:.3;transform:scale(.8)}50%{opacity:1;transform:scale(1.1)}}
+ `}</style>
+ <circle cx="100" cy="115" r="50" fill="#C7D2FE" />
+ <rect x="58" y="115" width="84" height="40" rx="5" fill="#1E1B4B" />
+ <path d="M58 115 L58 103 Q58 87 100 87 Q142 87 142 103 L142 115Z" fill="#3730A3" />
+ <path d="M58 115 L58 103 Q58 87 100 87 Q142 87 142 103 L142 115Z" fill="#4F46E5" />
+ <rect x="58" y="114" width="84" height="2" fill="#C7D2FE" />
+ <path d="M82 131 Q88 124 94 131" stroke="#C7D2FE" strokeWidth="3" fill="none" strokeLinecap="round" />
+ <path d="M106 131 Q112 124 118 131" stroke="#C7D2FE" strokeWidth="3" fill="none" strokeLinecap="round" />
+ <path d="M92 143 Q100 150 108 143" stroke="#C7D2FE" strokeWidth="2.5" fill="none" strokeLinecap="round" />
+ <g style={{ transformOrigin: '155px 130px', animation: 'sweep 1.5s ease-in-out infinite' }}>
+ <line x1="155" y1="75" x2="155" y2="140" stroke="#A5B4FC" strokeWidth="3" strokeLinecap="round" />
+ <path d="M147 140 Q155 135 163 140 L160 155 Q155 158 150 155Z" fill="#818CF8" />
+ </g>
+ <circle cx="165" cy="155" r="2" fill="#38BDF8" style={{ animation: 'sparkle 1s ease-in-out infinite' }} />
+ <circle cx="148" cy="160" r="1.5" fill="#818CF8" style={{ animation: 'sparkle 1s ease-in-out infinite 0.3s' }} />
+ </svg>
+ );
+}
+
type SortKey = 'recent' | 'oldest' | 'alpha' | 'steps';
const sortLabels: Record<SortKey, string> = {
recent: 'Recent first',
@@ -82,6 +162,7 @@ export default function LibraryContent({ category }: LibraryContentProps) {
const [sort, setSort] = useState<SortKey>('recent');
const [sortOpen, setSortOpen] = useState(false);
const [page, setPage] = useState(0);
+ const [deleteTarget, setDeleteTarget] = useState<string | null>(null);
const sortRef = useRef<HTMLDivElement>(null);
const allGuidesRef = useRef<Guide[]>([]);
@@ -189,10 +270,14 @@ export default function LibraryContent({ category }: LibraryContentProps) {
await restoreGuide(id);
await loadGuides();
};
- const handlePermanentDelete = async (e: React.MouseEvent, id: string) => {
+ const handlePermanentDelete = (e: React.MouseEvent, id: string) => {
e.stopPropagation();
- if (!window.confirm('Permanently delete this guide? This cannot be undone.')) return;
- await permanentlyDeleteGuide(id);
+ setDeleteTarget(id);
+ };
+ const confirmPermanentDelete = async () => {
+ if (!deleteTarget) return;
+ setDeleteTarget(null);
+ await permanentlyDeleteGuide(deleteTarget);
await loadGuides();
};
@@ -240,9 +325,10 @@ export default function LibraryContent({ category }: LibraryContentProps) {
{loading ? (
<p className="text-sm py-12 text-center text-purple">Loading...</p>
) : allGuidesRef.current.length === 0 ? (
- <div className="text-center py-20">
- <FileText size={40} className="mx-auto mb-3 text-border" />
- <p className="text-lg text-muted-foreground">{emptyMessages[category]}</p>
+ <div className="text-center py-20 flex flex-col items-center">
+ <EmptyMascot category={category} />
+ <p className="text-lg font-medium text-foreground mt-4">{emptyConfig[category].title}</p>
+ <p className="text-sm text-muted-foreground mt-1">{emptyConfig[category].sub}</p>
</div>
) : display === 'list' ? (
<GuideListView
@@ -253,7 +339,13 @@ export default function LibraryContent({ category }: LibraryContentProps) {
onPermanentDelete={handlePermanentDelete}
/>
) : (
- <GuideGridView />
+ <GuideGridView
+ category={category}
+ onStar={handleStar}
+ onTrash={handleTrash}
+ onRestore={handleRestore}
+ onPermanentDelete={handlePermanentDelete}
+ />
)}
{showPagination && (
@@ -277,6 +369,11 @@ export default function LibraryContent({ category }: LibraryContentProps) {
</button>
</div>
)}
+ <ConfirmDeleteModal
+ open={deleteTarget !== null}
+ onClose={() => setDeleteTarget(null)}
+ onConfirm={confirmPermanentDelete}
+ />
</div>
);
}
diff --git a/src/ui/sidepanel/LibraryView.tsx b/src/ui/sidepanel/LibraryView.tsx
index 0f750d8..8234516 100644
--- a/src/ui/sidepanel/LibraryView.tsx
+++ b/src/ui/sidepanel/LibraryView.tsx
@@ -1,4 +1,4 @@
-import { FileText, Star, Trash2 } from 'lucide-react';
+import { Star, Trash2 } from 'lucide-react';
import { useCallback, useEffect, useState } from 'react';
import {
type GuideChangeEvent,
@@ -87,11 +87,44 @@ export default function LibraryView({ onOpen, searchQuery = '' }: LibraryViewPro
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 bg-lavender border border-violet-light">
- <FileText size={20} className="text-muted-foreground" />
- </div>
- <p className="text-sm font-medium text-foreground">No guides yet</p>
+ <div className="py-10 text-center flex flex-col items-center">
+ <svg viewBox="0 0 200 200" className="w-20 h-20 animate-[float_3s_ease-in-out_infinite]">
+ <style>{`
+ @keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
+ @keyframes sparkle{0%,100%{opacity:.3;transform:scale(.8)}50%{opacity:1;transform:scale(1.1)}}
+ `}</style>
+ <circle cx="45" cy="80" r="3" fill="#818CF8" style={{ animation: 'sparkle 1.5s ease-in-out infinite' }} />
+ <circle
+ cx="160"
+ cy="70"
+ r="2.5"
+ fill="#38BDF8"
+ style={{ animation: 'sparkle 1.5s ease-in-out infinite 0.3s' }}
+ />
+ <circle
+ cx="50"
+ cy="140"
+ r="2"
+ fill="#A5B4FC"
+ style={{ animation: 'sparkle 1.5s ease-in-out infinite 0.6s' }}
+ />
+ <circle
+ cx="155"
+ cy="145"
+ r="2.5"
+ fill="#818CF8"
+ style={{ animation: 'sparkle 1.5s ease-in-out infinite 0.9s' }}
+ />
+ <circle cx="100" cy="110" r="50" fill="#C7D2FE" />
+ <rect x="58" y="110" width="84" height="40" rx="5" fill="#1E1B4B" />
+ <path d="M58 110 L58 98 Q58 82 100 82 Q142 82 142 98 L142 110Z" fill="#3730A3" />
+ <path d="M58 110 L58 98 Q58 82 100 82 Q142 82 142 98 L142 110Z" fill="#4F46E5" />
+ <rect x="58" y="109" width="84" height="2" fill="#C7D2FE" />
+ <path d="M82 126 Q88 118 94 126" stroke="#C7D2FE" strokeWidth="3" fill="none" strokeLinecap="round" />
+ <path d="M106 126 Q112 118 118 126" stroke="#C7D2FE" strokeWidth="3" fill="none" strokeLinecap="round" />
+ <path d="M90 138 Q100 146 110 138" stroke="#C7D2FE" strokeWidth="2.5" fill="none" strokeLinecap="round" />
+ </svg>
+ <p className="text-sm font-medium text-foreground mt-3">No guides yet</p>
<p className="text-xs mt-1 text-purple">Start a capture to create your first guide</p>
</div>
);