Surn commited on
Commit
61f620d
Β·
1 Parent(s): 522064b

Add challenge sharing

Browse files

Updated README to document the new challenge sharing feature.
Bumped version to 0.2.25 in `__init__.py`. Enhanced `ui.py`
with shareable challenge links and improved leaderboard
display.

Files changed (3) hide show
  1. README.md +3 -0
  2. battlewords/__init__.py +1 -1
  3. battlewords/ui.py +25 -16
README.md CHANGED
@@ -121,6 +121,9 @@ docker run -p8501:8501 battlewords
121
  - Persistent Storage: all game results saved locally for personal statistics without accounts.
122
  - Challenge Mode: remote storage of challenge results, multi-user leaderboard, and shareable links.
123
 
 
 
 
124
  -0.2.24
125
  - compress height
126
  - change incorrect guess tooltip location
 
121
  - Persistent Storage: all game results saved locally for personal statistics without accounts.
122
  - Challenge Mode: remote storage of challenge results, multi-user leaderboard, and shareable links.
123
 
124
+ -0.2.25
125
+ - Share challenge from expander
126
+
127
  -0.2.24
128
  - compress height
129
  - change incorrect guess tooltip location
battlewords/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.2.24"
2
  __all__ = ["models", "generator", "logic", "ui", "game_storage"]
 
1
+ __version__ = "0.2.25"
2
  __all__ = ["models", "generator", "logic", "ui", "game_storage"]
battlewords/ui.py CHANGED
@@ -538,6 +538,13 @@ def _render_header():
538
  )
539
  leaderboard_html = "".join(leaderboard_rows)
540
 
 
 
 
 
 
 
 
541
  st.markdown(
542
  f"""
543
  <div style="
@@ -557,6 +564,7 @@ def _render_header():
557
  <strong style="font-size:0.9rem;">πŸ† Leaderboard</strong>
558
  {leaderboard_html}
559
  </div>
 
560
  </div>
561
  """,
562
  unsafe_allow_html=True
@@ -582,6 +590,7 @@ def _render_header():
582
  unsafe_allow_html=True
583
  )
584
 
 
585
  inject_styles()
586
 
587
  def _render_sidebar():
@@ -669,23 +678,23 @@ def _render_sidebar():
669
 
670
  st.slider(
671
  "Volume",
672
- 0,
673
- 100,
674
- value=int(st.session_state.music_volume),
675
- step=1,
676
- key="music_volume",
677
- disabled=not (enabled and bool(tracks)),
678
- )
679
-
680
- # --- Add sound effects volume slider ---
681
  st.slider(
682
- "Sound Effects Volume",
683
- 0,
684
- 100,
685
- value=int(st.session_state.effects_volume),
686
- step=1,
687
- key="effects_volume",
688
- )
689
 
690
  selected_path = None
691
  if tracks:
 
538
  )
539
  leaderboard_html = "".join(leaderboard_rows)
540
 
541
+ # Get the challenge SID from session state
542
+ sid = st.session_state.get("loaded_game_sid")
543
+ share_html = ""
544
+ if sid:
545
+ share_url = get_shareable_url(sid)
546
+ share_html = f"<div style='margin-top:1rem;margin-bottom:0.5rem;font-size: 0.9rem;'><a href='{share_url}' target='_blank' style='color:#FFF;text-decoration:underline;'><strong>πŸ”— Share this challenge</a></strong<br/><br/><span style='font-size:0.85em;color:#ddd;'>{share_url}</span>"
547
+
548
  st.markdown(
549
  f"""
550
  <div style="
 
564
  <strong style="font-size:0.9rem;">πŸ† Leaderboard</strong>
565
  {leaderboard_html}
566
  </div>
567
+ {share_html}
568
  </div>
569
  """,
570
  unsafe_allow_html=True
 
590
  unsafe_allow_html=True
591
  )
592
 
593
+
594
  inject_styles()
595
 
596
  def _render_sidebar():
 
678
 
679
  st.slider(
680
  "Volume",
681
+ 0,
682
+ 100,
683
+ value=int(st.session_state.music_volume),
684
+ step=1,
685
+ key="music_volume",
686
+ disabled=not (enabled and bool(tracks)),
687
+ )
688
+
689
+ # --- Add sound effects volume slider ---
690
  st.slider(
691
+ "Sound Effects Volume",
692
+ 0,
693
+ 100,
694
+ value=int(st.session_state.effects_volume),
695
+ step=1,
696
+ key="effects_volume",
697
+ )
698
 
699
  selected_path = None
700
  if tracks: