feat: synchronize presenter controls

This commit is contained in:
lda
2026-07-14 14:48:25 +07:00 Verified
parent ae0e1bee36
commit be3e494488
5 changed files with 203 additions and 6 deletions
+49
View File
@@ -0,0 +1,49 @@
# Task 7 Report: Presenter Synchronization And Session End
## Outcome
Implemented bidirectional LAN presentation synchronization for `/presenter` using the existing `usePresentationSync` controller and `PresentationPairingPanel` UI with the `presenter` role.
The presenter URL hash remains canonical. Local navigation continues to use the existing hash parser and `presenterHashForNote` paths, while remote locations assign `window.location.hash` only when the requested hash differs. The existing hook's remote-in-flight guard consumes that update without publishing a feedback revision.
## Implementation
- Mounted `usePresentationSync` in `PresenterRoute` with the current URL hash and presenter role.
- Applied remote note and Q&A hashes through `window.location.hash`, preserving the existing `hashchange` parser and rendering flow.
- Passed the controller to `PresenterNavigationBar` and rendered the shared pairing panel beside Previous/Next controls, outside speaker-note content.
- Enabled the presenter's existing shared end-session confirmation and ended-state UI.
- Preserved rapid key navigation, swipe callbacks and exclusions, sidebar/Q&A links, covered state, and initial auto-scroll behavior.
- Preserved the intentional mobile navigation CSS: centered auto margins remain in place, the viewport-wide sticky surface uses `::before`, and no negative `margin-inline` was introduced.
- Expanded the navigation grid for the pairing control and kept Next alignment explicit after adding the fourth grid item.
## TDD Evidence
RED was observed with four route tests failing because the presenter route did not mount the panel/controller, apply remote hashes, expose end-session UI, or render failure state. Existing presenter shell tests remained green.
GREEN coverage verifies:
- the pairing panel is inside the stable presenter navigation area;
- canonical Previous/Next and Q&A links and hook hash updates;
- audience-originated note and Q&A hashes update presenter content;
- presenter end confirmation calls `endSession` and ended state is displayed;
- local arrow-key navigation remains available after synchronization failure;
- existing rapid key navigation, swipe behavior/exclusions, sidebar behavior, and auto-scroll tests remain passing.
Remote-update feedback suppression is additionally covered by the existing `usePresentationSync` tests and implemented by its `remoteHashInFlightRef` guard.
## Verification
```text
pnpm --dir web --filter @lda/console test -- src/presentation/presenter
5 test files passed; 28 tests passed.
pnpm --dir web --filter @lda/console typecheck
@lda/presentation-sync build and console TypeScript project build passed.
git diff --check
Passed with no whitespace errors.
```
## Self-Review
No critical or important findings. The change is limited to the presenter synchronization seam and tests. The untracked active LAN synchronization plan was not staged. The pre-existing intentional `presenter.css` mobile sticky-navigation edit was retained and verified as part of this task.