Spaces:
Running
Running
| import streamlit as st | |
| from battlewords.ui import run_app, _init_session | |
| def _new_game() -> None: | |
| st.session_state.clear() | |
| _init_session() | |
| st.rerun() | |
| def main(opened=False): | |
| st.set_page_config( | |
| page_title="Battlewords", | |
| layout="wide", | |
| initial_sidebar_state=None, | |
| page_icon="app/static/favicon.ico" | |
| ) | |
| st.html(''' | |
| <!-- Google Tag Manager --> | |
| <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
| new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
| j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
| 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
| })(window,document,'script','dataLayer','GTM-MKBM5JQ6');</script> | |
| ''', unsafe_allow_javascript=True) | |
| st.html(''' | |
| <!-- Google Tag Manager (noscript) --> | |
| <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MKBM5JQ6" | |
| height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | |
| ''', unsafe_allow_javascript=True) | |
| st.markdown( | |
| """<style> | |
| div[data-testid='stSidebar'] { display: none !important; } | |
| /* #root {transition: opacity 1s ease, visibility 1s ease;} */ | |
| .bw-fadein-prep {visibility: hidden !important; opacity: 0.75; transition: opacity 1s ease, visibility 1s ease !important} | |
| .bw-fadein-prep #bw-spinner-overlay { | |
| visibility: visible !important; | |
| opacity: 1 !important; | |
| } | |
| /* #REMOVE ALERT */ | |
| .st-emotion-cache-15g2oxy.emjbblw2 { | |
| opacity: 0; | |
| display: none; | |
| } | |
| </style>""", | |
| unsafe_allow_html=True, | |
| ) | |
| run_app() | |
| if __name__ == "__main__": | |
| main() |