import time
import streamlit as st
from __init__ import CustomSidebarDefault
import streamlit_float # recommended

st.set_page_config(layout="wide", page_title="home-page")

if "test" not in st.session_state:
    st.session_state["test"] = None


streamlit_float.float_init(include_unstable_primary=False)

time.sleep(2)


# streamlit_float.float_init(include_unstable_primary=False)

data_ = [
            {"index":0, "label":"Home Page", "page":"home-page", "href":"https://custom-sidebar.streamlit.app/"},
            {"index":1, "label":"Dummy Page", "page":"dummy-page", "icon":"ri-logout-box-r-line", "href":"https://custom-sidebar.streamlit.app/dummy-page"}
        ]

if "currentPage" not in st.session_state: # required as component will be looking for this in session state to change page via `switch_page`
    st.session_state["currentPage"] = data_[0] 
else:
    st.session_state["currentPage"] = data_[0] 


with st.container():
    defaultSidebar = CustomSidebarDefault(closeNavOnLoad=True, webMedium="local", backgroundColor="brown", loadPageName=None, data=data_, LocalOrSessionStorage=1, serverRendering=False) 
    defaultSidebar.load_custom_sidebar()
    defaultSidebar.change_page()
    
    streamlit_float.float_parent(css="position:fixed; left:-1000px;")


st.subheader("This is the Home Page")
