mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
refactor(ui): extract bindThumbnailFallbacks from app.js
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
ee8569a99b
commit
4a5099d745
4 files changed
+244
-80
No files matched your search
@@ -0,0 +1,22 @@
|
||||
# Refactor Agent: Extract bindThumbnailFallbacks
|
||||
|
||||
## Summary
|
||||
Extracted the `bindThumbnailFallbacks` logic from `js/app.js` into a new dedicated UI utility module `js/ui/thumbnailBinder.js`. This reduces the complexity of the monolithic `Application` class and improves testability of the thumbnail fallback logic.
|
||||
|
||||
## Changes
|
||||
- Created `js/ui/thumbnailBinder.js`.
|
||||
- Extracted `bindThumbnailFallbacks` function and `FALLBACK_THUMBNAIL_SRC` constant.
|
||||
- Updated `js/app.js` to import and delegate to the new module.
|
||||
- Added unit tests in `tests/unit/ui/thumbnailBinder.test.mjs`.
|
||||
|
||||
## Verification
|
||||
- `npm run test:unit`: Passed (including new tests).
|
||||
- `npm run lint`: Passed.
|
||||
|
||||
## AGENTS.md Refactor Checklist Compliance
|
||||
- **Select one refactor target**: Selected `bindThumbnailFallbacks` (>50 LOC, mix of concerns).
|
||||
- **Extract one coherent helper**: Extracted `bindThumbnailFallbacks`.
|
||||
- **Wire thin wrapper**: `Application.prototype.bindThumbnailFallbacks` now delegates to the imported function.
|
||||
- **Add unit tests**: Added comprehensive tests covering normal flow and edge cases.
|
||||
- **Produce small PR**: Changes are limited to extraction and wiring.
|
||||
- **Preserve semantics**: Original behavior, including event binding logic and fallback source selection, is preserved.
|
||||
Reference in new issue
Block a user