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 πŸ“–

fix(desktop): leave settings when the header navigates

Luis Ortiz1edd609b6551
diff --git a/AGENTS.md b/AGENTS.md
index 666066f..c66b85e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -738,7 +738,12 @@ news. It went, along with the second bar under it, which halved the chrome from
`TopNav` takes only a `Route` and reads the rest from `useFullview`, which `GuideContent` already
fills, so the guide title, the step count and the export data arrive with no desktop wiring at all.
Its one desktop-only prop is `onSettings`: the extension has a browser options page and the desktop
-does not, so the gear exists here and only on the library route. Moving it brought `SearchModal`,
+does not, so the gear exists here and only on the library route. `onNavigate` is its counterpart and
+exists for one reason: settings is a boolean laid over the route rather than a route of its own, so
+the header could navigate underneath an open settings pane β€” the pill moved to Trash and the pane
+stayed. Firing it on the click rather than watching the route is deliberate, because clicking the
+already-active item produces no hash change and that is exactly the click that means "get me out of
+here". Moving it brought `SearchModal`,
`ExportPreviewModal`, `VideoStepPlayer` and two search components with it β€” each needed exactly two
import rewrites, `#imports` to `@mimik/core/env` and `@/core/*` to `@mimik/core/*`, because nothing
in them was ever extension-specific beyond how WXT resolves a module.
diff --git a/apps/desktop/src/renderer/App.tsx b/apps/desktop/src/renderer/App.tsx
index c6a9a25..d3c1723 100644
--- a/apps/desktop/src/renderer/App.tsx
+++ b/apps/desktop/src/renderer/App.tsx
@@ -27,7 +27,11 @@ export default function App() {
return (
<TooltipProvider>
<div className="min-h-screen flex flex-col bg-background">
- <TopNav route={route} onSettings={library ? () => setSettingsOpen(true) : undefined} />
+ <TopNav
+ route={route}
+ onSettings={library ? () => setSettingsOpen(true) : undefined}
+ onNavigate={() => setSettingsOpen(false)}
+ />
{settingsOpen ? (
<main className="flex-1 min-h-0">
<SettingsPanel onClose={() => setSettingsOpen(false)} />
diff --git a/packages/ui/src/fullview/TopNav.tsx b/packages/ui/src/fullview/TopNav.tsx
index 046601b..e6fb641 100644
--- a/packages/ui/src/fullview/TopNav.tsx
+++ b/packages/ui/src/fullview/TopNav.tsx
@@ -24,6 +24,7 @@ import ExportPreviewModal from './ExportPreviewModal';
interface TopNavProps {
route: Route;
onSettings?: () => void;
+ onNavigate?: () => void;
}
const navItems = [
@@ -34,7 +35,7 @@ const navItems = [
const NAV_CONTROL = 'h-8 rounded-lg border border-border bg-card text-foreground hover:bg-secondary hover:text-accent';
-export default function TopNav({ route, onSettings }: TopNavProps) {
+export default function TopNav({ route, onSettings, onNavigate }: TopNavProps) {
const {
counts,
guideTitle,
@@ -77,7 +78,10 @@ export default function TopNav({ route, onSettings }: TopNavProps) {
<header className="flex items-center gap-5 px-7 h-16 shrink-0 bg-card border-b border-border">
{/* Brand */}
<button
- onClick={() => navigate({ page: 'library', category: 'all' })}
+ onClick={() => {
+ onNavigate?.();
+ navigate({ page: 'library', category: 'all' });
+ }}
className="flex items-center gap-2 mr-4 cursor-pointer h-full"
>
<div className="mb-1">
@@ -111,7 +115,10 @@ export default function TopNav({ route, onSettings }: TopNavProps) {
return (
<button
key={item.key}
- onClick={() => navigate({ page: 'library', category: item.key })}
+ onClick={() => {
+ onNavigate?.();
+ 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'}`}
>