Add nomination submission and bidding start workflow
- Added `BID_START_REQUEST` and `NOMINATION_SUBMIT_REQUEST` handling in backend consumers. - Extended draft state to include `current_movie` and `bids` cache keys. - Updated frontend to: - Allow participants to nominate movies when it's their turn. - Enable admins to start bidding for the nominated movie. - Highlight the current nominated movie and the current user. - Synced state updates across clients via WebSocket events.
This commit is contained in:
@@ -40,7 +40,7 @@ export const handleDraftStatusMessages = (event, setDraftState) => {
|
||||
console.log("Message: ", type, event?.data)
|
||||
|
||||
if (!payload) return
|
||||
const {connected_participants, phase, draft_order, draft_index} = payload
|
||||
const {connected_participants, phase, draft_order, draft_index, current_movie} = payload
|
||||
|
||||
if (type == DraftMessage.STATUS_SYNC_INFORM) {
|
||||
setDraftState(payload)
|
||||
@@ -52,6 +52,7 @@ export const handleDraftStatusMessages = (event, setDraftState) => {
|
||||
...(draft_order ? { draft_order } : {}),
|
||||
...(draft_index ? { draft_index } : {}),
|
||||
...(phase ? { phase: Number(phase) } : {}),
|
||||
...(current_movie ? {current_movie} : {}),
|
||||
}))
|
||||
|
||||
}
|
||||
@@ -59,9 +60,10 @@ export const handleDraftStatusMessages = (event, setDraftState) => {
|
||||
export const handleUserIdentifyMessages = (event, setUser) => {
|
||||
const message = JSON.parse(event.data)
|
||||
const { type, payload } = message;
|
||||
console.log("Message: ", type, event?.data)
|
||||
|
||||
if (!payload) return
|
||||
const {current_user} = payload
|
||||
setUser(current_user)
|
||||
|
||||
if (type==DraftMessage.USER_IDENTIFICATION_INFORM){
|
||||
console.log("Message: ", type, event.data)
|
||||
const {user} = payload
|
||||
setUser(user)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user