A watch party built from a whole series or video playlist that remembers the group's progress and each member's, so someone coming back or joining late sees the items they missed and can catch up (solo, as a catch-up watch party, or by marking items watched). - StaticPartyService + StaticPartyStore: first on-disk state (JSON file under DATA_DIR, atomic debounced writes, flushed on SIGTERM) - each session is an ordinary Party linked via party.staticLink; group position is saved by the 20s sweep and resumed on the next session - PartyService.completeCurrentItem centralizes "item done" (Emby Played + static progress); new host-only "itemEnded" socket event covers the last queued item, which was never marked Played before - missed = group-completed minus watched in-app minus Emby Played - /static/:id view, create buttons on series/playlist pages, home section - Docker volume for /data, spec/static-watch-party.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1 KiB
TypeScript
28 lines
1 KiB
TypeScript
import { createStaticParty } from '../../api/staticParty';
|
|
import { navigate } from '../../router';
|
|
import { showToast } from '../../toast';
|
|
|
|
/**
|
|
* "Créer une watch party permanente" - shared by views/series and
|
|
* views/playlist: creates a static watch party over `sourceId` (a series
|
|
* or a video playlist - the server decides which, and refuses anything
|
|
* else with a message) and opens its page.
|
|
*/
|
|
export function wireCreateStaticButton(btn: HTMLButtonElement, sourceId: string): void {
|
|
const idleLabel = btn.textContent || '';
|
|
btn.addEventListener('click', () => {
|
|
btn.disabled = true;
|
|
btn.textContent = 'Création...';
|
|
createStaticParty(sourceId)
|
|
.then((sp) => {
|
|
console.info('[staticParty] created', sp.id, 'from', sourceId);
|
|
navigate(`/static/${sp.id}`);
|
|
})
|
|
.catch((err: unknown) => {
|
|
console.error('[staticParty] create failed', sourceId, err);
|
|
showToast((err as Error).message, { variant: 'error' });
|
|
btn.disabled = false;
|
|
btn.textContent = idleLabel;
|
|
});
|
|
});
|
|
}
|