π¬ 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
feat: AI title loading states with gradient text and typewriter effect
Luis Ortizeef5a13e8755
diff --git a/src/core/guides/service.ts b/src/core/guides/service.tsindex 1694f4c..3c52aea 100644--- a/src/core/guides/service.ts+++ b/src/core/guides/service.ts@@ -67,6 +67,7 @@ export async function getTrashedGuides(): Promise<Guide[]> {export async function updateGuideTitle(id: string, title: string): Promise<void> {await db.guides.update(id, { title, updatedAt: Date.now() });+ notifyGuidesChanged({ type: 'mutated' });}export async function addStepToGuide(guideId: string, stepId: string): Promise<void> {diff --git a/src/stores/fullview.ts b/src/stores/fullview.tsindex 5fad6c0..ed53ba4 100644--- a/src/stores/fullview.ts+++ b/src/stores/fullview.ts@@ -21,6 +21,8 @@ interface FullviewStore {// Guide viewguideTitle: string;setGuideTitle: (title: string) => void;+ guideStepCount: number;+ setGuideStepCount: (count: number) => void;guideExportData: GuideExportData | null;setGuideExportData: (data: GuideExportData | null) => void;scrollToStepId: string | null;@@ -39,6 +41,8 @@ export const useFullviewStore = create<FullviewStore>((set) => ({guideTitle: '',setGuideTitle: (guideTitle) => set({ guideTitle }),+ guideStepCount: 0,+ setGuideStepCount: (guideStepCount) => set({ guideStepCount }),guideExportData: null,setGuideExportData: (guideExportData) => set({ guideExportData }),scrollToStepId: null,diff --git a/src/ui/fullview/GuideContent.tsx b/src/ui/fullview/GuideContent.tsxindex 5ada06b..4a9d7da 100644--- a/src/ui/fullview/GuideContent.tsx+++ b/src/ui/fullview/GuideContent.tsx@@ -1,17 +1,45 @@-import { useCallback, useEffect, useState } from 'react';+import { useCallback, useEffect, useRef, useState } from 'react';import {deleteStep,getGuide,+ onGuidesChanged,updateGuideTitle,updateScreenshotBlob,updateStepDescription,} from '@/core/guides/service';import type { Guide, Screenshot, Step } from '@/core/guides/types';-import { extractDomain } from '@/lib/utils';+import { getFaviconUrl, getMostCommonDomain } from '@/lib/utils';import { useFullviewStore } from '@/stores/fullview';import BlurCanvas from '@/ui/sidepanel/BlurCanvas';import GuideStepList from './components/GuideStepList';+function useTypewriter(text: string, enabled: boolean, speed = 40): { display: string; done: boolean } {+ const [index, setIndex] = useState(0);+ const [active, setActive] = useState(false);+ const prevTextRef = useRef(text);++ useEffect(() => {+ if (enabled && text !== prevTextRef.current && prevTextRef.current === 'Untitled Guide') {+ prevTextRef.current = text;+ setIndex(0);+ setActive(true);+ } else {+ prevTextRef.current = text;+ }+ }, [text, enabled]);++ useEffect(() => {+ if (!active || index >= text.length) {+ if (index >= text.length) setActive(false);+ return;+ }+ const timer = setTimeout(() => setIndex((i) => i + 1), speed);+ return () => clearTimeout(timer);+ }, [active, index, text, speed]);++ return { display: active ? text.slice(0, index) : text, done: !active };+}+interface GuideContentProps {guideId: string;}@@ -24,12 +52,15 @@ interface GuideData {export default function GuideContent({ guideId }: GuideContentProps) {const setGuideTitle = useFullviewStore((s) => s.setGuideTitle);+ const setGuideStepCount = useFullviewStore((s) => s.setGuideStepCount);const setGuideExportData = useFullviewStore((s) => s.setGuideExportData);const [data, setData] = useState<GuideData | null>(null);const [loading, setLoading] = useState(true);const [title, setTitle] = useState('');const [blurringStepId, setBlurringStepId] = useState<string | null>(null);+ const hasSteps = data ? data.steps.length > 0 : false;+ const typewriter = useTypewriter(title, hasSteps);const loadGuide = useCallback(async () => {const result = await getGuide(guideId);@@ -38,13 +69,15 @@ export default function GuideContent({ guideId }: GuideContentProps) {setTitle(result.guide.title);document.title = `${result.guide.title} β Mimik`;setGuideTitle(result.guide.title);+ setGuideStepCount(result.steps.length);setGuideExportData({ guideId, ...result });}setLoading(false);- }, [guideId, setGuideTitle, setGuideExportData]);+ }, [guideId, setGuideTitle, setGuideStepCount, setGuideExportData]);useEffect(() => {loadGuide();+ return onGuidesChanged(() => loadGuide());}, [loadGuide]);const handleTitleBlur = useCallback(async () => {@@ -87,10 +120,30 @@ export default function GuideContent({ guideId }: GuideContentProps) {[blurringStepId, data],);- if (loading) return <p className="text-sm py-12 text-center text-warm">Loading...</p>;+ if (loading)+ return (+ <div>+ <div className="h-10 w-2/3 rounded-lg bg-border/50 animate-pulse" />+ <div className="h-4 w-48 rounded bg-border/30 animate-pulse mt-3 mb-8" />+ <div className="space-y-6">+ {[0, 1, 2].map((i) => (+ <div key={i} className="rounded-xl border border-border/50 p-4">+ <div+ className="aspect-video rounded-lg bg-[#f5f2ee] animate-pulse mb-3"+ style={{ animationDelay: `${i * 150}ms` }}+ />+ <div+ className="h-4 w-3/4 rounded bg-border/40 animate-pulse"+ style={{ animationDelay: `${i * 150 + 50}ms` }}+ />+ </div>+ ))}+ </div>+ </div>+ );if (!data) return <p className="text-sm py-12 text-center text-warm">Guide not found.</p>;- const domain = extractDomain(data.steps[0]?.url || '');+ const domain = getMostCommonDomain(data.steps);const blurScreenshot = blurringStepId ? data.screenshots.get(blurringStepId) : undefined;return (@@ -99,27 +152,62 @@ export default function GuideContent({ guideId }: GuideContentProps) {<BlurCanvas screenshot={blurScreenshot} onSave={handleBlurSave} onCancel={() => setBlurringStepId(null)} />)}- <input- value={title}- onChange={(e) => {- setTitle(e.target.value);- setGuideTitle(e.target.value);- }}- onBlur={handleTitleBlur}- className="text-[32px] font-extrabold bg-transparent border-b-2 border-transparent hover:border-border focus:outline-none focus:border-accent w-full p-0 h-auto text-foreground"- />+ {title === 'Untitled Guide' && data.steps.length > 0 ? (+ <div className="text-[32px] font-extrabold animate-gradient-text bg-[length:300%_100%] bg-clip-text text-transparent bg-gradient-to-r from-muted-foreground via-amber to-muted-foreground">+ Generating title...+ </div>+ ) : !typewriter.done ? (+ <div className="text-[32px] font-extrabold text-foreground">+ {typewriter.display}+ <span className="inline-block w-[3px] h-[30px] bg-amber ml-0.5 align-text-bottom animate-blink" />+ </div>+ ) : (+ <textarea+ ref={(el) => {+ if (el) {+ el.style.height = '0';+ el.style.height = `${el.scrollHeight}px`;+ }+ }}+ value={title}+ rows={1}+ onChange={(e) => {+ setTitle(e.target.value);+ setGuideTitle(e.target.value);+ const el = e.target;+ el.style.height = '0';+ el.style.height = `${el.scrollHeight}px`;+ }}+ onBlur={handleTitleBlur}+ className="text-[32px] font-extrabold bg-transparent border-b-2 border-transparent hover:border-border focus:outline-none focus:border-accent w-full p-0 text-foreground resize-none leading-tight overflow-hidden"+ />+ )}- <p className="text-xs mt-1 mb-8 text-muted-foreground">- 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>+ <div className="flex items-center gap-1.5 mt-2 mb-4 flex-wrap">+ <span className="inline-flex items-center text-[11px] font-medium text-muted-foreground bg-white border border-border px-2.5 py-0.5 rounded-full">+ {new Date(data.guide.createdAt).toLocaleDateString('en-US', {+ month: 'short',+ day: 'numeric',+ year: 'numeric',+ })}+ </span>+ <span className="inline-flex items-center text-[11px] font-medium text-muted-foreground bg-white border border-border px-2.5 py-0.5 rounded-full">+ {data.steps.length} step{data.steps.length !== 1 ? 's' : ''}+ </span>+ {domain && (+ <span className="inline-flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground bg-white border border-border pl-1.5 pr-2.5 py-0.5 rounded-full">+ <img+ src={getFaviconUrl(domain, 16)}+ alt=""+ className="w-3.5 h-3.5 rounded-full"+ onError={(e) => {+ (e.target as HTMLImageElement).style.display = 'none';+ }}+ />+ {domain}+ </span>+ )}+ </div><GuideStepListguideId={guideId}diff --git a/src/ui/fullview/TopNav.tsx b/src/ui/fullview/TopNav.tsxindex 25da5bc..e8f2151 100644--- a/src/ui/fullview/TopNav.tsx+++ b/src/ui/fullview/TopNav.tsx@@ -19,6 +19,7 @@ const navItems = [export default function TopNav({ route }: TopNavProps) {const counts = useFullviewStore((s) => s.counts);const guideTitle = useFullviewStore((s) => s.guideTitle);+ const guideStepCount = useFullviewStore((s) => s.guideStepCount);const exportData = useFullviewStore((s) => s.guideExportData);const setSearchOpen = useFullviewStore((s) => s.setSearchOpen);@@ -39,7 +40,13 @@ export default function TopNav({ route }: TopNavProps) {? guideTitle && (<><ChevronRight size={14} className="text-foreground opacity-25" />- <span className="text-[13px] font-medium truncate max-w-sm text-foreground">{guideTitle}</span>+ {guideTitle === 'Untitled Guide' && guideStepCount > 0 ? (+ <span className="text-[13px] font-medium truncate max-w-sm animate-gradient-text bg-[length:300%_100%] bg-clip-text text-transparent bg-gradient-to-r from-muted-foreground via-amber to-muted-foreground">+ Generating title...+ </span>+ ) : (+ <span className="text-[13px] font-medium truncate max-w-sm text-foreground">{guideTitle}</span>+ )}</>): navItems.map((item) => {diff --git a/src/ui/sidepanel/index.css b/src/ui/sidepanel/index.cssindex b352a9b..23d75fd 100644--- a/src/ui/sidepanel/index.css+++ b/src/ui/sidepanel/index.css@@ -42,3 +42,21 @@body {font-family: "Poppins", sans-serif;}++@keyframes gradient-text {+ 0% { background-position: 100% 50%; }+ 100% { background-position: -100% 50%; }+}++@utility animate-gradient-text {+ animation: gradient-text 3s ease infinite;+}++@keyframes blink {+ 0%, 100% { opacity: 1; }+ 50% { opacity: 0; }+}++@utility animate-blink {+ animation: blink 0.7s step-end infinite;+}