Commit Graph

299 Commits

Author SHA1 Message Date
lucaronin
af94280e4d refactor: decompose NoteList into focused components and extract helpers
Break up NoteListInner (cc=61, 331 LoC, score 6.94) into:
- NoteItem: extracted item rendering component (score 9.63)
- SortDropdown: extracted into own file (score 9.68)
- noteListHelpers.ts: all utility functions (score 10.0)
  - GroupBuilder class replaces 5-arg addResolvedGroup
  - filterEntries split into filterByKind/filterByFilterType
- PinnedCard: unified entity/type document cards
- RelationshipGroupSection: extracted group rendering
- NoteList.tsx: orchestration only (score 8.79)

NoteListInner reduced from cc=61 to cc=23, 331 → 105 LoC.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 10:18:05 +01:00
lucaronin
2692ca4a8b refactor: extract useTabManagement hook and mock frontmatter helpers from useNoteActions
Break up the monolithic useNoteActions hook (cc=37, 232 LoC, score 6.89) into:
- useTabManagement: owns tab state and all tab operations (score 9.53)
- mockFrontmatterHelpers: extracted and simplified YAML manipulation (score 9.09+)
- useNoteActions: now focused on note creation and frontmatter operations (score 9.22)

Key improvements:
- Extracted entryMatchesTarget() to reduce wikilink matching complexity
- Deduplicated replaceKeyInLines/removeKeyFromLines into processKeyInLines
- Converted buildNewEntry to use object param (was 5 positional args)
- Overall complexity reduced from cc=37 to cc=11 in useNoteActions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 10:11:52 +01:00
lucaronin
752df01bf1 design: merge git-history frames into ui-design.pen 2026-02-22 10:02:38 +01:00
lucaronin
df3e4a787e feat: git history — clickable commit hashes with diff view 2026-02-22 10:02:35 +01:00
lucaronin
8d75702087 design: merge archive-notes-button frames into ui-design.pen 2026-02-22 10:02:20 +01:00
lucaronin
b0657bc3f5 feat: archive notes button + cmd+e shortcut 2026-02-22 10:02:17 +01:00
lucaronin
ccf7a440f4 fix: add back-to-editor navigation from commit diff view
When viewing a commit diff from git history, the GitBranch toggle in the
breadcrumb bar was disabled if the file had no unstaged changes, leaving
no way to return to the editor. Now the toggle stays active whenever
diffMode is true, and a visible "Back to editor" button appears at the
top of the diff view for better discoverability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 09:47:41 +01:00
lucaronin
800e89dd06 design: git-history wireframes
Two frames added to design/git-history.pen:
- "Git History — Commit List": shows inspector panel with clickable
  hashes (primary color, underlined), relative dates, commit messages,
  and author name (muted, small) on each commit row
- "Git History — Diff Open": shows diff view with breadcrumb bar
  displaying file path and commit badge, plus colored diff lines
  (red for removed, green for added)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:31:45 +01:00
lucaronin
d23ce5a0b5 feat: clickable commit hashes in git history panel open diff view
- Add get_file_diff_at_commit Rust command to show diff at a specific commit
- Make shortHash in GitHistoryPanel a clickable button that opens DiffView
- Show author name below commit message (small, muted)
- Remove disabled "View all revisions" button
- Wire onLoadDiffAtCommit through Editor → Inspector → App.tsx
- Add mock handler for get_file_diff_at_commit in browser mode
- Fix pre-existing missing `order` field on trashed mock entries
- Update Inspector tests for new behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:27:18 +01:00
lucaronin
7effa256b4 feat: enable adding new relationships from the properties panel 2026-02-21 22:14:15 +01:00
lucaronin
5ecfea10f0 feat: change macOS window frame color to match sidebar 2026-02-21 19:12:18 +01:00
lucaronin
37c9164278 feat: set macOS window frame color to match sidebar background
Set the window backgroundColor to #F7F6F3 (same as --sidebar CSS variable)
in the Tauri window config. With titleBarStyle "Transparent", this makes
the native macOS title bar area match the sidebar background color instead
of defaulting to white.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 19:11:37 +01:00
lucaronin
9ffe1eb3ba feat: truncate long property values with ellipsis instead of wrapping 2026-02-21 19:08:17 +01:00
lucaronin
d9a406e926 fix: truncate long property values with ellipsis instead of wrapping
Add `truncate` and `min-w-0` Tailwind classes to property value elements
in the properties panel so long text is shown on a single line with
ellipsis. The full value is visible via the title attribute on hover.

