π¬ 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: start a capture from the dashboard on either surface
Luis Ortiz3b461de78be6
diff --git a/AGENTS.md b/AGENTS.mdindex 14f2319..f0fc9aa 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -320,6 +320,23 @@ resolving a scancode against a keyboard layout is a local call with nothing to waddon boundary when that flag is set, so a password never reaches our data even though UIAutomationalready withholds it.+## Which Client Is Running++`configureCore` carries a `client`, `extension` or `desktop`, and `client()` reads it back. Shared+code that must genuinely behave differently asks at runtime rather than taking a prop for it, which+is how the surfaces stay one codebase instead of two dressed as one.++The distinction worth holding: a **prop** is right when the app supplies behaviour the shared code+could not know β `onStartCapture` opens a capture sheet on one surface and a side panel on the+other, and neither belongs in `packages/ui`. `client()` is right when shared code decides for+itself, with nothing to pass down.++The rule that keeps `packages/ui` from becoming a filing problem is simpler than a taxonomy:+anything in it belongs to **both** surfaces. Asking which surface owns a file there means it is in+the wrong place, and it should live in `apps/desktop` or in the extension's `src/ui`. That is why+`CaptureSheet`, the capture settings and the overlay have never been shared β they are not shared+components filed badly, they are the parts of the desktop that have no counterpart at all.+## Desktop StorageThe desktop app reuses `@mimik/core/guides` for everything except the screenshot bytes β Electron's@@ -631,11 +648,18 @@ does not, so the gear exists here and only on the library route. Moving it brougimport rewrites, `#imports` to `@mimik/core/env` and `@/core/*` to `@mimik/core/*`, because nothingin them was ever extension-specific beyond how WXT resolves a module.-Below the header the window opens on `HomeScreen`, not on the fullview dashboard. The extension's-side panel already established that shape and the desktop follows it rather than inventing a second-one: the mascot, the question, one primary control, then a search field and the library.-`sidepanel_heroTitle` and its neighbours are reused verbatim, so the two surfaces stay worded the-same.+Below the header both surfaces mount the same dashboard. The desktop briefly had its own+`HomeScreen` β a hero, a question and a Start Capture button β and it existed for one reason: the+extension's dashboard has no way to start a capture, only its side panel does, so there was nothing+to inherit and the hero was copied from the side panel into a window five times its width. That one+missing affordance was the whole of the apparent divergence between the two products.++`LibraryContent` now takes an optional `onStartCapture` and renders the button itself, so the+dashboard can begin a recording on either surface and `HomeScreen` is gone. What the button does is+the app's to decide, because the two actions have nothing in common: the desktop opens+`CaptureSheet`, and the extension opens the side panel, which is where its recording view lives.+Filling that gap was an improvement to the extension in its own right β browsing the library in a+tab and wanting to record used to mean going to find the side panel yourself.Pressing Start Capture opens `CaptureSheet` rather than arming immediately. The sheet is where thecapture mode is chosen, because the mode decides what every screenshot in the guide will frame anddiff --git a/apps/desktop/src/renderer/App.tsx b/apps/desktop/src/renderer/App.tsxindex 4cec8a3..325c4bf 100644--- a/apps/desktop/src/renderer/App.tsx+++ b/apps/desktop/src/renderer/App.tsx@@ -6,7 +6,6 @@ import SearchModal from '@mimik/ui/fullview/SearchModal';import TopNav from '@mimik/ui/fullview/TopNav';import { useEffect, useState } from 'react';import CaptureSheet from './CaptureSheet';-import HomeScreen from './HomeScreen';import SettingsPanel from './SettingsPanel';export default function App() {@@ -39,11 +38,9 @@ export default function App() {<GuideContent guideId={route.guideId} initialStepId={route.stepId} initialTool={route.tool} /></div></main>- ) : route.category === 'all' ? (- <HomeScreen onOpen={(id) => navigate({ page: 'guide', guideId: id })} onStart={() => setSheetOpen(true)} />) : (<main className="flex-1 py-8 px-6">- <LibraryContent category={route.category} />+ <LibraryContent category={route.category} onStartCapture={() => setSheetOpen(true)} /></main>)}<SearchModal />diff --git a/apps/desktop/src/renderer/HomeScreen.tsx b/apps/desktop/src/renderer/HomeScreen.tsxdeleted file mode 100644index 916088a..0000000--- a/apps/desktop/src/renderer/HomeScreen.tsx+++ /dev/null@@ -1,151 +0,0 @@-import { i18n } from '@mimik/core/env';-import {- type GuideChangeEvent,- getGuides,- onGuidesChanged,- softDeleteGuide,- toggleStar,-} from '@mimik/core/guides/service';-import type { Guide } from '@mimik/core/guides/types';-import { Button } from '@mimik/ui/components/ui/button';-import { Input } from '@mimik/ui/components/ui/input';-import { formatRelativeTime, getDomainInitial } from '@mimik/ui/lib/utils';-import MascotIcon from '@mimik/ui/shared/MascotIcon';-import { Search, Star, Trash2, Video } from 'lucide-react';-import { useCallback, useEffect, useState } from 'react';--export default function HomeScreen({ onOpen, onStart }: { onOpen(guideId: string): void; onStart(): void }) {- const [guides, setGuides] = useState<Guide[]>([]);- const [query, setQuery] = useState('');-- const load = useCallback(async () => {- setGuides(await getGuides());- }, []);-- useEffect(() => {- load();- }, [load]);-- useEffect(- () =>- onGuidesChanged((event: GuideChangeEvent) => {- if (event.type === 'starred') {- setGuides((prev) => prev.map((g) => (g.id === event.id ? { ...g, starred: event.starred } : g)));- } else {- load();- }- }),- [load],- );-- const star = async (event: React.MouseEvent, id: string) => {- event.stopPropagation();- setGuides((prev) => prev.map((g) => (g.id === id ? { ...g, starred: !g.starred } : g)));- await toggleStar(id);- };-- const trash = async (event: React.MouseEvent, id: string) => {- event.stopPropagation();- await softDeleteGuide(id);- await load();- };-- const filtered = query ? guides.filter((g) => g.title.toLowerCase().includes(query.toLowerCase())) : guides;-- return (- <div className="flex flex-1 flex-col">- <section className="flex flex-col items-center gap-3.5 border-b border-border bg-secondary px-7 py-9">- <MascotIcon size={68} />- <div className="text-center">- <h1 className="text-[22px] font-semibold text-foreground">{i18n.t('sidepanel_heroTitle')}</h1>- <p className="mt-1 text-[13px] text-muted-foreground">{i18n.t('sidepanel_heroSubtitle')}</p>- </div>- <Button size="lg" className="mt-1 h-auto rounded-xl px-8 py-3.5 text-[15px] font-semibold" onClick={onStart}>- <Video size={19} />- {i18n.t('sidepanel_startCapture')}- </Button>- </section>-- <div className="flex flex-1 flex-col gap-4 px-10 pb-7 pt-6">- <div className="flex items-center gap-3.5">- <div className="relative w-[340px]">- <Search size={16} className="absolute left-3.5 top-1/2 -translate-y-1/2 text-accent" />- <Input- type="search"- aria-label={i18n.t('sidepanel_searchPlaceholder')}- placeholder={i18n.t('sidepanel_searchPlaceholder')}- value={query}- onChange={(e) => setQuery(e.target.value)}- className="rounded-xl pl-10 !text-[13px]"- />- </div>- <p className="text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground">- {i18n.t('sidepanel_recentLabel')} ·{' '}- {filtered.length === 1- ? i18n.t('desktop_guideCount', [String(filtered.length)])- : i18n.t('desktop_guideCountPlural', [String(filtered.length)])}- </p>- </div>-- {filtered.length === 0 ? (- <p className="py-10 text-center text-sm text-muted-foreground">- {query ? i18n.t('library_noMatchingGuides') : i18n.t('library_noGuidesSub')}- </p>- ) : (- <div className="grid grid-cols-2 gap-3">- {filtered.map((guide) => {- const { letter, gradient } = getDomainInitial(guide.title || '?');- return (- <div- key={guide.id}- className="flex items-center gap-3.5 rounded-[13px] border border-border bg-card px-4 py-3.5 transition-colors focus-within:border-accent hover:border-accent"- >- <button- type="button"- onClick={() => onOpen(guide.id)}- className="flex min-w-0 flex-1 items-center gap-3.5 text-left"- >- <span- className="flex size-[34px] shrink-0 items-center justify-center rounded-[10px] text-sm font-semibold text-white"- style={{ background: `linear-gradient(135deg, ${gradient[0]}, ${gradient[1]})` }}- aria-hidden="true"- >- {letter}- </span>- <span className="min-w-0 flex-1">- <span className="block truncate text-[13.5px] font-semibold text-foreground">{guide.title}</span>- <span className="mt-1 flex items-center gap-2">- <span className="text-[11px] text-muted-foreground">{formatRelativeTime(guide.updatedAt)}</span>- <span className="rounded-full bg-secondary px-2 py-0.5 text-[10px] font-semibold leading-none text-accent">- {guide.stepIds.length !== 1- ? i18n.t('fullview_stepCountPlural', [String(guide.stepIds.length)])- : i18n.t('fullview_stepCount', [String(guide.stepIds.length)])}- </span>- </span>- </span>- </button>- <button- type="button"- aria-label={guide.starred ? i18n.t('common_unstar') : i18n.t('common_star')}- onClick={(e) => star(e, guide.id)}- className={`rounded-lg p-1.5 transition-colors hover:text-accent ${guide.starred ? 'text-accent' : 'text-border'}`}- >- <Star size={15} fill={guide.starred ? 'currentColor' : 'none'} />- </button>- <button- type="button"- aria-label={i18n.t('library_moveToTrash')}- onClick={(e) => trash(e, guide.id)}- className="rounded-lg p-1.5 text-border transition-colors hover:text-destructive"- >- <Trash2 size={15} />- </button>- </div>- );- })}- </div>- )}- </div>- </div>- );-}diff --git a/apps/desktop/src/renderer/core-env.ts b/apps/desktop/src/renderer/core-env.tsindex fec01db..5a75e19 100644--- a/apps/desktop/src/renderer/core-env.ts+++ b/apps/desktop/src/renderer/core-env.ts@@ -4,6 +4,7 @@ import { type Messages, translate } from '@mimik/core/i18n/translate';import en from '@mimik/locales/en.yml';configureCore({+ client: 'desktop',t: (key, substitutions) => translate(en as Messages, key, substitutions),assetUrl: (path) => new URL(path, document.baseURI).href,storage: {diff --git a/packages/core/src/env.ts b/packages/core/src/env.tsindex 9a203a6..4d6a24e 100644--- a/packages/core/src/env.ts+++ b/packages/core/src/env.ts@@ -1,6 +1,9 @@import type { Settings, SettingsKey } from './guides/types';+export type ClientType = 'extension' | 'desktop';+export interface CoreEnv {+ client: ClientType;t: (key: string, substitutions?: string[]) => string;assetUrl: (path: string) => string;storage: {@@ -28,6 +31,8 @@ export const i18n = {export const assetUrl = (path: string) => env().assetUrl(path);+export const client = (): ClientType => env().client;+export const localStorage = {get: <K extends SettingsKey>(keys: readonly K[]) => env().storage.get(keys),set: (items: Partial<Settings>) => env().storage.set(items),diff --git a/packages/ui/src/fullview/LibraryContent.tsx b/packages/ui/src/fullview/LibraryContent.tsxindex 811154b..a42b665 100644--- a/packages/ui/src/fullview/LibraryContent.tsx+++ b/packages/ui/src/fullview/LibraryContent.tsx@@ -1,4 +1,4 @@-import { ArrowDownWideNarrow, ChevronDown, ChevronLeft, ChevronRight, LayoutGrid, LayoutList } from 'lucide-react';+import { ArrowDownWideNarrow, ChevronDown, ChevronLeft, ChevronRight, LayoutGrid, LayoutList, Video } from 'lucide-react';import { useCallback, useEffect, useRef, useState } from 'react';import { i18n } from '@mimik/core/env';import {@@ -22,6 +22,7 @@ import GuideListView from './components/GuideListView';interface LibraryContentProps {category: 'all' | 'starred' | 'trash';+ onStartCapture?: () => void;}const emptyConfig: Record<string, { titleKey: string; subKey: string }> = {@@ -141,7 +142,7 @@ function sortGuides(guides: Guide[], sort: SortKey): Guide[] {}}-export default function LibraryContent({ category }: LibraryContentProps) {+export default function LibraryContent({ category, onStartCapture }: LibraryContentProps) {const {setGuides,updateGuide,@@ -288,6 +289,15 @@ export default function LibraryContent({ category }: LibraryContentProps) {return (<div><div className="flex items-center justify-end gap-2 mb-4">+ {onStartCapture && category === 'all' && (+ <button+ onClick={onStartCapture}+ className="mr-auto flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground transition-colors hover:bg-primary/90"+ >+ <Video size={15} />+ {i18n.t('sidepanel_startCapture')}+ </button>+ )}<div ref={sortRef} className="relative"><buttononClick={() => setSortOpen(!sortOpen)}diff --git a/src/ui/shared/__tests__/settings-autosave.test.ts b/packages/ui/src/lib/__tests__/settings-autosave.test.tssimilarity index 100%rename from src/ui/shared/__tests__/settings-autosave.test.tsrename to packages/ui/src/lib/__tests__/settings-autosave.test.tsdiff --git a/src/ui/shared/settings-autosave.ts b/packages/ui/src/lib/settings-autosave.tssimilarity index 100%rename from src/ui/shared/settings-autosave.tsrename to packages/ui/src/lib/settings-autosave.tsdiff --git a/packages/ui/src/shared/AiSettings.tsx b/packages/ui/src/shared/AiSettings.tsxnew file mode 100644index 0000000..86b1a6d--- /dev/null+++ b/packages/ui/src/shared/AiSettings.tsx@@ -0,0 +1,186 @@+import { keyFor, withKeyFor } from '@mimik/core/capture/ai/keys';+import { AI_PROVIDERS, type AIProviderKey, CUSTOM_MODEL_VALUE, DEFAULT_AI_PROVIDER } from '@mimik/core/capture/ai/models';+import { AI_LANGUAGES } from '@mimik/core/capture/ai/prompts';+import type { KeyValidation } from '@mimik/core/capture/ai/validate';+import { i18n, localStorage } from '@mimik/core/env';+import type { AIApiKeys } from '@mimik/core/capture/ai/keys';+import { Input } from '@mimik/ui/components/ui/input';+import { Check, Eye, EyeOff, Loader2, TriangleAlert } from 'lucide-react';+import { useEffect, useState } from 'react';++export type ValidateKey = (provider: string, apiKey: string, baseUrl?: string, model?: string) => Promise<KeyValidation>;++interface AiSettingsProps {+ validate: ValidateKey;+}++const FIELD =+ 'w-full h-10 rounded-[10px] border border-border bg-card px-3 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-accent/30';++export default function AiSettings({ validate }: AiSettingsProps) {+ const [provider, setProvider] = useState<AIProviderKey>(DEFAULT_AI_PROVIDER);+ const [keys, setKeys] = useState<AIApiKeys>({});+ const [model, setModel] = useState('');+ const [baseUrl, setBaseUrl] = useState('');+ const [language, setLanguage] = useState('en');+ const [reveal, setReveal] = useState(false);+ const [result, setResult] = useState<KeyValidation | null>(null);+ const [checking, setChecking] = useState(false);++ useEffect(() => {+ localStorage.get(['aiProvider', 'aiApiKeys', 'aiModel', 'aiBaseUrl', 'aiLanguage']).then((stored) => {+ const next = (stored.aiProvider as AIProviderKey) || DEFAULT_AI_PROVIDER;+ setProvider(next);+ setKeys((stored.aiApiKeys as AIApiKeys) ?? {});+ setModel((stored.aiModel as string) || AI_PROVIDERS[next].defaultModel);+ setBaseUrl((stored.aiBaseUrl as string) || '');+ setLanguage((stored.aiLanguage as string) || 'en');+ });+ }, []);++ const apiKey = keyFor(keys, provider);+ const config = AI_PROVIDERS[provider];++ const save = (patch: Record<string, unknown>) => {+ void localStorage.set(patch as never);+ };++ const onProvider = (next: AIProviderKey) => {+ setProvider(next);+ setModel(AI_PROVIDERS[next].defaultModel);+ setResult(null);+ save({ aiProvider: next, aiModel: AI_PROVIDERS[next].defaultModel });+ };++ const onKey = (value: string) => {+ const next = withKeyFor(keys, provider, value);+ setKeys(next);+ setResult(null);+ save({ aiApiKeys: next });+ };++ const check = async () => {+ setChecking(true);+ setResult(await validate(provider, apiKey, baseUrl || undefined, model).catch(() => null));+ setChecking(false);+ };++ return (+ <div className="flex flex-col gap-5">+ <div className="grid grid-cols-2 gap-3.5">+ <label className="flex flex-col gap-1.5">+ <span className="text-[13px] font-medium">{i18n.t('settings_provider')}</span>+ <select className={FIELD} value={provider} onChange={(e) => onProvider(e.target.value as AIProviderKey)}>+ {Object.entries(AI_PROVIDERS).map(([id, p]) => (+ <option key={id} value={id}>+ {p.label}+ </option>+ ))}+ </select>+ </label>++ <label className="flex flex-col gap-1.5">+ <span className="text-[13px] font-medium">{i18n.t('settings_model')}</span>+ <select+ className={FIELD}+ value={model}+ onChange={(e) => {+ setModel(e.target.value);+ save({ aiModel: e.target.value });+ }}+ >+ {config.models.map((m) => (+ <option key={m.id} value={m.id}>+ {m.id === CUSTOM_MODEL_VALUE ? i18n.t('settings_modelCustom') : m.label}+ </option>+ ))}+ </select>+ </label>+ </div>++ <div className="flex flex-col gap-1.5">+ <span className="text-[13px] font-medium">{i18n.t('settings_apiKey')}</span>+ <div className="flex gap-2">+ <div className="relative flex-1">+ <Input+ type={reveal ? 'text' : 'password'}+ value={apiKey}+ onChange={(e) => onKey(e.target.value)}+ className="h-10 pr-10"+ />+ <button+ type="button"+ aria-label={i18n.t(reveal ? 'settings_hideKey' : 'settings_showKey')}+ onClick={() => setReveal(!reveal)}+ className="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-accent"+ >+ {reveal ? <EyeOff size={15} /> : <Eye size={15} />}+ </button>+ </div>+ <button+ type="button"+ onClick={() => void check()}+ disabled={!apiKey || checking}+ className="h-10 rounded-[10px] bg-primary px-4 text-sm font-semibold text-primary-foreground disabled:opacity-40"+ >+ {checking ? <Loader2 size={15} className="animate-spin" /> : i18n.t('settings_checkKey')}+ </button>+ </div>+ {result && <KeyResult result={result} />}+ {!apiKey && <p className="text-xs text-muted-foreground">{i18n.t('settings_aiNoKey')}</p>}+ </div>++ <div className="grid grid-cols-2 gap-3.5">+ <label className="flex flex-col gap-1.5">+ <span className="text-[13px] font-medium">{i18n.t('settings_aiLanguage')}</span>+ <select+ className={FIELD}+ value={language}+ onChange={(e) => {+ setLanguage(e.target.value);+ save({ aiLanguage: e.target.value });+ }}+ >+ {AI_LANGUAGES.map((l) => (+ <option key={l.code} value={l.code}>+ {l.label}+ </option>+ ))}+ </select>+ </label>++ <label className="flex flex-col gap-1.5">+ <span className="text-[13px] font-medium">{i18n.t('settings_baseUrl')}</span>+ <Input+ value={baseUrl}+ placeholder={config.defaultBaseUrl}+ onChange={(e) => {+ setBaseUrl(e.target.value);+ save({ aiBaseUrl: e.target.value });+ }}+ className="h-10"+ />+ </label>+ </div>+ </div>+ );+}++function KeyResult({ result }: { result: KeyValidation }) {+ if (result.valid) {+ return (+ <p className="flex items-center gap-1.5 text-xs font-medium text-success">+ <Check size={14} />+ {result.models?.length+ ? i18n.t('settings_modelsFound', [String(result.models.length)])+ : i18n.t('settings_keyValid')}+ </p>+ );+ }+ return (+ <p className="flex items-center gap-1.5 text-xs font-medium text-destructive">+ <TriangleAlert size={14} />+ {i18n.t('settings_keyInvalid')}+ </p>+ );+}diff --git a/src/lib/core-env.ts b/src/lib/core-env.tsindex 68d8611..a0c8932 100644--- a/src/lib/core-env.ts+++ b/src/lib/core-env.ts@@ -3,6 +3,7 @@ import { configureCore } from '@/core/env';import { getExtensionURL, localStorage } from '@/lib/browser-api';configureCore({+ client: 'extension',t: (key, substitutions) => i18n.t(key as never, substitutions as never),assetUrl: (path) => getExtensionURL(path as never),storage: localStorage,diff --git a/src/ui/fullview/App.tsx b/src/ui/fullview/App.tsxindex ab963c4..85c845a 100644--- a/src/ui/fullview/App.tsx+++ b/src/ui/fullview/App.tsx@@ -6,6 +6,7 @@ import SearchModal from '@mimik/ui/fullview/SearchModal';import TopNav from '@mimik/ui/fullview/TopNav';import { useFullview } from '@mimik/ui/stores/fullview';import { useEffect } from 'react';+import { openSidebar } from '@/lib/browser-api';import UpdateNotice from '@/ui/shared/UpdateNotice';import VoiceNotice from './components/VoiceNotice';@@ -36,7 +37,7 @@ export default function FullViewApp() {{route.page === 'library' && (<main className="flex-1 p-8 max-w-6xl mx-auto w-full">- <LibraryContent category={route.category} />+ <LibraryContent category={route.category} onStartCapture={openSidebar} /></main>)}diff --git a/src/ui/shared/SettingsView.tsx b/src/ui/shared/SettingsView.tsxindex 8f88b2a..4b54269 100644--- a/src/ui/shared/SettingsView.tsx+++ b/src/ui/shared/SettingsView.tsx@@ -20,6 +20,7 @@ import { Input } from '@mimik/ui/components/ui/input';import { Popover, PopoverContent, PopoverTrigger } from '@mimik/ui/components/ui/popover';import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@mimik/ui/components/ui/select';import { logger } from '@mimik/ui/lib/logger';+import { changedSettings, type SettingsSnapshot } from '@mimik/ui/lib/settings-autosave';import ColorPicker from '@mimik/ui/shared/ColorPicker';import {ArrowLeft,@@ -42,7 +43,6 @@ import { useCallback, useEffect, useRef, useState } from 'react';import { localStorage } from '@/lib/browser-api';import { KeyStatusNote, KeyWarningNote, ModelList, SecretInput, useKeyCheck } from '@/ui/shared/key-check';import MicrophonePicker from '@/ui/shared/MicrophonePicker';-import { changedSettings, type SettingsSnapshot } from '@/ui/shared/settings-autosave';interface SettingsViewProps {onBack?: () => void;