miaoda-game-bridge-tournament-react
v0.1.3
Published
React subscriptions and a public-view controller for Bridge pairs tournaments.
Maintainers
Readme
miaoda-game-bridge-tournament-react
React subscriptions and a framework-neutral controller for the public view of
miaoda-game-bridge-tournament-core.
import {
BridgePairsTournamentController,
createBridgePairsTournament,
useBridgePairsTournamentView,
} from 'miaoda-game-bridge-tournament-react';
const controller = new BridgePairsTournamentController(
createBridgePairsTournament({ tournamentId: 'club-night', tableCount: 5, boardsPerRound: 2 }),
);
function Standings() {
const view = useBridgePairsTournamentView(controller);
return view.standings.map((pair) => (
<div key={`${pair.direction}:${pair.pairNumber}`}>
{pair.direction} {pair.pairNumber}: {pair.percentage}
</div>
));
}The hook exposes only completed-board scores and standings. Pending table
scores and the correction ledger remain in trusted controller state. Accepted
commands publish once; duplicate retries and rejected commands do not render.
replaceSnapshot validates reconnect state and rejects revision rollback.
Do not dispatch scores or replace a snapshot synchronously from onChange; schedule that mutation after the callback returns.
