lucadipalma commited on
Commit
983e23f
·
1 Parent(s): 8270a89

remove "play as boss" buttons after game starts

Browse files
codenames_games.db CHANGED
Binary files a/codenames_games.db and b/codenames_games.db differ
 
pages/play.py CHANGED
@@ -5,7 +5,7 @@ from support.build_graph import MyGraph
5
  from support.database import save_game_to_db
6
  from support.log_manager import logger
7
  from support.manage_game import Game
8
- from support.game_settings import TEAM_MODEL_PRESETS
9
  from support.utils import format_messages_as_feed, generate_team_html, plot_game_board_with_guesses
10
 
11
 
@@ -474,10 +474,10 @@ with gr.Blocks(fill_width=True) as demo:
474
  outputs=[blue_boss_name_input]
475
  )
476
 
477
- # Update send_btn.click - THIS IS YOUR MAIN QUESTION
478
  send_btn.click(
479
  fn=lambda: gr.Button(interactive=False),
480
- outputs=[send_btn]
 
481
  ).then(
482
  fn=process_message,
483
  inputs=[user_input, messages_state, players_state, board_state, dropdown, guessed_words_state, chat_history_state, is_human_playing_state, turn_state, graph_instance], # ADD graph_instance
 
5
  from support.database import save_game_to_db
6
  from support.log_manager import logger
7
  from support.manage_game import Game
8
+ from support.game_settings import TEAM_MODEL_PRESETS, JS_BTN
9
  from support.utils import format_messages_as_feed, generate_team_html, plot_game_board_with_guesses
10
 
11
 
 
474
  outputs=[blue_boss_name_input]
475
  )
476
 
 
477
  send_btn.click(
478
  fn=lambda: gr.Button(interactive=False),
479
+ outputs=[send_btn],
480
+ js=JS_BTN
481
  ).then(
482
  fn=process_message,
483
  inputs=[user_input, messages_state, players_state, board_state, dropdown, guessed_words_state, chat_history_state, is_human_playing_state, turn_state, graph_instance], # ADD graph_instance
support/game_settings.py CHANGED
@@ -416,6 +416,16 @@ function initCarousel() {
416
  }
417
  """
418
 
 
 
 
 
 
 
 
 
 
 
419
  CODENAMES_WORDS = [
420
  "AGENT", "AFRICA", "AIR", "ALIEN", "ALPS", "AMAZON", "AMBULANCE",
421
  "AMERICA", "ANGEL", "ANTARCTICA", "APPLE", "ARM", "ATLANTIS", "AUSTRALIA",
 
416
  }
417
  """
418
 
419
+ JS_BTN = """
420
+ () => {
421
+ // Hide all "Play as Boss" buttons when first message is sent
422
+ const bossBtns = document.querySelectorAll('.play-as-boss-btn');
423
+ bossBtns.forEach(btn => {
424
+ btn.style.display = 'none';
425
+ });
426
+ }
427
+ """
428
+
429
  CODENAMES_WORDS = [
430
  "AGENT", "AFRICA", "AIR", "ALIEN", "ALPS", "AMAZON", "AMBULANCE",
431
  "AMERICA", "ANGEL", "ANTARCTICA", "APPLE", "ARM", "ATLANTIS", "AUSTRALIA",
support/style/css.py CHANGED
@@ -1364,13 +1364,13 @@ strong {
1364
 
1365
  .firework::before {
1366
  left: 30%;
1367
- top: 60%;
1368
  animation-delay: 0s;
1369
  }
1370
 
1371
  .firework::after {
1372
  left: 70%;
1373
- top: 50%;
1374
  animation-delay: 1s;
1375
  }
1376
 
 
1364
 
1365
  .firework::before {
1366
  left: 30%;
1367
+ top: 40%;
1368
  animation-delay: 0s;
1369
  }
1370
 
1371
  .firework::after {
1372
  left: 70%;
1373
+ top: 30%;
1374
  animation-delay: 1s;
1375
  }
1376