Affected elements:
- EditableValue display span (main property values)
- Status pill in DynamicPropertiesPanel
- Type button in DynamicPropertiesPanel

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 19:07:41 +01:00
lucaronin
fb3cdf2bab design: merge customize-sections-design frames into ui-design.pen 2026-02-21 19:01:52 +01:00
lucaronin
cadc284432 feat: improve customize sections design — Sections label with icon right-aligned 2026-02-21 19:01:41 +01:00
lucaronin
8bcae95e3f feat: wiki-links in editor inherit type color instead of always blue 2026-02-21 19:00:12 +01:00
lucaronin
4d457b5f6e design: archive notes button wireframes
Add two frames to design/archive-notes-button.pen:
- "Archive Notes — Breadcrumb button (normal note)" — shows Archive icon
- "Archive Notes — Breadcrumb button (archived note, shows Unarchive)" — shows
  ArrowUUpLeft icon with ARCHIVED badge in breadcrumb

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 18:46:45 +01:00
lucaronin
4b75eb46b6 feat: archive button in breadcrumbs bar + cmd+e shortcut
Add archive/unarchive toggle button to the BreadcrumbBar (Archive icon
for normal notes, ArrowUUpLeft icon for archived notes). Add cmd+e
keyboard shortcut to toggle archive state of the active note.

Refactored useAppKeyboard to use action map pattern (reduces cyclomatic
complexity) and extracted BreadcrumbActions from BreadcrumbBar to split
rendering complexity across two functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 18:45:25 +01:00
lucaronin
540a2d8123 design: customize-sections-design wireframes
Added before/after frames to design/customize-sections-design.pen showing
the sidebar section header redesign:
- Before: "Customize sections" button with inline icon + text
- After: "SECTIONS" uppercase heading label with settings icon right-aligned

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 18:42:22 +01:00
lucaronin
770937affd fix: properties panel fills full window height 2026-02-21 18:41:20 +01:00
lucaronin
6e20244078 fix: properties panel fills full window height
The Inspector aside element was missing flex-1, so it only grew to
its content height instead of filling the full height of its parent
flex-col container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 18:40:45 +01:00
lucaronin
081f1e5743 feat: replace 'Customize Sections' label with 'Sections' header
Changed the sidebar section header from a button-style "Customize sections"
label with inline icon to a clean "Sections" heading with the settings icon
pushed to the far right. The settings icon still toggles the customize
popover — no functionality change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 18:40:06 +01:00
lucaronin
96252b66eb design: merge draggable-section-groups frames into ui-design.pen 2026-02-21 18:36:34 +01:00
lucaronin
cc1631c368 feat: draggable section groups in sidebar 2026-02-21 18:36:28 +01:00
lucaronin
79ada08275 design: merge draggable-tabs frames into ui-design.pen 2026-02-21 18:35:19 +01:00
lucaronin
66754c2dcd feat: draggable tabs with localStorage persistence 2026-02-21 18:35:13 +01:00
lucaronin
b46baaae10 design: merge trash-notes frames into ui-design.pen 2026-02-21 18:34:55 +01:00
lucaronin
09609eff55 feat: trash notes — sidebar filter, breadcrumb buttons, cmd+del shortcut, demo vault data 2026-02-21 18:34:40 +01:00
lucaronin
3752a0be0f test: add breadcrumb trash/restore button tests
Tests verify:
- Trash button shows for non-trashed notes
- Restore button shows for trashed notes
- onClick callbacks fire correctly for both

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:37:53 +01:00
lucaronin
d475143e8a feat: breadcrumb trash/restore buttons and cmd+del shortcut
- Added trash icon button in breadcrumb bar for non-trashed notes
- Added restore (arrow counter-clockwise) button for trashed notes
- Trash button sets trashed=true and trashed_at in frontmatter
- Restore button removes trashed/trashed_at from frontmatter
- Added Cmd+Delete keyboard shortcut to trash active note
- Wired handlers through Editor -> App with vault entry updates
- Toast notifications for trash/restore actions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:37:15 +01:00
lucaronin
3764bbd14b feat: add trashed notes to demo vault
Added 3 trashed notes with trashed_at dates in frontmatter:
- note-old-meeting-notes.md (trashed 2026-02-10)
- note-deprecated-workflow.md (trashed 2026-01-15)
- experiment-failed-podcast.md (trashed 2026-02-05)

These provide realistic test data for the trash feature in the demo vault.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:34:35 +01:00
lucaronin
a10589fb6c fix: sidebar collapse toggle and update tests for DnD
- Fix toggleSection to account for default collapsed state
  (collapsed[type] ?? true, not just !prev[type])
- Update tests to expand sections before asserting item visibility
  (sections start collapsed by default)
- Add tests for section ordering by Type entry order property
- Add test for drag handle rendering on section headers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:33:36 +01:00
lucaronin
f805c7d1bf feat: draggable section groups in sidebar
- Wrap sidebar section groups in @dnd-kit sortable context
- Add grip-vertical drag handle visible on hover of section headers
- Sort sections by `order` property from Type document entries
- On drag end, compute new sequential order values and persist to
  each Type document's frontmatter via handleReorderSections
