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(desktop): open settings in a dialog over the library

Luis Ortiz3385e26b513b
diff --git a/apps/desktop/src/renderer/App.tsx b/apps/desktop/src/renderer/App.tsx
index b03a431..56235b0 100644
--- a/apps/desktop/src/renderer/App.tsx
+++ b/apps/desktop/src/renderer/App.tsx
@@ -2,7 +2,7 @@ import { GuideContent, LibraryContent, navigate, SearchModal, TooltipProvider, T
import { useEffect, useState } from 'react';
import { CaptureSheet } from './CaptureSheet';
import { GuideZoom } from './GuideZoom';
-import { SettingsPanel } from './settings/SettingsPanel';
+import { SettingsDialog } from './settings/SettingsDialog';
export function App() {
const route = useRoute();
@@ -27,18 +27,13 @@ export function App() {
<TopNav
route={route}
onSettings={library ? () => setSettingsOpen(true) : undefined}
- onNavigate={() => setSettingsOpen(false)}
guideActions={
route.page === 'guide' ? (
<GuideZoom guideId={route.guideId} onDone={() => setGuideKey((n) => n + 1)} />
) : undefined
}
/>
- {settingsOpen ? (
- <main className="flex-1 min-h-0">
- <SettingsPanel />
- </main>
- ) : route.page === 'guide' ? (
+ {route.page === 'guide' ? (
<main className="flex-1 py-10 px-6">
<div className="mx-auto max-w-[780px]">
<GuideContent
@@ -55,6 +50,7 @@ export function App() {
</main>
)}
<SearchModal />
+ <SettingsDialog open={settingsOpen} onOpenChange={setSettingsOpen} />
{sheetOpen && <CaptureSheet onClose={() => setSheetOpen(false)} />}
</div>
</TooltipProvider>
diff --git a/apps/desktop/src/renderer/settings/SettingsDialog.tsx b/apps/desktop/src/renderer/settings/SettingsDialog.tsx
new file mode 100644
index 0000000..2ac6846
--- /dev/null
+++ b/apps/desktop/src/renderer/settings/SettingsDialog.tsx
@@ -0,0 +1,16 @@
+import { i18n } from '@mimik/core/env';
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@mimik/ui';
+import { SettingsPanel } from './SettingsPanel';
+
+export function SettingsDialog({ open, onOpenChange }: { open: boolean; onOpenChange: (open: boolean) => void }) {
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent aria-describedby={undefined} className="gap-0 overflow-hidden p-0 sm:max-w-[880px]">
+ <DialogHeader className="border-b border-border px-6 py-4">
+ <DialogTitle className="text-[15px] font-bold">{i18n.t('settings_title')}</DialogTitle>
+ </DialogHeader>
+ <SettingsPanel />
+ </DialogContent>
+ </Dialog>
+ );
+}
diff --git a/apps/desktop/src/renderer/settings/SettingsPanel.tsx b/apps/desktop/src/renderer/settings/SettingsPanel.tsx
index f45b4df..dc45211 100644
--- a/apps/desktop/src/renderer/settings/SettingsPanel.tsx
+++ b/apps/desktop/src/renderer/settings/SettingsPanel.tsx
@@ -1,7 +1,7 @@
import { validateApiKey } from '@mimik/core/capture/ai/validate';
import { i18n } from '@mimik/core/env';
import { AiSettings, Switch, useKeyCheck } from '@mimik/ui';
-import { AppWindow, Command, Crop, Keyboard, Monitor, MonitorPlay, MousePointerClick } from 'lucide-react';
+import { AppWindow, Command, Crop, Keyboard, Monitor, MonitorPlay, MousePointerClick, Sparkles } from 'lucide-react';
import { useEffect, useState } from 'react';
import type { CaptureSettings, CaptureShortcuts } from '../../main/capture/settings';
import { Card } from './Card';
@@ -14,10 +14,10 @@ import { Slider } from './Slider';
type Section = 'capture' | 'ai' | 'shortcuts';
-const SECTIONS: { id: Section; labelKey: string }[] = [
- { id: 'capture', labelKey: 'desktop_capturingSection' },
- { id: 'ai', labelKey: 'settings_aiDescriptions' },
- { id: 'shortcuts', labelKey: 'desktop_shortcutsSection' },
+const SECTIONS: { id: Section; labelKey: string; Icon: typeof AppWindow }[] = [
+ { id: 'capture', labelKey: 'desktop_capturingSection', Icon: MonitorPlay },
+ { id: 'ai', labelKey: 'settings_aiDescriptions', Icon: Sparkles },
+ { id: 'shortcuts', labelKey: 'desktop_shortcutsSection', Icon: Command },
];
const MODES: { id: CaptureSettings['captureMode']; labelKey: string; Icon: typeof AppWindow }[] = [
@@ -46,29 +46,27 @@ export function SettingsPanel() {
};
return (
- <div className="flex h-full">
- <nav className="w-56 shrink-0 border-r border-border bg-secondary/25 p-3">
- <p className="px-3 pb-2.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">
- {i18n.t('settings_title')}
- </p>
+ <div className="flex h-[min(650px,80vh)]">
+ <nav className="w-[210px] shrink-0 border-r border-border bg-secondary/25 p-3">
{SECTIONS.map((item) => (
<button
key={item.id}
type="button"
onClick={() => setSection(item.id)}
- className={`mb-0.5 flex h-9 w-full items-center rounded-[9px] px-3 text-left text-sm transition-colors ${
+ className={`mb-0.5 flex h-9 w-full items-center gap-2.5 rounded-[9px] px-3 text-left text-sm transition-colors ${
section === item.id
? 'bg-secondary font-semibold text-foreground'
: 'text-foreground hover:bg-secondary/60'
}`}
>
+ <item.Icon size={15} className={section === item.id ? 'text-accent' : 'text-muted-foreground'} />
{i18n.t(item.labelKey)}
</button>
))}
</nav>
- <div className="min-w-0 flex-1 overflow-y-auto px-10 py-8">
- <div className="mx-auto flex max-w-[640px] flex-col gap-4">
+ <div className="min-w-0 flex-1 overflow-y-auto px-6 py-5">
+ <div className="flex flex-col gap-3.5">
{section === 'ai' && <AiSettings keyCheck={keyCheck} />}
{section === 'capture' && settings && (
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index 593e3f8..b52ded4 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -24,6 +24,7 @@ export {
MASCOT_VIEW_BOX,
} from './common/lib/mascot-shapes';
export { Button } from './components/ui/button';
+export { Dialog, DialogContent, DialogHeader, DialogTitle } from './components/ui/dialog';
export { Input } from './components/ui/input';
export { Popover, PopoverContent, PopoverTrigger } from './components/ui/popover';
export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './components/ui/select';
diff --git a/packages/ui/src/navigation/components/TopNav.tsx b/packages/ui/src/navigation/components/TopNav.tsx
index 98a781d..541fc28 100644
--- a/packages/ui/src/navigation/components/TopNav.tsx
+++ b/packages/ui/src/navigation/components/TopNav.tsx
@@ -25,7 +25,6 @@ import type { Route } from '../types';
interface TopNavProps {
route: Route;
onSettings?: () => void;
- onNavigate?: () => void;
guideActions?: ReactNode;
}
@@ -37,7 +36,7 @@ const navItems = [
const NAV_CONTROL = 'h-8 rounded-lg border border-border bg-card text-foreground hover:bg-secondary hover:text-accent';
-export function TopNav({ route, onSettings, onNavigate, guideActions }: TopNavProps) {
+export function TopNav({ route, onSettings, guideActions }: TopNavProps) {
const {
counts,
guideTitle,
@@ -80,10 +79,7 @@ export function TopNav({ route, onSettings, onNavigate, guideActions }: TopNavPr
<header className="flex items-center gap-5 px-7 h-16 shrink-0 bg-card border-b border-border">
{/* Brand */}
<button
- onClick={() => {
- onNavigate?.();
- navigate({ page: 'library', category: 'all' });
- }}
+ onClick={() => navigate({ page: 'library', category: 'all' })}
className="flex items-center gap-2 mr-4 cursor-pointer h-full"
>
<div className="mb-1">
@@ -117,10 +113,7 @@ export function TopNav({ route, onSettings, onNavigate, guideActions }: TopNavPr
return (
<button
key={item.key}
- onClick={() => {
- onNavigate?.();
- navigate({ page: 'library', category: item.key });
- }}
+ onClick={() => navigate({ page: 'library', category: item.key })}
className={`flex items-center gap-1.5 text-[13px] h-8 px-3 rounded-md transition-all
${active ? 'bg-primary text-primary-foreground font-semibold' : 'text-foreground font-medium hover:bg-secondary'}`}
>