Files
backnotprop__plannotator/obsidian-icon.svg
T
Michael Ramos 70dda029be feat(sidebar): merge vault browser into files tab + UX polish (#526)
* fix(annotate): add missing obsidian vault endpoints to annotate servers

Both the Bun and Pi annotate servers were missing the three Obsidian
reference endpoints (/api/obsidian/vaults, /api/reference/obsidian/files,
/api/reference/obsidian/doc), making the vault browser unavailable in
annotate mode. Added the handlers to both servers.

For provenance purposes, this commit was AI assisted.

* feat(sidebar): merge vault browser into files tab

Vault is conceptually just another directory — same tree UI, same
expand/collapse, same annotation counts. Rather than maintaining a
parallel tab and hook, vault now appears as a collapsible section
inside the Files tab alongside any other configured directories.

Changes:
- Add `isVault` flag to `DirState` and `addVaultDir()` to
  `useFileBrowser` — fetches from the Obsidian endpoint and stamps
  the dir so downstream code can route to the correct API
- Remove `useVaultBrowser` hook and `VaultBrowser` component entirely
- Remove `"vault"` from `SidebarTab` type
- Update `App.tsx`: drop all parallel vault state; wire vault into the
  combined file browser fetch effect; update `handleFileBrowserSelect`
  to pick the right URL builder based on `isVault`; update
  `handleOpenLinkedDoc` and annotation count derivation to cover vault
  dirs via the same path
- Fix sticky header lane: remove the `!linkedDocHook.isActive` gate
  that was suppressing sticky headers for linked docs and annotate mode
- Remove primary border on linked doc viewer card
- Add `ObsidianIcon` (full branded logo) and `ObsidianIconRaw`
  (compact purple mark) to `packages/ui/components/icons/ObsidianIcons.tsx`
- Display `ObsidianIconRaw` in the FileBrowser directory header for
  vault dirs

Net: -334 lines. One Files tab handles all directory types uniformly.

For provenance purposes, this commit was AI assisted.

* fix(sidebar): fix stale vault dirs and unrecoverable vault load failures

Three issues identified in review:

1. Switching vault paths accumulated stale sections — addVaultDir now
   atomically replaces all existing vault dirs instead of appending,
   so changing the configured vault never leaves a ghost section behind.

2. Disabling the vault left the old section visible until reload —
   a new clearVaultDirs() method prunes all isVault entries, called
   via a dedicated effect that fires whenever vaultPath becomes empty.

3. Vault load failures were unrecoverable in-session — the Retry button
   only called fetchAll(regularDirs). FileBrowser now accepts an
   onRetryVaultDir prop and routes vault dir retries to addVaultDir
   (which re-fetches from the Obsidian endpoint) instead of the
   regular-dirs-only fetchAll.

For provenance purposes, this commit was AI assisted.
2026-04-08 16:07:08 -07:00

5.4 KiB