File size: 846 Bytes
dd64f21
 
 
d16c97d
0b5b559
5e815e0
ddb39cb
dd64f21
 
0128ae2
 
 
 
 
 
dd64f21
 
 
 
773f7ef
dd64f21
 
720467c
 
 
 
 
 
dd64f21
fe44fc7
dd64f21
d16c97d
720467c
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
28
29
30
31
32
33
34
import os
import streamlit as st

from queries.nflverse.github_data import load_assets
from data_storage import initialize_data_storage, login_by_token


def get_local_style():
    code_str = ""

    css_dir = os.path.join(os.path.dirname(__file__), "css")
    for css_file in os.listdir(css_dir):
        with open(os.path.join(css_dir, css_file)) as f:
            code_str += "<style>{}</style>".format(f.read())
            code_str += "\n"
    return code_str


def local_css():
    st.markdown(get_local_style(), unsafe_allow_html=True)


def login_token_arg_if_exists():
    url_params = st.experimental_get_query_params()
    if arg_token_list := url_params.get("token"):
        login_by_token(arg_token_list[0])


def common_page_config():
    initialize_data_storage()
    local_css()
    load_assets()
    login_token_arg_if_exists()