Add live bidding UI and backend support; integrate react-bootstrap
- Added 'react-bootstrap' to frontend dependencies for improved UI components.
- Updated bid placement mechanics: backend now stores bids as a list of {user, amount}; frontend displays live bid leaderboard, including highest bid.
- Implemented bid placement form and UI in participant draft screen.
- Used React-Bootstrap Collapse for nominee menu accordion behavior.
- Expanded DraftStateManager and websocket consumers to broadcast bid updates in the new format.
- Added missing 'bids' syncing to all relevant state handling code.
- Improved styling for bidding, panel headers, and pick lists in SCSS; leveraged Bootstrap variables/utilities more extensively.
- Other minor JS, Python, and style tweaks for better stability and robustness.
This commit is contained in:
@@ -99,6 +99,7 @@ class DraftConsumerBase(AsyncJsonWebsocketConsumer):
|
||||
return self.user.is_authenticated
|
||||
|
||||
async def receive_json(self, content):
|
||||
logger.info(f"receiving message {content}")
|
||||
event_type = content.get("type")
|
||||
if event_type == DraftMessage.STATUS_SYNC_REQUEST:
|
||||
await self.send_json(
|
||||
@@ -206,7 +207,7 @@ class DraftAdminConsumer(DraftConsumerBase):
|
||||
{
|
||||
"type": "broadcast.session",
|
||||
"subtype": DraftMessage.BID_START_INFORM,
|
||||
"payload": self.get_draft_status(),
|
||||
"payload": {**self.draft_state},
|
||||
},
|
||||
)
|
||||
|
||||
@@ -314,6 +315,18 @@ class DraftParticipantConsumer(DraftConsumerBase):
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
if event_type == DraftMessage.BID_PLACE_REQUEST:
|
||||
bid_amount = content.get('payload',{}).get('bid_amount')
|
||||
self.draft_state.place_bid(self.user, bid_amount)
|
||||
await self.channel_layer.group_send(
|
||||
self.group_names.session,
|
||||
{
|
||||
"type": "broadcast.session",
|
||||
"subtype": DraftMessage.BID_PLACE_CONFIRM,
|
||||
"payload": {**self.draft_state},
|
||||
},
|
||||
)
|
||||
|
||||
# === Broadcast handlers ===
|
||||
|
||||
|
||||
Reference in New Issue
Block a user