style: consolidate layout tracking UI into SpellbookDropdown

This commit is contained in:
Alejandro Gómez
2025-12-20 21:18:52 +01:00
parent d59a7aee8b
commit 33d53efba8
2 changed files with 10 additions and 18 deletions

View File

@@ -26,14 +26,12 @@ import { Button } from "./ui/button";
const PREVIEW_BACKUP_KEY = "grimoire-preview-backup";
export default function Home() {
const { state, updateLayout, removeWindow, loadSpellbook, clearActiveSpellbook } = useGrimoire();
const { state, updateLayout, removeWindow, loadSpellbook } = useGrimoire();
const [commandLauncherOpen, setCommandLauncherOpen] = useState(false);
const { actor, identifier } = useParams();
const navigate = useNavigate();
const location = useLocation();
const activeSpellbook = state.activeSpellbook;
// Preview state
const [resolvedPubkey, setResolvedPubkey] = useState<string | null>(null);
const isPreviewPath = location.pathname.startsWith("/preview/");
@@ -247,19 +245,6 @@ export default function Home() {
<div className="flex items-center gap-2">
<SpellbookDropdown />
{activeSpellbook && !isPreviewPath && (
<div className="flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted/50 border border-border animate-in fade-in zoom-in duration-300">
<span className="text-[10px] font-bold text-muted-foreground uppercase tracking-tight">Active:</span>
<span className="text-xs font-medium truncate max-w-[150px]">{activeSpellbook.title}</span>
<button
onClick={clearActiveSpellbook}
className="ml-1 p-0.5 hover:bg-background rounded-full text-muted-foreground hover:text-foreground transition-colors"
title="Clear active spellbook context"
>
<X className="size-3" />
</button>
</div>
)}
</div>
<UserMenu />