mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
Extracts video modal event handling logic from `js/app.js` to `js/ui/videoModalController.js`. - Moves `_bindVideoModalEvents` logic to `VideoModalController.bindEvents`. - Adds unit tests for the controller. - Follows AGENTS.md refactor guidelines. Co-authored-by: PR0M3TH3AN <[email protected]>
1.5 KiB
1.5 KiB
Weekly Agent Task Completion: refactor-agent
- Agent Name: refactor-agent
- Cadence: weekly
- Date: 2026-02-15
- Status: Completed
Summary of Changes
Refactored js/app.js to extract video modal event handling logic into js/ui/videoModalController.js.
Key Changes
- Modified
js/ui/videoModalController.js:- Added
bindEvents()method to attach event listeners to the video modal component. - Implemented handler methods:
handleShareNostr,handleCopyCdn,handleCopyMagnetCallback,handleSourceSwitch. - Updated constructor to accept necessary callbacks and dependencies (
showSuccess,playVideoWithFallback, etc.).
- Added
- Modified
js/app.js:- Removed
_bindVideoModalEventsmethod. - Updated
VideoModalControllerinstantiation to pass new callbacks. - Called
this.videoModalController.bindEvents()in_initModals.
- Removed
- Added
tests/unit/ui/videoModalController.test.mjsto test the new controller logic.
Verification
- Ran
npm run lint: Passed. - Ran
npm run test:unit:shard1: Passed. - Ran new unit tests: Passed.
AGENTS.md Checklist Compliance
- Separation of Concerns: Moved DOM event handling logic from
bitvidApptoVideoModalController. - State Management: Controller reads state via getters (
getCurrentVideo,getPlaySource) passed from App. - Execution Flow: Controller invokes callbacks (
playVideoWithFallback) provided by App. - Atomicity: Change is limited to Video Modal event handling extraction.