Skip to content

Commit a346e50

Browse files
authored
Prepare ground work for more exciting features (#3929)
1 parent 1b64eb9 commit a346e50

File tree

9 files changed

+2873
-0
lines changed

9 files changed

+2873
-0
lines changed

docs/specs/4-architecture/features/005-album-list-view/plan.md

Lines changed: 459 additions & 0 deletions
Large diffs are not rendered by default.

docs/specs/4-architecture/features/005-album-list-view/spec.md

Lines changed: 341 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 304 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,304 @@
1+
# Feature 005 Tasks – Album List View Toggle
2+
3+
_Status: Draft_
4+
_Last updated: 2026-01-03_
5+
6+
> Keep this checklist aligned with the feature plan increments. Stage tests before implementation, record verification commands beside each task, and prefer bite-sized entries (≤90 minutes).
7+
> **Mark tasks `[x]` immediately** after each one passes verification—do not batch completions. Update the roadmap status when all tasks are done.
8+
> When referencing requirements, keep feature IDs (`FR-`), non-goal IDs (`N-`), and scenario IDs (`S-`) inside the same parentheses immediately after the task title (omit categories that do not apply).
9+
> When new high- or medium-impact questions arise during execution, add them to [docs/specs/4-architecture/open-questions.md](docs/specs/4-architecture/open-questions.md) instead of informal notes, and treat a task as fully resolved only once the governing spec sections (requirements/NFR/behaviour/telemetry) and, when required, ADRs under `docs/specs/5-decisions/` reflect the clarified behaviour.
10+
11+
## Checklist
12+
13+
### Increment I1 – LycheeState Store Modifications
14+
15+
- [ ] T-005-01 – Add album_view_mode state property to LycheeState.ts (FR-005-04, NFR-005-01, S-005-03, S-005-04).
16+
_Intent:_ Add `album_view_mode: "grid" | "list"` property with default value "grid" to LycheeState.ts store.
17+
_Verification commands:_
18+
- `npm run check` (TypeScript compilation)
19+
_Notes:_ Property should be reactive, accessible via computed getter.
20+
21+
- [ ] T-005-02 – Add setAlbumViewMode action to LycheeState.ts (FR-005-04, S-005-01, S-005-02).
22+
_Intent:_ Implement action `setAlbumViewMode(mode: "grid" | "list")` that updates state and writes to localStorage.
23+
_Verification commands:_
24+
- `npm run check`
25+
_Notes:_ Use localStorage key `album_view_mode`, handle localStorage unavailability gracefully.
26+
27+
- [ ] T-005-03 – Add localStorage initialization logic to LycheeState.ts (FR-005-04, NFR-005-01, S-005-04).
28+
_Intent:_ On store setup/mount, read from localStorage and initialize album_view_mode state.
29+
_Verification commands:_
30+
- `npm run check`
31+
- Manual test: Set localStorage, reload page, verify state initialized correctly
32+
_Notes:_ Default to "grid" if localStorage unavailable or key not found.
33+
34+
- [ ] T-005-04 – Write unit tests for LycheeState view mode state and localStorage persistence (S-005-03, S-005-04, S-005-10).
35+
_Intent:_ Test default value, setAlbumViewMode updates, localStorage read/write behavior (mock localStorage).
36+
_Verification commands:_
37+
- `npm run check` (includes unit tests)
38+
_Notes:_ Mock localStorage API for tests, test both success and unavailable scenarios.
39+
40+
---
41+
42+
### Increment I2 – AlbumListItem Component
43+
44+
- [ ] T-005-05 – Create AlbumListItem.vue component skeleton (FR-005-01, FR-005-02).
45+
_Intent:_ Create new file `resources/js/components/gallery/albumModule/AlbumListItem.vue` with basic Vue 3 Composition API structure, props interface (album: AlbumResource).
46+
_Verification commands:_
47+
- `npm run check` (TypeScript compilation)
48+
_Notes:_ Import AlbumResource type from existing types.
49+
50+
- [ ] T-005-06 – Implement AlbumListItem template structure (FR-005-01, FR-005-02, S-005-05).
51+
_Intent:_ Add router-link wrapper, thumbnail slot (use AlbumThumbImage component), album title, photo count, sub-album count sections.
52+
_Verification commands:_
53+
- `npm run check`
54+
- `npm run dev` (visual inspection)
55+
_Notes:_ Use Tailwind classes for layout: `flex items-center gap-4`.
56+
57+
- [ ] T-005-07 – Add styling to AlbumListItem (FR-005-01, FR-005-06).
58+
_Intent:_ Apply Tailwind CSS: hover state, border separator, responsive thumbnail sizes (64px desktop, 48px mobile).
59+
_Verification commands:_
60+
- `npm run format`
61+
- `npm run dev` (visual inspection)
62+
_Notes:_ Classes: `hover:bg-gray-100 dark:hover:bg-gray-800`, `border-b border-gray-200 dark:border-gray-700`, `md:w-16 md:h-16 w-12 h-12` for thumbnail.
63+
64+
- [ ] T-005-08 – Add badge display to AlbumListItem (FR-005-05, S-005-08).
65+
_Intent:_ Reuse existing badge logic from AlbumThumb.vue to display NSFW, password, public badges in list row.
66+
_Verification commands:_
67+
- `npm run check`
68+
- `npm run dev` (test with albums that have badges)
69+
_Notes:_ Position badges adjacent to thumbnail or album name.
70+
71+
- [ ] T-005-09 – Write unit tests for AlbumListItem (S-005-06, S-005-07, S-005-08).
72+
_Intent:_ Test rendering with sample album data, long album names, 0 photos/sub-albums, badge display.
73+
_Verification commands:_
74+
- `npm run check`
75+
_Notes:_ Create test fixture with edge cases (long names, 0 counts, multiple badges).
76+
77+
---
78+
79+
### Increment I3 – AlbumListView Component
80+
81+
- [ ] T-005-10 – Create AlbumListView.vue component skeleton (FR-005-01).
82+
_Intent:_ Create new file `resources/js/components/gallery/albumModule/AlbumListView.vue` with props interface (albums: AlbumResource[], aspectRatio: AspectRatioCSSType).
83+
_Verification commands:_
84+
- `npm run check`
85+
_Notes:_ Import AlbumListItem component.
86+
87+
- [ ] T-005-11 – Implement AlbumListView template with v-for loop (FR-005-01, S-005-05).
88+
_Intent:_ Render AlbumListItem for each album in albums array, handle empty state.
89+
_Verification commands:_
90+
- `npm run check`
91+
- `npm run dev` (test with sample albums)
92+
_Notes:_ Use flex column layout: `flex flex-col w-full`.
93+
94+
- [ ] T-005-12 – Write unit tests for AlbumListView (S-005-06).
95+
_Intent:_ Test rendering multiple albums, empty state, props passing to AlbumListItem.
96+
_Verification commands:_
97+
- `npm run check`
98+
_Notes:_ Use fixture data from FX-005-01.
99+
100+
---
101+
102+
### Increment I4 – AlbumThumbPanel Modifications
103+
104+
- [ ] T-005-13 – Import AlbumListView and LycheeState in AlbumThumbPanel.vue (S-005-01, S-005-02).
105+
_Intent:_ Add necessary imports to conditionally render grid or list view.
106+
_Verification commands:_
107+
- `npm run check`
108+
_Notes:_ Read existing AlbumThumbPanel.vue to understand structure before modifying.
109+
110+
- [ ] T-005-14 – Add computed property for view mode in AlbumThumbPanel.vue (S-005-04).
111+
_Intent:_ Read album_view_mode from LycheeState store via computed property.
112+
_Verification commands:_
113+
- `npm run check`
114+
_Notes:_ Use `const lycheeStore = useLycheeStateStore()`.
115+
116+
- [ ] T-005-15 – Update AlbumThumbPanel template to conditionally render grid or list (S-005-01, S-005-02).
117+
_Intent:_ Use v-if to render AlbumThumbPanelList when mode === "grid", AlbumListView when mode === "list".
118+
_Verification commands:_
119+
- `npm run check`
120+
- `npm run dev` (manually toggle view mode in localStorage, verify switch)
121+
_Notes:_ Ensure both components receive same props (albums array, etc.).
122+
123+
---
124+
125+
### Increment I5 – AlbumHero Toggle Buttons
126+
127+
- [ ] T-005-16 – Add grid and list toggle button elements to AlbumHero.vue (FR-005-03, S-005-01, S-005-02).
128+
_Intent:_ Add two `<a>` elements in the flex-row-reverse icon container (line 33) with grid/list icons (PrimeVue pi-th, pi-list).
129+
_Verification commands:_
130+
- `npm run check`
131+
- `npm run dev` (visual inspection - buttons appear in icon row)
132+
_Notes:_ Follow existing icon pattern: `shrink-0 px-3 cursor-pointer text-muted-color inline-block transform duration-300 hover:scale-150 hover:text-color`.
133+
134+
- [ ] T-005-17 – Add click handlers to toggle buttons in AlbumHero.vue (FR-005-03, S-005-01, S-005-02).
135+
_Intent:_ Implement @click handlers that call `lycheeStore.setAlbumViewMode('grid' | 'list')`.
136+
_Verification commands:_
137+
- `npm run check`
138+
- `npm run dev` (click buttons, verify view switches, localStorage updated)
139+
_Notes:_ Import LycheeState store at top of component.
140+
141+
- [ ] T-005-18 – Add active state styling to toggle buttons in AlbumHero.vue (FR-005-03, UI-005-01, UI-005-02).
142+
_Intent:_ Apply different styling when button is active (current view mode), e.g., different color or text-primary-emphasis.
143+
_Verification commands:_
144+
- `npm run dev` (visual inspection - active button highlighted)
145+
_Notes:_ Use computed property or v-bind:class based on current view mode.
146+
147+
- [ ] T-005-19 – Add aria-labels and aria-pressed to toggle buttons (NFR-005-03, UI-005-03).
148+
_Intent:_ Add accessibility attributes: aria-label="Switch to grid view" / "Switch to list view", aria-pressed based on active state.
149+
_Verification commands:_
150+
- `npm run check`
151+
- Manual accessibility audit (keyboard navigation, screen reader)
152+
_Notes:_ Ensure buttons are keyboard-navigable (Tab to focus, Enter to activate).
153+
154+
- [ ] T-005-20 – Add tooltips to toggle buttons in AlbumHero.vue (FR-005-03).
155+
_Intent:_ Add v-tooltip.bottom directives similar to other icons in AlbumHero.vue.
156+
_Verification commands:_
157+
- `npm run dev` (hover over buttons, verify tooltips appear)
158+
_Notes:_ Tooltip text: "Grid view" / "List view".
159+
160+
---
161+
162+
### Increment I6 – Responsive Mobile Layout Testing
163+
164+
- [ ] T-005-21 – Test list view on 320px viewport (FR-005-06, S-005-09).
165+
_Intent:_ Verify layout doesn't overflow, thumbnails scale to 48px, album names wrap, counts display compactly.
166+
_Verification commands:_
167+
- `npm run dev` (browser DevTools responsive mode, set to 320px width)
168+
_Notes:_ Make CSS adjustments if needed, use Tailwind md: breakpoints.
169+
170+
- [ ] T-005-22 – Test list view on 375px and 768px viewports (FR-005-06, S-005-09, UI-005-05).
171+
_Intent:_ Verify responsive behavior at common mobile breakpoints.
172+
_Verification commands:_
173+
- `npm run dev` (test multiple viewport sizes)
174+
_Notes:_ Capture screenshots for documentation.
175+
176+
- [ ] T-005-23 – Test toggle buttons on mobile viewports (FR-005-03, S-005-09).
177+
_Intent:_ Verify toggle buttons remain usable and don't crowd header on mobile.
178+
_Verification commands:_
179+
- `npm run dev` (mobile testing)
180+
_Notes:_ Consider icon-only display on very narrow screens if needed.
181+
182+
---
183+
184+
### Increment I7 – Component Unit Tests
185+
186+
- [ ] T-005-24 – Create fixture file albums-list-view.json (FX-005-01).
187+
_Intent:_ Create `resources/js/components/gallery/albumModule/__tests__/fixtures/albums-list-view.json` with sample album data (long names, 0 counts, badges, high counts).
188+
_Verification commands:_
189+
- File exists and is valid JSON
190+
_Notes:_ Include edge cases mentioned in spec.
191+
192+
- [ ] T-005-25 – Write unit tests for AlbumListItem component (S-005-05, S-005-06, S-005-07, S-005-08).
193+
_Intent:_ Test rendering with various album data scenarios, navigation behavior, badge display.
194+
_Verification commands:_
195+
- `npm run check`
196+
_Notes:_ Use Vue Test Utils, test props passing and rendering output.
197+
198+
- [ ] T-005-26 – Write unit tests for AlbumListView component (S-005-06).
199+
_Intent:_ Test rendering multiple albums, empty state, props passing.
200+
_Verification commands:_
201+
- `npm run check`
202+
_Notes:_ Verify correct number of AlbumListItem components rendered.
203+
204+
- [ ] T-005-27 – Write integration tests for view mode toggle (S-005-01, S-005-02, S-005-03, S-005-04).
205+
_Intent:_ Test end-to-end toggle behavior, localStorage persistence, default value.
206+
_Verification commands:_
207+
- `npm run check`
208+
_Notes:_ Mock localStorage for tests, test both available and unavailable scenarios.
209+
210+
---
211+
212+
### Increment I8 – Integration Testing & Visual Regression
213+
214+
- [ ] T-005-28 – Manual integration testing: toggle between views (S-005-01, S-005-02).
215+
_Intent:_ Load album page, click list toggle, verify switch, click grid toggle, verify switch back.
216+
_Verification commands:_
217+
- `npm run dev` (manual testing)
218+
_Notes:_ Test with real album data, various album counts.
219+
220+
- [ ] T-005-29 – Manual integration testing: localStorage persistence (S-005-04, S-005-10).
221+
_Intent:_ Set view to list, reload page, verify still in list view. Test private browsing mode (defaults to grid on reload).
222+
_Verification commands:_
223+
- `npm run dev` (manual testing with page reloads)
224+
_Notes:_ Clear localStorage between tests to verify default behavior.
225+
226+
- [ ] T-005-30 – Keyboard accessibility testing (NFR-005-03, UI-005-03).
227+
_Intent:_ Tab to toggle buttons, verify focus outline, press Enter to activate, verify view switches.
228+
_Verification commands:_
229+
- Manual keyboard navigation testing
230+
_Notes:_ Test with screen reader if available, verify aria-labels announced.
231+
232+
- [ ] T-005-31 – Visual regression baseline capture (optional, if tooling available).
233+
_Intent:_ Capture screenshots of grid view (desktop), list view (desktop), list view (mobile) as baseline images.
234+
_Verification commands:_
235+
- Visual regression tool commands
236+
_Notes:_ Store baselines for future regression testing.
237+
238+
- [ ] T-005-32 – Performance testing with 100 albums (NFR-005-02).
239+
_Intent:_ Load album with 100+ albums, measure rendering time, verify < 300ms for list view.
240+
_Verification commands:_
241+
- Browser DevTools Performance tab
242+
_Notes:_ Compare grid vs list rendering performance.
243+
244+
---
245+
246+
### Increment I9 – Documentation Updates
247+
248+
- [ ] T-005-33 – Update knowledge-map.md with new components.
249+
_Intent:_ Add entries for AlbumListView.vue, AlbumListItem.vue, note modifications to AlbumHero.vue and LycheeState.ts.
250+
_Verification commands:_
251+
- File updated and readable
252+
_Notes:_ Follow existing knowledge map format.
253+
254+
- [ ] T-005-34 – Update spec.md status to Implemented.
255+
_Intent:_ Change status field in spec.md from "Draft" to "Implemented", update last updated date.
256+
_Verification commands:_
257+
- File updated
258+
_Notes:_ Update after all other tasks complete.
259+
260+
- [ ] T-005-35 – Update roadmap.md feature status.
261+
_Intent:_ Change Feature 005 status from "Planning" to "In Progress" when implementation starts, "Complete" when done.
262+
_Verification commands:_
263+
- File updated
264+
_Notes:_ Update incrementally as progress is made.
265+
266+
- [ ] T-005-36 – Create PR description with screenshots.
267+
_Intent:_ Document feature summary, add screenshots showing grid vs list views, testing notes.
268+
_Verification commands:_
269+
- PR description complete
270+
_Notes:_ Include before/after screenshots (desktop and mobile).
271+
272+
---
273+
274+
## Notes / TODOs
275+
276+
**Environment setup:**
277+
- Ensure Node.js and npm are up to date
278+
- Run `npm install` to install dependencies before starting
279+
280+
**Testing strategy:**
281+
- Prefer unit tests for components (fast feedback)
282+
- Manual integration testing for user flows
283+
- Visual regression testing optional (if tooling exists)
284+
285+
**Deferred items (out of scope for Feature 005):**
286+
- Virtualization for 1000+ albums (performance optimization)
287+
- Backend persistence of view preference (multi-device sync)
288+
- Sortable columns in list view
289+
- Customizable column layout
290+
- Per-album view preferences
291+
292+
**Common commands:**
293+
- `npm run format` - Format frontend code (Prettier)
294+
- `npm run check` - Run frontend tests and TypeScript type checking
295+
- `npm run dev` - Start local development server
296+
297+
**Potential blockers:**
298+
- If PrimeVue icons (pi-th, pi-list) are not available, choose alternative icons
299+
- If localStorage is restricted (CSP, privacy settings), feature will default to grid view (acceptable)
300+
- If performance with 100+ albums is poor, may need virtualization (defer to follow-up)
301+
302+
---
303+
304+
_Last updated: 2026-01-03_

0 commit comments

Comments
 (0)