Repository navigation
Add date picker and shortcuts to @mention system - #357
Merged
Merged
Conversation
malibio
force-pushed
the
feature/issue-201-date-picker-shortcuts
branch
from
October 30, 2025 23:46
c02e1bf to
a623a4b
Compare
Enhance the @mention autocomplete with date-specific functionality: - Add date shortcuts (Today/Tomorrow/Yesterday) at top of autocomplete - Add "Date (pick)" option that opens date picker modal - Create DatePickerModal component with native HTML date input - Implement date formatting utilities (YYYY-MM-DD) - Add DateNode creation/retrieval logic using backendAdapter - Date shortcuts filter based on user's query text - Date references inserted as markdown links: [YYYY-MM-DD](nodespace://YYYY-MM-DD) All quality checks passing. Closes #201 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
ROOT CAUSE: - Code was trying to create date nodes in the database when selecting from autocomplete - This caused UNIQUE constraint errors because dates are virtual (conceptually exist for all dates) - Date nodes only get persisted when children/content are added FIX: - Remove unnecessary database creation in handleDateSelection() - Just insert markdown link directly: [@today](nodespace://2025-10-30) - Remove unused createDateNode() function DESIGN IMPROVEMENTS: - Add ChevronRight icon to "Select date >" item for visual consistency - Align chevron to the right of the item using flexbox layout - Position date picker as submenu relative to "Select date" item - Add reactive effect to close date picker when autocomplete closes - Fix TypeScript linting warnings with proper type assertions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Use bind:value instead of onValueChange for Calendar component (Svelte 5 $bindable pattern) - Add $effect to watch selectedCalendarDate and trigger date selection - Change label from "Select date >" to "Select date..." per user feedback 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
WHAT WORKS ✅:
- Date shortcuts (Today/Tomorrow/Yesterday) insert links correctly
- UNIQUE constraint error fixed (dates are virtual, no DB creation)
- ChevronRight icon on "Select date..."
- Calendar renders and displays all dates properly
- Picker closes when date clicked
WHAT DOESN'T WORK ❌:
- onValueChange callback never fires when clicking calendar dates
- No link created from calendar selection
- Debug logs confirm callback not being invoked
VERIFIED VIA CHROME DEVTOOLS:
- Typed @ → autocomplete appeared
- Clicked "Select date..." → calendar opened with full date grid
- Clicked October 1 → calendar closed
- NO console logs from onValueChange callback
IMPLEMENTATION:
base-node.svelte:954:
<Calendar type="single" bind:value={selectedCalendarDate} onValueChange={(v) => {...}} />
calendar.svelte:
Wrapper passes props via {...restProps} to CalendarPrimitive.Root
ROOT CAUSE:
CalendarPrimitive.Root (bits-ui) not calling onValueChange despite prop being passed
NEXT INVESTIGATION:
1. Why bits-ui Calendar doesn't fire onValueChange in Svelte 5
2. Is wrapper's "as never" cast breaking callback?
3. Check bits-ui version compatibility
4. Try bypassing wrapper entirely
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
PROBLEM SOLVED: - Calendar rendered but date selection never created links - Clicking dates closed calendar with no value captured - bind:value wasn't updating selectedCalendarDate ROOT CAUSES FIXED: 1. Calendar wrapper wasn't forwarding type="single" prop to bits-ui primitive 2. Clicking calendar caused textarea to blur, exiting edit mode and destroying controller SOLUTION: - Explicitly extract and forward type prop in calendar wrapper - Add intermediate state binding bridge (internalValue) in wrapper - Prevent blur with onmousedown handler (industry standard pattern) - Use Svelte 5 reactive $effect to watch selectedCalendarDate changes - Fix date formatting to use local timezone (not UTC) IMPLEMENTATION: - Calendar component: Added type prop extraction and handleValueChange bridge - BaseNode: Added onmousedown preventDefault to maintain edit mode during selection - Used same pattern as NodeAutocomplete (line 262) for consistency - Added ARIA role=dialog and tabindex for accessibility TESTING: - All 471 existing tests passing - Manual testing confirms date links created correctly - Date shortcuts (Today/Tomorrow/Yesterday) still work - No regressions detected Fixes #201 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
IMPROVEMENTS IMPLEMENTED: 1. Icon Registry - Added explicit 'date' node type registration 2. Documentation - Added comprehensive docs for calendar value binding workaround 3. Type Safety - Added submenuPosition to NodeResult interface (removed type assertions) 4. Code Cleanup - Removed unused DatePickerModal component 5. Performance - Memoized DATE_SHORTCUTS array to avoid recreation 6. Accessibility - Enhanced ARIA labels with keyboard navigation hints 7. Test Coverage - Added 28 comprehensive tests for date picker functionality DETAILS: Icon Registry (registry.ts): - Added 'date' node type using CircleIcon with ring effect - Dates can have children (journal entries, notes, etc.) - Uses consistent color theming (--node-date CSS variable) Calendar Binding Documentation (calendar.svelte): - Documented bridge pattern workaround for bits-ui Svelte 5 limitation - Explained why 'as never' casts are necessary (discriminated union conflicts) - Added TODO for revisiting when bits-ui has full Svelte 5 support Type Safety (node-autocomplete/index.ts): - Added submenuPosition field to NodeResult interface - Removed type assertion in node-autocomplete.svelte - Synchronized local and exported NodeResult interfaces Code Cleanup: - Removed unused date-picker-modal.svelte and index.ts - Removed empty date-picker directory Performance Optimization (base-node.svelte): - Extracted DATE_SHORTCUTS to module-level const with readonly type - Prevents array recreation on every getDateShortcuts() call - Micro-optimization with zero risk Accessibility (base-node.svelte): - Enhanced aria-label with keyboard navigation instructions - Added aria-modal="true" for proper screen reader announcement - Maintains existing role="dialog" semantic structure Test Coverage (date-picker.test.ts): - 28 comprehensive tests covering all date picker functionality - Date formatting with timezone handling (local vs UTC) - Date shortcut filtering (Today/Tomorrow/Yesterday) - Date calculation from shortcuts with boundary handling - Virtual date node pattern (markdown links without DB) - NodeResult interface extension validation - Accessibility attributes verification - Edge cases (leap years, month boundaries, immutability) All tests pass (28/28), quality checks pass (0 errors, 0 warnings). Addresses ALL reviewer recommendations from pragmatic code review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
malibio
force-pushed
the
feature/issue-201-date-picker-shortcuts
branch
from
October 31, 2025 00:01
a623a4b to
07ae007
Compare
malibio
added a commit
that referenced
this pull request
Feb 4, 2026
…ortcuts Add date picker and shortcuts to @mention system
malibio
added a commit
that referenced
this pull request
Feb 5, 2026
…ortcuts Add date picker and shortcuts to @mention system
malibio
added a commit
that referenced
this pull request
Feb 26, 2026
…ortcuts Add date picker and shortcuts to @mention system
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a working calendar date picker for the @mention autocomplete system with date shortcuts.
Features Implemented
Technical Details
Root Causes Fixed:
type="single"prop - Not forwarded to bits-ui primitiveSolutions:
Calendar wrapper improvements (
calendar.svelte):typepropinternalValuehandleValueChangepropagationPrevent blur during interaction (
base-node.svelte):onmousedownwithpreventDefault()to calendar containerClean Svelte 5 reactivity (
base-node.svelte):selectedCalendarDatechangesformatDate()Files Changed
packages/desktop-app/src/lib/components/ui/calendar/calendar.svelte- Fixed prop forwardingpackages/desktop-app/src/lib/components/ui/calendar/calendar-day.svelte- Cleaned up debug codepackages/desktop-app/src/lib/design/components/base-node.svelte- Calendar integrationTesting
Closes #201
🤖 Generated with Claude Code