Skip to content

Commit f7b9069

Browse files
jsonifyclaudegemini-code-assist[bot]
authored
feat: Template Browser Phase 5 - Interactive Enhancements (#98) (#106)
* feat: Template Browser Phase 5 - Interactive Enhancements (#98) Implemented all five Phase 5 interactive enhancements: 1. **Keyboard Navigation** - `/` to focus search input - `ESC` to clear search or close modals - Arrow keys (↑↓) for card navigation with visual focus - `Enter` to create note from focused card - `Space` to toggle preview on focused card - `F` to toggle favorite on focused card - `?` to show/hide keyboard shortcuts hint panel 2. **Favorites System** - Star button (⭐/☆) on each template card - Click to toggle favorite status - Persisted in VS Code webview state - Filter templates by favorites (Show Only dropdown) - Visual indicator for favorited templates 3. **Context Menus** - Right-click on any template card - Context-aware menu items: * Create Note * Preview * Add/Remove Favorites * Edit (custom templates only) * Duplicate (custom templates only) * Export * Copy Template ID * Delete (custom templates only) - Separators for logical grouping - Auto-positioning to prevent off-screen menus 4. **Empty State Guidance** - Context-aware messaging for different scenarios: * No templates at all (with refresh action) * No favorites selected (with "Show All" action) * No search results (with clear search action) * No results with filters (with clear all filters action) - Actionable buttons for quick navigation - Helpful guidance text for each scenario 5. **Usage Tracking** - Automatically increment usage_count when creating from template - Update last_used timestamp with ISO date - Persists to JSON template files - Enables sorting by "Most Used" - Enables filtering by "Recently Used" (last 7 days) - Usage data displayed on template cards with trends Technical improvements: - Added Phase 5 CSS styles for favorites, context menus, keyboard focus - Implemented keyboard shortcuts hint panel (bottom-right overlay) - Enhanced event delegation for context menu items - Added helper functions: isInputFocused(), navigateCards(), toggleKeyboardHint() - Improved empty state rendering with getEmptyStateHtml() - Updated template cards with tabindex and favorite buttons - Context menu closes on click outside or ESC key Closes #98 * Update src/templates/templateBrowserView.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update src/templates/templateBrowserView.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: Address code review feedback for Phase 5 Fixed compilation errors and addressed code review suggestions: 1. **Fixed TypeScript compilation errors**: - Pre-escape templateId to avoid nested template literal issues - Changed "Copy Template ID" from onclick to data-command - Added copyTemplateId command handler 2. **Fixed defaultFilterState bug**: - Replaced spread of undefined variable with literal object - clearAllFilters() now works correctly 3. **Reduced code duplication**: - Added getFocusedCard() helper function - Refactored keyboard handlers to use the helper - Follows DRY principle Changes address feedback from: - Compilation error: Cannot find name 'escapeHtml' - Compilation error: Cannot find name 'templateId' - Code review: Duplicated logic in keydown handler - Code review: clearAllFilters defaultFilterState bug Note on remaining suggestions: - Race condition warning acknowledged but low-priority for desktop app - Keyboard shortcuts hardcoded intentionally for simplicity --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 702879b commit f7b9069

File tree

1 file changed

+501
-10
lines changed

1 file changed

+501
-10
lines changed

0 commit comments

Comments
 (0)