Surn commited on
Commit
482ed53
Β·
1 Parent(s): 743f806

Enhance Hall navigation links and button styles

Browse files

Improved the visual styling of .hall-link buttons for both Hall of Legends and Hall of Fantastics pages. Moved "View Hall of Fantastics" and "View Hall of Legends" links to appear consistently in both empty and populated states. Swapped the order of "Current Week" and "Wordlist" cards in the Hall of Fantastics summary for better clarity. Applied minor HTML/CSS tweaks for navigation consistency and user experience. No changes to core logic.

Files changed (1) hide show
  1. battlewords/hall_of_legends.py +13 -11
battlewords/hall_of_legends.py CHANGED
@@ -286,7 +286,7 @@ def render_hall_page() -> None:
286
  .bw-table th { text-align:left; background: rgba(255,255,255,0.02); }
287
  .bw-top-row { background: linear-gradient(90deg,#ffd54d44,#ff8a6544); }
288
  .bw-return { display:block; text-align:center; margin-top:1rem; color: #fff !important;}
289
- a.hall-link, a.hall-link:visited { color: #fff; }
290
  a.hall-link:hover, .bw-return:hover {text-decoration:none; color:#0f172a; }
291
  div[data-testid="stAlertContentInfo"] {{ border-radius: 0.75rem; padding: 0.75rem 1rem; color: #e9ddff !important; }}
292
  </style>
@@ -298,7 +298,7 @@ def render_hall_page() -> None:
298
  """,
299
  unsafe_allow_html=True,
300
  )
301
- st.markdown(f"<div style='text-align:center; margin-top:0.75rem;'><a href=\"{fantastic_page_url()}\" class=\"hall-link\" target=\"_self\">View Hall of Fantastics</a></div>", unsafe_allow_html=True)
302
 
303
  hall_doc = load_hall_document()
304
  users = hall_doc.get("users", []) if isinstance(hall_doc, dict) else []
@@ -311,6 +311,7 @@ def render_hall_page() -> None:
311
  total = len(unique_names)
312
  if total == 0:
313
  st.info("No Hall of Legends entries yet. Be the first to etch your name into legend!")
 
314
  st.markdown(f"<a href=\"{game_page_url()}\" class=\"hall-link\" target=\"_self\">⟡ Return to game</a>", unsafe_allow_html=True)
315
  return
316
 
@@ -376,6 +377,7 @@ def render_hall_page() -> None:
376
  """
377
 
378
  st.markdown(table_html, unsafe_allow_html=True)
 
379
  st.markdown(f"<a class=\"bw-return\" href=\"{game_page_url()}\" target=\"_self\">⟡ Return to game</a>", unsafe_allow_html=True)
380
 
381
 
@@ -404,7 +406,7 @@ def render_fantastic_page(week_id: str = None) -> None:
404
  .bw-table th {{ text-align:left; background: rgba(255,255,255,0.03); }}
405
  .bw-top-row {{ background: linear-gradient(90deg,#facc1540,#60a5fa40); }}
406
  .bw-return {{ display:block; text-align:center; margin-top:1rem; color: #fff !important;}}
407
- a.hall-link, a.hall-link:visited {{ color: #fff; text-align:center; }}
408
  a.hall-link:hover, .bw-return:hover {{text-decoration:none; color:#0f172a; }}
409
  div[data-testid="stAlertContentInfo"] {{ border-radius: 0.75rem; padding: 0.75rem 1rem; color: #e9ddff !important; }}
410
  /* Week Navigation Styles */
@@ -430,7 +432,7 @@ def render_fantastic_page(week_id: str = None) -> None:
430
  total = len(unique_names)
431
  if total == 0:
432
  st.info("No Hall of Fantastics entries yet for this week. Claim the first Fantastic finish!", icon="βšͺ")
433
- st.markdown(f"<div style='text-align:center; margin-top:0.75rem;'><a href=\"{hall_page_url()}\" class=\"hall-link\" target=\"_self\">View Hall of Legends</a></div>", unsafe_allow_html=True)
434
 
435
  # -- Week Navigation (empty state) --
436
  prev_y, prev_w = adjust_week_id(week_id, -7)
@@ -441,7 +443,7 @@ def render_fantastic_page(week_id: str = None) -> None:
441
  <a href="?page=fantastic&week={nxt_y}-W{nxt_w:02d}" style="margin-left:auto;">Next Week ({nxt_y}-W{nxt_w:02d}) ➑️</a>
442
  </div>""",
443
  unsafe_allow_html=True)
444
-
445
  st.markdown(f"<a href=\"{game_page_url()}\" class=\"bw-return hall-link\" target=\"_self\">⟡ Return to game</a>", unsafe_allow_html=True)
446
  return
447
 
@@ -456,15 +458,14 @@ def render_fantastic_page(week_id: str = None) -> None:
456
  <div class="bw-top-cards">
457
  <div class="bw-card"><h3>🌟 Top Fantastic</h3><p><strong>{best_score}</strong> pts by <strong>{best_player}</strong></p></div>
458
  <div class="bw-card"><h3>⚑ Fastest Fantastic</h3><p><strong>{best_time:.3f}s</strong></p></div>
459
- <div class="bw-card"><h3>πŸ—“οΈ Current Week</h3><p><strong>{week_id}</strong></p></div>
460
- <div class="bw-card"><h3>🎯 Wordlist</h3><p><strong>{wordlist_name}</strong></p></div>
461
  <div class="bw-card"><h3>πŸ™Œ Total Fantastics</h3><p><strong>{total}</strong> saved runs</p></div>
 
 
462
  </div>
463
  """,
464
  unsafe_allow_html=True,
465
  )
466
- st.markdown(f"<div style='text-align:center; margin-top:0.75rem;'><a href=\"{hall_page_url()}\" class=\"hall-link\" target=\"_self\">View Hall of Legends</a></div>", unsafe_allow_html=True)
467
-
468
  display_limit = min(int(fantastic_doc.get("max_display_entries", APP_SETTINGS.get("max_display_entries", MAX_DISPLAY_ENTRIES))), MAX_DISPLAY_ENTRIES)
469
  rows_html = []
470
  for idx, entry in enumerate(entries[:display_limit], 1):
@@ -496,9 +497,10 @@ def render_fantastic_page(week_id: str = None) -> None:
496
  nxt_y, nxt_w = adjust_week_id(week_id, 7)
497
  st.markdown(
498
  f"""<div class="bw-week-nav">
499
- <a href="?page=fantastic&week={prev_y}-W{prev_w:02d}" target="_self">⬅️ Prev Week ({prev_y}-W{prev_w:02d})</a>
500
  <a href="?page=fantastic&week={nxt_y}-W{nxt_w:02d}" style="margin-left:auto;" target="_self">Next Week ({nxt_y}-W{nxt_w:02d}) ➑️</a>
501
  </div>""",
502
  unsafe_allow_html=True)
503
-
504
  st.markdown(f"<a class=\"bw-return\" href=\"{game_page_url()}\" target=\"_self\">⟡ Return to game</a>", unsafe_allow_html=True)
 
 
286
  .bw-table th { text-align:left; background: rgba(255,255,255,0.02); }
287
  .bw-top-row { background: linear-gradient(90deg,#ffd54d44,#ff8a6544); }
288
  .bw-return { display:block; text-align:center; margin-top:1rem; color: #fff !important;}
289
+ a.hall-link, a.hall-link:visited { color: #fff; color: #d7faff;text-decoration: none; font-weight: 700; font-size: 0.9rem; padding: 0.5rem 0.9rem; border-radius: 0.65rem; background: rgba(29, 100, 200, 0.3); border: 1px solid rgba(215, 250, 255, 0.3); transition: all 0.2s ease;}
290
  a.hall-link:hover, .bw-return:hover {text-decoration:none; color:#0f172a; }
291
  div[data-testid="stAlertContentInfo"] {{ border-radius: 0.75rem; padding: 0.75rem 1rem; color: #e9ddff !important; }}
292
  </style>
 
298
  """,
299
  unsafe_allow_html=True,
300
  )
301
+
302
 
303
  hall_doc = load_hall_document()
304
  users = hall_doc.get("users", []) if isinstance(hall_doc, dict) else []
 
311
  total = len(unique_names)
312
  if total == 0:
313
  st.info("No Hall of Legends entries yet. Be the first to etch your name into legend!")
314
+ st.markdown(f"<div style='text-align:center; margin-top:0.75rem;'><a href=\"{fantastic_page_url()}\" class=\"hall-link\" target=\"_self\">✨ Hall of Fantastics Leaderboard</a></div>", unsafe_allow_html=True)
315
  st.markdown(f"<a href=\"{game_page_url()}\" class=\"hall-link\" target=\"_self\">⟡ Return to game</a>", unsafe_allow_html=True)
316
  return
317
 
 
377
  """
378
 
379
  st.markdown(table_html, unsafe_allow_html=True)
380
+ st.markdown(f"<div style='text-align:center; margin-top:0.75rem;'><a href=\"{fantastic_page_url()}\" class=\"hall-link\" target=\"_self\">✨ Hall of Fantastics Leaderboard</a></div>", unsafe_allow_html=True)
381
  st.markdown(f"<a class=\"bw-return\" href=\"{game_page_url()}\" target=\"_self\">⟡ Return to game</a>", unsafe_allow_html=True)
382
 
383
 
 
406
  .bw-table th {{ text-align:left; background: rgba(255,255,255,0.03); }}
407
  .bw-top-row {{ background: linear-gradient(90deg,#facc1540,#60a5fa40); }}
408
  .bw-return {{ display:block; text-align:center; margin-top:1rem; color: #fff !important;}}
409
+ a.hall-link, a.hall-link:visited {{ color: #fff; color: #d7faff;text-decoration: none; font-weight: 700; font-size: 0.9rem; padding: 0.5rem 0.9rem; border-radius: 0.65rem; background: rgba(29, 100, 200, 0.3); border: 1px solid rgba(215, 250, 255, 0.3); transition: all 0.2s ease;}}
410
  a.hall-link:hover, .bw-return:hover {{text-decoration:none; color:#0f172a; }}
411
  div[data-testid="stAlertContentInfo"] {{ border-radius: 0.75rem; padding: 0.75rem 1rem; color: #e9ddff !important; }}
412
  /* Week Navigation Styles */
 
432
  total = len(unique_names)
433
  if total == 0:
434
  st.info("No Hall of Fantastics entries yet for this week. Claim the first Fantastic finish!", icon="βšͺ")
435
+
436
 
437
  # -- Week Navigation (empty state) --
438
  prev_y, prev_w = adjust_week_id(week_id, -7)
 
443
  <a href="?page=fantastic&week={nxt_y}-W{nxt_w:02d}" style="margin-left:auto;">Next Week ({nxt_y}-W{nxt_w:02d}) ➑️</a>
444
  </div>""",
445
  unsafe_allow_html=True)
446
+ st.markdown(f"<div style='text-align:center; margin-top:0.75rem;'><a href=\"{hall_page_url()}\" class=\"hall-link\" target=\"_self\">πŸ† Hall of Legends Leaderboard</a></div>", unsafe_allow_html=True)
447
  st.markdown(f"<a href=\"{game_page_url()}\" class=\"bw-return hall-link\" target=\"_self\">⟡ Return to game</a>", unsafe_allow_html=True)
448
  return
449
 
 
458
  <div class="bw-top-cards">
459
  <div class="bw-card"><h3>🌟 Top Fantastic</h3><p><strong>{best_score}</strong> pts by <strong>{best_player}</strong></p></div>
460
  <div class="bw-card"><h3>⚑ Fastest Fantastic</h3><p><strong>{best_time:.3f}s</strong></p></div>
 
 
461
  <div class="bw-card"><h3>πŸ™Œ Total Fantastics</h3><p><strong>{total}</strong> saved runs</p></div>
462
+ <div class="bw-card"><h3>🎯 Wordlist</h3><p><strong>{wordlist_name}</strong></p></div>
463
+ <div class="bw-card"><h3>πŸ—“οΈ Current Week</h3><p><strong>{week_id}</strong></p></div>
464
  </div>
465
  """,
466
  unsafe_allow_html=True,
467
  )
468
+
 
469
  display_limit = min(int(fantastic_doc.get("max_display_entries", APP_SETTINGS.get("max_display_entries", MAX_DISPLAY_ENTRIES))), MAX_DISPLAY_ENTRIES)
470
  rows_html = []
471
  for idx, entry in enumerate(entries[:display_limit], 1):
 
497
  nxt_y, nxt_w = adjust_week_id(week_id, 7)
498
  st.markdown(
499
  f"""<div class="bw-week-nav">
500
+ <a href="?page=fantastic&week={prev_y}-W{prev_w:02d}" target="_self">⬅️ Prev Week ({prev_y}-W{prev_w:02d})</a>
501
  <a href="?page=fantastic&week={nxt_y}-W{nxt_w:02d}" style="margin-left:auto;" target="_self">Next Week ({nxt_y}-W{nxt_w:02d}) ➑️</a>
502
  </div>""",
503
  unsafe_allow_html=True)
504
+ st.markdown(f"<div style='text-align:center; margin-top:0.75rem;'><a href=\"{hall_page_url()}\" class=\"hall-link\" target=\"_self\">πŸ† Hall of Legends Leaderboard</a></div>", unsafe_allow_html=True)
505
  st.markdown(f"<a class=\"bw-return\" href=\"{game_page_url()}\" target=\"_self\">⟡ Return to game</a>", unsafe_allow_html=True)
506
+