Repository navigation
Description
Add Date Picker and Shortcuts to @mention System
Overview
Enhance the @mention autocomplete system with date-specific functionality including a date picker and quick shortcuts for Today/Tomorrow/Yesterday.
Context
This work was deferred from issue #199 to keep the core container node refactoring focused. The @mention system now properly supports discovering all node types, and this issue adds the final date-related UX enhancements.
Requirements
1. Date Shortcuts in Autocomplete
Add shortcuts at the top of @mention results that always appear (filtered by query):
@Today→ Creates/links to today's DateNode (YYYY-MM-DD format)@Tomorrow→ Creates/links to tomorrow's DateNode@Yesterday→ Creates/links to yesterday's DateNodeDate (pick)→ Opens date picker modal
Implementation Location: packages/desktop-app/src/lib/design/components/base-node.svelte
const dateShortcuts = [
{ id: 'today', title: 'Today', type: 'date', isShortcut: true },
{ id: 'tomorrow', title: 'Tomorrow', type: 'date', isShortcut: true },
{ id: 'yesterday', title: 'Yesterday', type: 'date', isShortcut: true },
{ id: 'date-picker', title: 'Date (pick)', type: 'date', isShortcut: true },
].filter(shortcut =>
shortcut.title.toLowerCase().includes(query.toLowerCase())
);
// Combine: shortcuts first, then search results
autocompleteResults = [...dateShortcuts, ...searchResults];2. Date Picker Integration
When user selects "Date (pick)" from @mention:
- Close autocomplete modal
- Show date picker popover at cursor position
- Use calendar component from
@nodespace/design-system - On date selection:
- Format as YYYY-MM-DD
- Create DateNode if it doesn't exist (using
create_container_node) - Insert reference like
[2025-10-15](nodespace://2025-10-15)
Component: Use calendar from packages/design-system/src/lib/components/ui/calendar/
import { Calendar } from '@nodespace/design-system';3. Date Formatting Logic
Convert shortcuts to actual dates:
function getDateFromShortcut(shortcut: string): string {
const today = new Date();
switch (shortcut) {
case 'today':
return formatDate(today);
case 'tomorrow':
const tomorrow = new Date(today);
tomorrow.setDate(today.getDate() + 1);
return formatDate(tomorrow);
case 'yesterday':
const yesterday = new Date(today);
yesterday.setDate(today.getDate() - 1);
return formatDate(yesterday);
default:
return formatDate(today);
}
}
function formatDate(date: Date): string {
return date.toISOString().split('T')[0]; // YYYY-MM-DD
}4. DateNode Creation
Use the new create_container_node Rust command from #199:
await invoke('create_container_node', {
input: {
content: dateStr, // e.g., "2025-10-15"
nodeType: 'date',
properties: {},
mentionedBy: currentNodeId // Optional: current node mentions this date
}
});Acceptance Criteria
- Date shortcuts (Today/Tomorrow/Yesterday) appear at top of @mention results
- Date shortcuts filter based on user's query text
- "Date (pick)" option opens calendar picker at cursor position
- Calendar picker allows selecting any date
- Selected date creates DateNode if it doesn't exist
- Date reference is inserted as markdown link:
[YYYY-MM-DD](nodespace://YYYY-MM-DD) - Clicking date reference navigates to that date's page
- All tests passing
- Quality checks passing
Technical Notes
Calendar Positioning
The date picker should appear near the cursor position, similar to how the autocomplete modal works. Use the same positioning logic from node-autocomplete.svelte.
DateNode Existence Check
Before creating a DateNode, check if it already exists:
const existingNode = await invoke('get_node', { id: dateStr });
if (!existingNode) {
await invoke('create_container_node', { input: { ... } });
}Visual Design
- Date shortcuts should have a calendar icon
- "Date (pick)" should be visually distinct (perhaps with a different color or icon)
- Calendar picker should match the design system's theming
Dependencies
- Issue Complete @mention system with container node refactoring #199 (container node pattern) - ✅ Complete
- Design system calendar component - Available in
packages/design-system
Related Files
packages/desktop-app/src/lib/design/components/base-node.svelte- Main implementationpackages/desktop-app/src/lib/components/ui/node-autocomplete/node-autocomplete.svelte- Autocomplete UIpackages/design-system/src/lib/components/ui/calendar/- Calendar component
Priority
Medium - UX enhancement that improves date node discovery and creation
Activity
Fix autocomplete click test and add container node search tests
Refactor: Extract autocomplete filter logic to NodeSearchService
Add date picker and shortcuts to @mention system
Add date picker and shortcuts to @mention system
Fix calendar date picker - working implementation for @mention system
Add date picker and shortcuts to @mention system
Fix calendar date picker - working implementation for @mention system
Fix autocomplete click test and add container node search tests
Refactor: Extract autocomplete filter logic to NodeSearchService
Add date picker and shortcuts to @mention system
Fix calendar date picker - working implementation for @mention system
Fix autocomplete click test and add container node search tests
Refactor: Extract autocomplete filter logic to NodeSearchService
Add date picker and shortcuts to @mention system
Fix calendar date picker - working implementation for @mention system
Fix autocomplete click test and add container node search tests
Refactor: Extract autocomplete filter logic to NodeSearchService
Add date picker and shortcuts to @mention system
Fix calendar date picker - working implementation for @mention system