-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreamlit_track_focus_page.py
27 lines (23 loc) · 1.03 KB
/
streamlit_track_focus_page.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit as st
from typing import Dict
from live_services import get_club_track_pbs, postprocess_club_track_pbs
from utils import prettify_time
from tm_lookups import CLUBS
from track import TRACKS
from player import PLAYERS
def track_focus_page():
"""
Shows ...
"""
st.write("More track-specific stats to come.")
selected_track = st.selectbox("Track Number", options=list(range(1,26)))
if selected_track:
if not st.session_state.get("all_pbs", None):
pbs_raw: Dict = get_club_track_pbs(CLUBS["Elliot"], TRACKS[selected_track - 1], jwt_token=st.session_state["nadeo_jwt_token"]["accessToken"])
pbs: Dict = postprocess_club_track_pbs(pbs_raw)
else:
pbs: Dict = st.session_state["all_pbs"][selected_track - 1]
st.header(pbs["track"].name)
for idx, player in enumerate(pbs["players"]):
icons = ["🏆", "🥈", "🥉"]
st.write(f"### {icons[idx]} {prettify_time(player["pb"])}: {player["player"].alias or player["player"].name}")