|
| 1 | +# Bookmark Editing Feature - Product Requirements Document |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Implement a comprehensive bookmark editing system that mimics Chrome's bookmark bar workflow, providing users with intuitive browser-like bookmark management directly within the onboard application. |
| 6 | + |
| 7 | +## Current State Analysis |
| 8 | + |
| 9 | +### Existing Implementation |
| 10 | +- **Data Storage**: JSON file at `app/configs/bookmarks_bar.json` |
| 11 | +- **Models**: `Bookmark` and `Bookmarks` classes with hierarchical structure |
| 12 | +- **Display**: Recursive template rendering with folder support |
| 13 | +- **Styling**: Chrome-like appearance with hover effects and favicons |
| 14 | +- **Management**: `BookmarkBarManager` service for loading and reloading |
| 15 | + |
| 16 | +### Data Structure |
| 17 | +```json |
| 18 | +[ |
| 19 | + { |
| 20 | + "name": "Gmail", |
| 21 | + "href": "https://mail.google.com/mail/u/0/#inbox", |
| 22 | + "favicon": "/static/assets/icons/google.com.favicon.ico", |
| 23 | + "add_date": "1587496250" |
| 24 | + }, |
| 25 | + { |
| 26 | + "name": "Links", |
| 27 | + "contents": [ |
| 28 | + { |
| 29 | + "name": "Subfolder", |
| 30 | + "contents": [...] |
| 31 | + } |
| 32 | + ] |
| 33 | + } |
| 34 | +] |
| 35 | +``` |
| 36 | + |
| 37 | +## Goals |
| 38 | + |
| 39 | +### Primary Goals |
| 40 | +1. **Chrome-like UX**: Replicate Chrome's bookmark management experience |
| 41 | +2. **In-place Editing**: Edit bookmarks directly in the bookmark bar |
| 42 | +3. **Drag & Drop**: Reorganize bookmarks and folders via dragging |
| 43 | +4. **Context Menus**: Right-click menus for quick actions |
| 44 | +5. **Real-time Updates**: Immediate visual feedback without page refresh |
| 45 | + |
| 46 | +### Secondary Goals |
| 47 | +1. **Bulk Operations**: Select multiple bookmarks for batch operations |
| 48 | +2. **Import/Export**: Support Chrome bookmark imports |
| 49 | +3. **Search**: Find bookmarks by name or URL |
| 50 | +4. **Keyboard Shortcuts**: Power user navigation |
| 51 | + |
| 52 | +## User Stories |
| 53 | + |
| 54 | +### Core User Stories |
| 55 | + |
| 56 | +**As a user, I want to:** |
| 57 | + |
| 58 | +1. **Add Bookmarks** |
| 59 | + - Right-click in bookmark bar → "Add Bookmark" |
| 60 | + - Ctrl+D to bookmark current page |
| 61 | + - Quick-add via URL paste |
| 62 | + |
| 63 | +2. **Edit Bookmarks** |
| 64 | + - Right-click bookmark → "Edit" |
| 65 | + - Click bookmark name to inline edit |
| 66 | + - Edit name, URL, and folder location |
| 67 | + |
| 68 | +3. **Organize Bookmarks** |
| 69 | + - Drag bookmark to reorder |
| 70 | + - Drag bookmark onto folder to move |
| 71 | + - Create new folders via right-click |
| 72 | + |
| 73 | +4. **Delete Bookmarks** |
| 74 | + - Right-click → "Delete" |
| 75 | + - Delete key after selection |
| 76 | + - Confirm deletion for folders with contents |
| 77 | + |
| 78 | +5. **Manage Folders** |
| 79 | + - Create nested folder structures |
| 80 | + - Rename folders inline |
| 81 | + - Move folders and their contents |
| 82 | + |
| 83 | +### Advanced User Stories |
| 84 | + |
| 85 | +**As a power user, I want to:** |
| 86 | + |
| 87 | +1. **Batch Operations** |
| 88 | + - Select multiple bookmarks (Ctrl+click) |
| 89 | + - Move multiple items to folder |
| 90 | + - Delete multiple bookmarks |
| 91 | + |
| 92 | +2. **Quick Access** |
| 93 | + - Search bookmarks with Ctrl+F |
| 94 | + - Keyboard navigation (arrow keys) |
| 95 | + - Quick folder collapse/expand |
| 96 | + |
| 97 | +## Success Criteria |
| 98 | + |
| 99 | +### Must Have |
| 100 | +- [ ] Add new bookmarks via right-click menu |
| 101 | +- [ ] Edit bookmark name and URL inline |
| 102 | +- [ ] Delete bookmarks with confirmation |
| 103 | +- [ ] Create and manage folders |
| 104 | +- [ ] Drag and drop reorganization |
| 105 | +- [ ] Data persistence to JSON file |
| 106 | +- [ ] Real-time UI updates |
| 107 | + |
| 108 | +### Should Have |
| 109 | +- [ ] Keyboard shortcuts (Ctrl+D, Delete, etc.) |
| 110 | +- [ ] Undo last action |
| 111 | +- [ ] Duplicate bookmark detection |
| 112 | +- [ ] Bulk selection and operations |
| 113 | + |
| 114 | +### Nice to Have |
| 115 | +- [ ] Chrome bookmark import |
| 116 | +- [ ] Bookmark search functionality |
| 117 | +- [ ] Export bookmarks to file |
| 118 | +- [ ] Bookmark validation (check broken links) |
| 119 | + |
| 120 | +## Technical Constraints |
| 121 | + |
| 122 | +### Existing Architecture |
| 123 | +- Must work with current Flask/Jinja2 setup |
| 124 | +- Preserve existing bookmark bar styling |
| 125 | +- Maintain JSON file structure compatibility |
| 126 | +- Work with current `BookmarkBarManager` service |
| 127 | + |
| 128 | +### Browser Compatibility |
| 129 | +- Support modern browsers (Chrome, Firefox, Safari, Edge) |
| 130 | +- Graceful degradation for JavaScript-disabled browsers |
| 131 | +- Mobile-responsive design |
| 132 | + |
| 133 | +### Performance |
| 134 | +- Smooth drag and drop experience |
| 135 | +- Immediate UI feedback (<100ms) |
| 136 | +- Efficient JSON file updates |
| 137 | +- Minimal JavaScript bundle size |
| 138 | + |
| 139 | +## Non-Goals |
| 140 | + |
| 141 | +- Social bookmark sharing |
| 142 | +- Cloud synchronization |
| 143 | +- Bookmark analytics/usage tracking |
| 144 | +- Advanced bookmark metadata (tags, descriptions) |
| 145 | +- Integration with external bookmark services |
| 146 | + |
| 147 | +## Risks and Mitigation |
| 148 | + |
| 149 | +### Technical Risks |
| 150 | +1. **Data Loss**: Accidental bookmark deletion |
| 151 | + - *Mitigation*: Confirmation dialogs, undo functionality |
| 152 | + |
| 153 | +2. **Concurrent Editing**: Multiple users editing simultaneously |
| 154 | + - *Mitigation*: File locking, optimistic updates with conflict detection |
| 155 | + |
| 156 | +3. **Large Bookmark Collections**: Performance with 1000+ bookmarks |
| 157 | + - *Mitigation*: Virtual scrolling, lazy loading, pagination |
| 158 | + |
| 159 | +### UX Risks |
| 160 | +1. **Accidental Reorganization**: Unintended drag and drop |
| 161 | + - *Mitigation*: Drag threshold, visual feedback, undo |
| 162 | + |
| 163 | +2. **Mobile Usability**: Touch-based bookmark management |
| 164 | + - *Mitigation*: Touch-friendly targets, long-press menus |
| 165 | + |
| 166 | +## Dependencies |
| 167 | + |
| 168 | +### Frontend Technologies |
| 169 | +- **HTMX**: For server-side rendering with AJAX updates |
| 170 | +- **Sortable.js**: Drag and drop functionality |
| 171 | +- **Context Menu Library**: Right-click menu implementation |
| 172 | + |
| 173 | +### Backend Requirements |
| 174 | +- Flask route handlers for CRUD operations |
| 175 | +- Enhanced `BookmarkBarManager` for editing operations |
| 176 | +- Data validation and sanitization |
| 177 | +- Atomic file operations for data safety |
| 178 | + |
| 179 | +## Timeline Estimate |
| 180 | + |
| 181 | +### Phase 1: Core Editing (2 weeks) |
| 182 | +- Basic CRUD operations via right-click menus |
| 183 | +- Inline editing for bookmark names and URLs |
| 184 | +- Data persistence and validation |
| 185 | + |
| 186 | +### Phase 2: Drag & Drop (1 week) |
| 187 | +- Implement drag and drop reorganization |
| 188 | +- Visual feedback during dragging |
| 189 | +- Drop zone highlighting |
| 190 | + |
| 191 | +### Phase 3: Polish & Testing (1 week) |
| 192 | +- Keyboard shortcuts |
| 193 | +- Error handling and user feedback |
| 194 | +- Comprehensive testing |
| 195 | +- Documentation |
| 196 | + |
| 197 | +**Total Estimated Timeline: 4 weeks** |
0 commit comments