Skip to content

Commit

Permalink
Refactor(app): simplify the app using the new function signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
mykolaskrynnyk committed Sep 17, 2024
1 parent c6f4094 commit 40e7e0b
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@

import st_undp

st_undp.set_page_config(
title="st-undp App",
menu_items={
"Get help": "https://github.com/undp-data/st-undp",
"Report a Bug": "https://github.com/undp-data/st-undp/issues",
"About": "Developed with [st-undp](https://github.com/undp-data/st-undp).",
},
)

st_undp.apply_style()
st_undp.apply_style(title="st-undp App")

# initialise states
if st.session_state.get("title") is None:
st.session_state["title"] = "Data Futures Exchange"
st.session_state["subtitle"] = "st-undp Application"
st.session_state["logo"] = "UNDP"


# define the pages
pages = [
st.Page(
page="pages/standard.py",
title="standard components",
url_path="./", # use this pattern and not the `default` parameter
),
st.Page(
page="pages/custom.py",
title="custom components",
url_path="/custom",
),
]


# configure the header
st_undp.header(
title=st.session_state.title,
subtitle=st.session_state.subtitle,
pages={
"standard components": "./",
"custom components": "./custom",
},
title_href="https://data.undp.org",
subtitle_href="./",
pages=pages,
logo=st.session_state.logo.lower(),
)

pg = st.navigation(
pages=[
st.Page("pages/standard.py", url_path="/", default=True),
st.Page("pages/custom.py", url_path="/custom"),
],
position="hidden",
)
pg = st.navigation(pages=pages, position="hidden")
pg.run()

0 comments on commit 40e7e0b

Please sign in to comment.