- Add onReorderSections callback from Sidebar → App.tsx → vault

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:29:42 +01:00
lucaronin
1dfbbb8a9e feat: add order property to VaultEntry and install @dnd-kit
- Add `order: number | null` to VaultEntry (TS) and VaultEntry (Rust)
- Add order to Frontmatter struct and SKIP_KEYS in vault.rs
- Update all mock Type documents with order values (0-10)
- Add order: null to all non-Type mock entries and test fixtures
- Install @dnd-kit/core, @dnd-kit/sortable, @dnd-kit/utilities

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:27:19 +01:00
lucaronin
f929c51445 test: add TabBar drag-and-drop unit tests
Tests cover: rendering all tabs, draggable attribute, reorder on DnD,
no-op when dropping in same position, and tab switching on click.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:24:46 +01:00
lucaronin
d8283184c1 feat: draggable tabs with localStorage persistence
- TabBar: HTML5 drag-and-drop on tab elements (grab/grabbing cursor,
  0.5 opacity on dragged tab, 2px primary-color drop indicator)
- useNoteActions: handleReorderTabs splices tab array, saves order
  to localStorage under "laputa-tab-order" key
- Tab order auto-persists on every change; restored on mount
- Wired through Editor → App props chain

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:24:01 +01:00
lucaronin
004201cdc8 fix: tauri devUrl to match vite port 5201 2026-02-21 17:23:26 +01:00
lucaronin
580ce5bcc0 design: draggable section groups wireframes
Three frames showing drag interaction flow:
1. Default sidebar with grip-vertical drag handles on section headers
2. Mid-drag state with blue drop indicator line and floating section overlay
3. After-drop state showing reordered sections

Order persisted as "order" property in Type document frontmatter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:21:49 +01:00
lucaronin
f8cc097a58 design: draggable tabs wireframes
Three frames added to design/draggable-tabs.pen:
1. Default state — tabs with grab cursor hint
2. Dragging state — tab at 0.5 opacity, 2px primary-color drop indicator
3. After drop — reordered tabs, localStorage persistence note

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:21:38 +01:00
lucaronin
1071daef7d feat: purge_trash() — auto-delete notes trashed for 30+ days on startup 2026-02-21 17:15:01 +01:00
lucaronin
f4feac3b08 feat: sort notes by property in relationship subsections 2026-02-21 17:14:18 +01:00
lucaronin
af40fba1b0 feat: add purge_trash command to delete stale trashed files
Adds purge_trash(vault_path) that scans all .md files, reads the
"Trashed at" frontmatter date, and deletes files older than 30 days.
Registered as a Tauri command and called automatically on app startup
(defaults to ~/Laputa vault). Includes 7 tests covering boundary
conditions, nested dirs, and datetime formats.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:14:02 +01:00
lucaronin
c1102c508a content: add createdAt values and varied statuses to mock data
All MOCK_ENTRIES now have realistic createdAt timestamps (always before
modifiedAt). Stock Screener status changed to 'Paused' for sort-by-status
testing variety.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:12:53 +01:00
lucaronin
74649f29c5 test: add tests for sort notes functionality
Tests for getSortComparator (6 tests):
- Sort by modified date descending
- Sort by created date descending (with fallback)
- Sort by title alphabetically
- Sort by status with priority ordering
- Status sort with modified-date tiebreaker

Tests for NoteList sort controls (6 tests):
- Sort button visible in flat list header
- Sort dropdown per relationship subsection
- Sort menu opens with all options
- Sort order changes on option selection
- Menu closes after selection
- Relationship subsection sorting works

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:12:45 +01:00
lucaronin
5a8952c290 feat: sort notes by property in relationship subsections
Each relationship subsection header now has a sort dropdown control
(ArrowsDownUp icon + current sort label). Users can choose to sort by:
- Modified date (default, newest first)
- Created date (newest first)
- Title (alphabetical A-Z)
- Status (Active > Paused > Done > Finished)

The sort control also appears in the main note list header for flat
list views. Sort preferences are persisted per group in localStorage.

Also updates mock data with varied createdAt/status values for testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:09:29 +01:00
lucaronin
4868972093 design: sort-notes wireframes
Two feature frames added:
- "Sort Notes — picker closed": default state with sort button in subsection header
- "Sort Notes — picker open": dropdown popover with sort options (Modified, Created, Title, Status)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:08:39 +01:00
lucaronin
9a627c7295 fix: editor content not appearing on first load (flushSync lifecycle fix) 2026-02-21 17:08:00 +01:00
lucaronin
01c89f3646 test: regression tests for flushSync-in-lifecycle editor bug
Add unit test verifying content blocks are applied via deferred microtask
(not synchronously in useEffect). Convert debug E2E test into a proper
regression test that checks editor content appears after clicking a note
and no flushSync errors are logged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:07:30 +01:00
lucaronin
1c0e471839 design: sort-notes wireframes
Shows sort control UI for relationship subsection headers:
- Default state: sort icon + current sort label in header bar
- Open state: dropdown popover with options (Modified, Created, Title, Status)
- Selected option highlighted with check icon

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 17:06:30 +01:00