|
| 1 | +# Search Panel Redesign |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Redesign the search bar component from a dropdown list to a full modal-based search experience with advanced filtering capabilities. |
| 6 | + |
| 7 | +## Problems with Current Implementation |
| 8 | + |
| 9 | +1. **Click-outside clears everything** - `v-on-click-outside="clearSearch"` causes accidental loss of results |
| 10 | +2. **Limited result display** - Absolute positioned list with no scroll container |
| 11 | +3. **No explicit close control** - User has no intentional way to dismiss except clicking outside |
| 12 | +4. **No filtering** - Results often contain same anime with different subtitle groups/seasons, hard to find the right one |
| 13 | + |
| 14 | +## Design Goals |
| 15 | + |
| 16 | +- Prevent accidental dismissal of search results |
| 17 | +- Support displaying many results with proper scrolling |
| 18 | +- Enable filtering by subtitle group, resolution, subtitle type, and season |
| 19 | +- Provide confirmation step before subscribing |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Search Panel Structure |
| 24 | + |
| 25 | +### Trigger & Toggle Behavior |
| 26 | + |
| 27 | +- Clicking the search input opens the search modal (if closed) or closes it (if open) |
| 28 | +- Pressing `Escape` closes the modal |
| 29 | +- A visible `×` close button in the modal header provides explicit dismissal |
| 30 | +- Clicking the backdrop does NOT close (prevents accidental loss of results) |
| 31 | + |
| 32 | +### Modal Layout |
| 33 | + |
| 34 | +``` |
| 35 | +┌─────────────────────────────────────────────────────────┐ |
| 36 | +│ 🔍 [Search input] [provider ▼] [×] │ |
| 37 | +├─────────────────────────────────────────────────────────┤ |
| 38 | +│ 字幕组: [喵萌奶茶屋] [ANi] [桜都] [LoliHouse] [+3] │ |
| 39 | +│ 分辨率: [1080p] [720p] [4K] │ |
| 40 | +│ 字幕语言: [简中 CHS] [繁中 CHT] [双语] [内嵌] [外挂] │ |
| 41 | +│ 季度: [S1] [S2] [剧场版] │ |
| 42 | +│ [清除筛选] 8/24 结果 │ |
| 43 | +├─────────────────────────────────────────────────────────┤ |
| 44 | +│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ |
| 45 | +│ │ Result │ │ Result │ │ Result │ │ |
| 46 | +│ │ Card │ │ Card │ │ Card │ │ |
| 47 | +│ └─────────┘ └─────────┘ └─────────┘ │ |
| 48 | +│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ |
| 49 | +│ │ Result │ │ Result │ │ Result │ │ |
| 50 | +│ │ Card │ │ Card │ │ Card │ │ |
| 51 | +│ └─────────┘ └─────────┘ └─────────┘ │ |
| 52 | +│ (scrollable grid) │ |
| 53 | +└─────────────────────────────────────────────────────────┘ |
| 54 | +``` |
| 55 | + |
| 56 | +- Modal centered on screen with backdrop overlay |
| 57 | +- Fixed header with search input, provider selector, close button |
| 58 | +- Filter chips section below header (sticky when scrolling) |
| 59 | +- Scrollable grid of result cards (3 columns on desktop, responsive) |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +## Filter Chip System |
| 64 | + |
| 65 | +### Four Filter Dimensions |
| 66 | + |
| 67 | +1. **字幕组 (Subtitle Group)** - Fansub team name |
| 68 | +2. **分辨率 (Resolution)** - 720p, 1080p, 4K/2160p |
| 69 | +3. **字幕语言 (Subtitle Type)** - CHS (简中), CHT (繁中), 双语 (Dual), 内嵌 (Hardcoded), 外挂 (External ASS/SRT) |
| 70 | +4. **季度 (Season)** - S1, S2, Movie/剧场版, OVA |
| 71 | + |
| 72 | +### Auto-generated Filters |
| 73 | + |
| 74 | +- As results stream in, extract unique values for each dimension |
| 75 | +- Chips appear dynamically as new filter values are discovered |
| 76 | +- Parsing logic extracts metadata from torrent titles |
| 77 | + |
| 78 | +### Filter Behavior |
| 79 | + |
| 80 | +- Chips are toggleable - click to activate (highlighted), click again to deactivate |
| 81 | +- Multiple filters can be active simultaneously |
| 82 | +- Logic: AND within same category, OR across categories |
| 83 | +- Active filters show with filled background, inactive with outline style |
| 84 | +- "清除筛选" (Clear all) button appears when any filter is active |
| 85 | +- Result count updates dynamically: "显示 8 / 24 个结果" |
| 86 | + |
| 87 | +### Overflow Handling |
| 88 | + |
| 89 | +- If a category has >5 options, show first 4 + `[+N more]` chip that expands |
| 90 | +- Each category row can collapse/expand independently |
| 91 | +- Collapsed state shows badge count for active filters |
| 92 | + |
| 93 | +--- |
| 94 | + |
| 95 | +## Result Cards |
| 96 | + |
| 97 | +### Card Design (Compact Grid Item) |
| 98 | + |
| 99 | +``` |
| 100 | +┌──────────────────────────┐ |
| 101 | +│ ┌──────┐ 葬送的芙莉莲 │ |
| 102 | +│ │poster│ Frieren │ |
| 103 | +│ │ │ ───────────── │ |
| 104 | +│ └──────┘ 喵萌奶茶屋 │ |
| 105 | +│ 1080p · 简中 │ |
| 106 | +│ S1 · 全28集 │ |
| 107 | +└──────────────────────────┘ |
| 108 | +``` |
| 109 | + |
| 110 | +### Card Content |
| 111 | + |
| 112 | +- Thumbnail/poster (if available from API, placeholder if not) |
| 113 | +- Title (Chinese + Romaji/English) |
| 114 | +- Subtitle group badge |
| 115 | +- Resolution + Subtitle type tags |
| 116 | +- Season + Episode count |
| 117 | + |
| 118 | +### Streaming Animation |
| 119 | + |
| 120 | +- Cards fade in with slight upward slide (`opacity: 0 → 1`, `translateY: 8px → 0`) |
| 121 | +- Staggered delay: each card delays 50ms after previous |
| 122 | +- Grid re-flows smoothly as new cards appear |
| 123 | +- Filter changes use same fade animation for showing/hiding |
| 124 | + |
| 125 | +### Empty & Loading States |
| 126 | + |
| 127 | +| State | Display | |
| 128 | +|-------|---------| |
| 129 | +| Initial | "输入关键词开始搜索" | |
| 130 | +| Searching | Spinner in search input, cards stream in | |
| 131 | +| No results | "未找到相关结果,试试其他关键词" | |
| 132 | +| Filtered to zero | "没有符合筛选条件的结果" + "清除筛选" button | |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +## Confirmation Modal |
| 137 | + |
| 138 | +When user clicks a result card, a nested modal appears for review before subscribing. |
| 139 | + |
| 140 | +### Layout |
| 141 | + |
| 142 | +``` |
| 143 | +┌─────────────────────────────────────────────────────┐ |
| 144 | +│ 添加订阅 [×] │ |
| 145 | +├─────────────────────────────────────────────────────┤ |
| 146 | +│ ┌────────┐ │ |
| 147 | +│ │ │ 葬送的芙莉莲 │ |
| 148 | +│ │ poster │ Sousou no Frieren │ |
| 149 | +│ │ │ ★ 9.2 · 2023年秋 · 全28集 │ |
| 150 | +│ └────────┘ │ |
| 151 | +├─────────────────────────────────────────────────────┤ |
| 152 | +│ RSS 源: [当前选择的RSS链接] [复制] │ |
| 153 | +│ 字幕组: 喵萌奶茶屋 │ |
| 154 | +│ 分辨率: 1080p │ |
| 155 | +│ 字幕类型: 简体中文 (内嵌) │ |
| 156 | +├─────────────────────────────────────────────────────┤ |
| 157 | +│ 高级设置 ▼ │ |
| 158 | +│ ┌─────────────────────────────────────────────┐ │ |
| 159 | +│ │ 过滤规则: [自动生成的filter] │ │ |
| 160 | +│ │ 保存路径: /media/anime/葬送的芙莉莲/ │ │ |
| 161 | +│ │ 重命名: ☑ 启用自动重命名 │ │ |
| 162 | +│ └─────────────────────────────────────────────┘ │ |
| 163 | +├─────────────────────────────────────────────────────┤ |
| 164 | +│ [取消] [确认订阅 ✓] │ |
| 165 | +└─────────────────────────────────────────────────────┘ |
| 166 | +``` |
| 167 | + |
| 168 | +### Behavior |
| 169 | + |
| 170 | +- Shows parsed metadata for user review |
| 171 | +- Advanced settings collapsed by default |
| 172 | +- "确认订阅" adds to subscriptions and closes both modals |
| 173 | +- "取消" returns to search results (results preserved) |
| 174 | +- Escape key returns to search results (not full close) |
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | +## Keyboard Navigation |
| 179 | + |
| 180 | +| Key | Action | |
| 181 | +|-----|--------| |
| 182 | +| `Enter` (in search input) | Trigger search | |
| 183 | +| `Escape` | Close confirmation modal (if open) → close search modal | |
| 184 | +| `Tab` | Navigate through filter chips, then result cards | |
| 185 | +| `Enter` (on focused card) | Open confirmation modal | |
| 186 | +| Arrow keys | Navigate grid (optional enhancement) | |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +## Responsive Design |
| 191 | + |
| 192 | +### Breakpoints |
| 193 | + |
| 194 | +| Viewport | Grid | Modal Width | Behavior | |
| 195 | +|----------|------|-------------|----------| |
| 196 | +| Desktop (>1024px) | 3 columns | 800px centered | Full experience | |
| 197 | +| Tablet (768-1024px) | 2 columns | 90% width | Filters collapse to single row | |
| 198 | +| Mobile (<768px) | 1 column | Full screen | Bottom sheet style | |
| 199 | + |
| 200 | +### Mobile Adaptations |
| 201 | + |
| 202 | +- Modal becomes full-screen bottom sheet |
| 203 | +- Filter chips horizontally scrollable (single row) |
| 204 | +- Cards stack vertically (single column) |
| 205 | +- Swipe down to close (in addition to × button) |
| 206 | + |
| 207 | +--- |
| 208 | + |
| 209 | +## Component Structure |
| 210 | + |
| 211 | +``` |
| 212 | +ab-search-modal.vue (new - main modal container) |
| 213 | +├── ab-search-header.vue (search input + provider + close) |
| 214 | +├── ab-search-filters.vue (new - filter chips) |
| 215 | +├── ab-search-results.vue (new - scrollable grid) |
| 216 | +│ └── ab-search-card.vue (new - individual result card) |
| 217 | +└── ab-search-confirm.vue (new - confirmation modal) |
| 218 | +``` |
| 219 | + |
| 220 | +### State Management |
| 221 | + |
| 222 | +Extend `useSearchStore` with: |
| 223 | +- `filters` - active filter state per dimension |
| 224 | +- `filteredResults` - computed results after filter application |
| 225 | +- `showModal` - modal open/close state |
| 226 | +- `selectedResult` - currently selected result for confirmation |
| 227 | + |
| 228 | +--- |
| 229 | + |
| 230 | +## Implementation Notes |
| 231 | + |
| 232 | +### Filter Parsing |
| 233 | + |
| 234 | +Need to extract metadata from torrent titles. Common patterns: |
| 235 | +- Subtitle group: `[喵萌奶茶屋]`, `【ANi】` |
| 236 | +- Resolution: `1080p`, `720p`, `2160p`, `4K` |
| 237 | +- Subtitle type: `简体`, `繁體`, `CHS`, `CHT`, `简日双语`, `内嵌`, `外挂` |
| 238 | +- Season: `S01`, `Season 1`, `第一季`, `剧场版`, `Movie`, `OVA` |
| 239 | + |
| 240 | +### SSE Streaming |
| 241 | + |
| 242 | +Keep existing SSE implementation but: |
| 243 | +- Parse metadata from each result as it arrives |
| 244 | +- Update filter options incrementally |
| 245 | +- Apply active filters to new results immediately |
| 246 | + |
| 247 | +### Animation |
| 248 | + |
| 249 | +Use Vue's `<TransitionGroup>` with staggered delays: |
| 250 | +```css |
| 251 | +.card-enter-active { |
| 252 | + transition: all 0.3s ease; |
| 253 | + transition-delay: calc(var(--index) * 50ms); |
| 254 | +} |
| 255 | +.card-enter-from { |
| 256 | + opacity: 0; |
| 257 | + transform: translateY(8px); |
| 258 | +} |
| 259 | +``` |
0 commit comments