- Replaced scattered message strings with `DraftMessage` `StrEnum` and numeric `DraftPhase` `IntEnum` for clear, centralized definitions. - Added Python→JS constants sync via `scripts/generate_js_constants.py` to ensure backend/frontend parity. - Refactored WebSocket consumers to use `broadcast.*` and `direct.message` handlers with `_dispatch_broadcast` for consistent event delivery. - Enhanced `DraftStateManager` to store `draft_index` and explicitly manage `connected_participants`. - Added colored logging config in settings for improved debugging. - Frontend: split UI into `ParticipantList` and `DraftMoviePool`, extracted message handlers (`handleDraftStatusMessages`, `handleUserIdentifyMessages`), and updated components to use new message/phase enums.
49 lines
1.8 KiB
JavaScript
49 lines
1.8 KiB
JavaScript
// AUTO-GENERATED. Do not edit by hand.
|
|
// Run: python scripts/generate_js_constants.py
|
|
|
|
|
|
export const DraftMessage = {
|
|
PARTICIPANT_JOIN_REQUEST: "participant.join.request",
|
|
PARTICIPANT_JOIN_CONFIRM: "participant.join.confirm",
|
|
PARTICIPANT_JOIN_REJECT: "participant.join.reject",
|
|
PARTICIPANT_LEAVE_INFORM: "participant.leave.inform",
|
|
USER_JOIN_INFORM: "user.join.inform",
|
|
USER_LEAVE_INFORM: "user.leave.inform",
|
|
USER_IDENTIFICATION_INFORM: "user.identification.inform",
|
|
PHASE_CHANGE_INFORM: "phase.change.inform",
|
|
PHASE_CHANGE_REQUEST: "phase.change.request",
|
|
PHASE_CHANGE_CONFIRM: "phase.change.confirm",
|
|
STATUS_SYNC_REQUEST: "status.sync.request",
|
|
STATUS_SYNC_INFORM: "status.sync.inform",
|
|
DRAFT_INDEX_ADVANCE_REQUEST: "draft.index.advance.request",
|
|
DRAFT_INDEX_ADVANCE_CONFIRM: "draft.index.advance.confirm",
|
|
ORDER_DETERMINE_REQUEST: "order.determine.request",
|
|
ORDER_DETERMINE_CONFIRM: "order.determine.confirm",
|
|
BID_START_INFORM: "bid.start.inform",
|
|
BID_PLACE_REQUEST: "bid.place.request",
|
|
BID_UPDATE_INFORM: "bid.update.inform",
|
|
BID_END_INFORM: "bid.end.inform",
|
|
NOMINATION_SUBMIT_REQUEST: "nomination.submit.request",
|
|
NOMINATION_CONFIRM: "nomination.submit.confirm",
|
|
};
|
|
|
|
export const DraftPhase = {
|
|
WAITING: 10,
|
|
DETERMINE_ORDER: 20,
|
|
NOMINATING: 30,
|
|
BIDDING: 40,
|
|
AWARDING: 50,
|
|
FINALIZING: 60,
|
|
};
|
|
|
|
export const DraftPhaseLabel = {
|
|
[DraftPhase.WAITING]: "waiting",
|
|
[DraftPhase.DETERMINE_ORDER]: "determine_order",
|
|
[DraftPhase.NOMINATING]: "nominating",
|
|
[DraftPhase.BIDDING]: "bidding",
|
|
[DraftPhase.AWARDING]: "awarding",
|
|
[DraftPhase.FINALIZING]: "finalizing",
|
|
};
|
|
|
|
export const DraftPhasesOrdered = [DraftPhase.WAITING, DraftPhase.DETERMINE_ORDER, DraftPhase.NOMINATING, DraftPhase.BIDDING, DraftPhase.AWARDING, DraftPhase.FINALIZING];
|