From 2aa72738f4d407eecd55ce9da1a9feeb8a766b7f Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Mon, 14 Sep 2026 11:53:45 +0530 Subject: [PATCH] feat(sidebar): daily-notes panel + Q&A deep-link to file offset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Daily notes panel: - src/sidebar/daily-notes-panel.js — new sidebar panel that lists every YYYY-MM-DD.md in the daily-notes dir (newest first), with a Today button that creates/opens today's entry. Refresh button reloads. Clicking a row calls onOpenFile(path). DOM is built with textContent for dynamic fields — no XSS surface from a hostile filename. - src/main.js — daily-notes:list IPC now returns absolute paths (joined with the daily-notes dir) so the renderer can pass them straight to open-file-path without re-synthesizing. - src/renderer.js — registers the panel; icon for the daily-notes button (calendar icon). - src/index.html — calendar SVG icon for the daily-notes sidebar entry. Q&A deep-link: - src/main.js — open-file-path accepts either a string (legacy) or an object {path, offset}. The offset is forwarded to the renderer via file-opened. - src/renderer.js — file-opened handler scrolls the editor to the offset using EditorView.scrollIntoView(y: 'center') so the matching passage lands in the middle of the visible area. - search panel now passes {path, offset} to open-file-path so Q&A results with chunk offsets jump straight to the passage. Tests (12 new, tests/daily-notes-panel.test.js): - mount, empty state, list rendering - Today button → onOpenFile, 'Created today' / 'Today already exists' status - error paths (openToday reject, listExisting reject, listExisting missing) - click + Enter/Space on a row open the right path - refresh() re-fetches, keeps status when keepStatus:true - non-md entries filtered out - XSS-safe textContent for dynamic data Full suite: 73 suites, 873 tests, lint+format clean. Amit Haridas --- src/index.html | 18 ++++ src/main.js | 19 +++- src/renderer.js | 37 ++++++- src/sidebar/daily-notes-panel.js | 141 +++++++++++++++++++++++++ tests/daily-notes-panel.test.js | 175 +++++++++++++++++++++++++++++++ 5 files changed, 385 insertions(+), 5 deletions(-) create mode 100644 src/sidebar/daily-notes-panel.js create mode 100644 tests/daily-notes-panel.test.js diff --git a/src/index.html b/src/index.html index 0c21dcc..8488dcd 100644 --- a/src/index.html +++ b/src/index.html @@ -2574,6 +2574,24 @@ + +