Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add icons to tabs and rename disclaimer tab to "Info" #166

Merged
merged 4 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions app/tab_disclaimer.py → app/tab_info.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""Disclaimer tab."""
import streamlit as st
def content_disclaimer():
with st.expander("What is this?"):
st.markdown(
"""
**Disclaimer**
Information on product details of the PTX Business Opportunity Analyser
including a citation suggestion of the tool.
"""
)
st.image("static/disclaimer.png")
st.image("static/disclaimer_2.png")
# -*- coding: utf-8 -*-
"""Info tab."""
import streamlit as st


def content_info():
with st.expander("What is this?"):
st.markdown(
"""
**Info**

Information on product details of the PTX Business Opportunity Analyser
including a citation suggestion of the tool.
"""
)
st.image("static/info.png")
st.image("static/info_2.png")
15 changes: 10 additions & 5 deletions ptxboa_streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from app.tab_country_fact_sheets import content_country_fact_sheets
from app.tab_dashboard import content_dashboard
from app.tab_deep_dive_countries import content_deep_dive_countries
from app.tab_disclaimer import content_disclaimer
from app.tab_info import content_info
from app.tab_input_data import content_input_data
from app.tab_literature import content_literature
from app.tab_market_scanning import content_market_scanning
Expand Down Expand Up @@ -86,9 +86,14 @@
"Certification schemes",
"Sustainability",
"Literature",
"Disclaimer",
"Info",
)

tabs_icons = {
"Dashboard": "house-fill",
"Info": "question-circle-fill",
}

# the "tab_key" is used to identify the sac.tabs element. Whenever a tab is switched
# programatically (e.g. via app.ptxboa.functions.move_to_tab), the "tab_key" entry is
# incremented by 1. This allows us to set the programatically set tab as the default
Expand All @@ -101,7 +106,7 @@
st.session_state[st.session_state["tab_key"]] = "Dashboard"

sac.tabs(
[sac.TabsItem(label=i) for i in tabs],
[sac.TabsItem(label=i, icon=tabs_icons.get(i, None)) for i in tabs],
index=tabs.index(st.session_state[st.session_state["tab_key"]]),
format_func="title",
align="center",
Expand Down Expand Up @@ -176,5 +181,5 @@
if st.session_state[st.session_state["tab_key"]] == "Literature":
content_literature(cd)

if st.session_state[st.session_state["tab_key"]] == "Disclaimer":
content_disclaimer()
if st.session_state[st.session_state["tab_key"]] == "Info":
content_info()
File renamed without changes
File renamed without changes