Skip to content

Commit

Permalink
Update to work with the latest streamlit version
Browse files Browse the repository at this point in the history
  • Loading branch information
dbespiatykh committed Dec 27, 2023
1 parent b73c534 commit 4bcba2a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 70 deletions.
4 changes: 2 additions & 2 deletions app_pages/Barcoding_SNPs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
home_page,
get_cell_style,
author_link,
back_button,
# back_button,
)


Expand Down Expand Up @@ -128,7 +128,7 @@ def main():
author_link()
page_info()
show_dataset()
back_button("mtbc-barcoding-snps")
# back_button("mtbc-barcoding-snps")


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions app_pages/Phylogeny.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
set_css,
home_page,
author_link,
back_button,
# back_button,
)


Expand Down Expand Up @@ -110,7 +110,7 @@ def main():
home_page()
page_info()
arrange_tabs()
back_button("mycobacterium-tuberculosis-complex-phylogeny")
# back_button("mycobacterium-tuberculosis-complex-phylogeny")


if __name__ == "__main__":
Expand Down
82 changes: 41 additions & 41 deletions app_pages/Reference_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
set_css,
home_page,
author_link,
back_button,
# back_button,
)


Expand All @@ -33,45 +33,45 @@ def page_info():
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<a style="text-decoration: none" href="#dataset">
<span style="color: #7a3777; font-size: 20px; font-weight: bold"
>&#x278A; </span
><span style="color: #a65aa3; font-size: 20px; font-weight: bold"
>Dataset</span
></a
>
</br>
<a style="text-decoration: none" href="#statistics">
<span style="color: #7a3777; font-size: 20px; font-weight: bold"
>&#x278B; </span
><span style="color: #a65aa3; font-size: 20px; font-weight: bold"
>Statistics</span
></a
>
</br>
<a
style="text-decoration: none"
href="#map-showing-the-distribution-of-samples"
>
<span style="color: #7a3777; font-size: 20px; font-weight: bold"
>&#x278C; </span
><span style="color: #a65aa3; font-size: 20px; font-weight: bold"
>Map</span
></a
>
<hr
style="
height: 2px;
border-width: 0;
color: #A9A5D1;
background-color: #A9A5D1;
"
/>
""",
unsafe_allow_html=True,
)
# st.markdown(
# """
# <a style="text-decoration: none" href="#dataset">
# <span style="color: #7a3777; font-size: 20px; font-weight: bold"
# >&#x278A; </span
# ><span style="color: #a65aa3; font-size: 20px; font-weight: bold"
# >Dataset</span
# ></a
# >
# </br>
# <a style="text-decoration: none" href="#statistics">
# <span style="color: #7a3777; font-size: 20px; font-weight: bold"
# >&#x278B; </span
# ><span style="color: #a65aa3; font-size: 20px; font-weight: bold"
# >Statistics</span
# ></a
# >
# </br>
# <a
# style="text-decoration: none"
# href="#map-showing-the-distribution-of-samples"
# >
# <span style="color: #7a3777; font-size: 20px; font-weight: bold"
# >&#x278C; </span
# ><span style="color: #a65aa3; font-size: 20px; font-weight: bold"
# >Map</span
# ></a
# >
# <hr
# style="
# height: 2px;
# border-width: 0;
# color: #A9A5D1;
# background-color: #A9A5D1;
# "
# />
# """,
# unsafe_allow_html=True,
# )


@st.cache_data()
Expand Down Expand Up @@ -520,7 +520,7 @@ def main():
)
get_map().to_streamlit(height=700)

back_button("reference-dataset-of-mycobacterium-tuberculosis-complex-isolates")
# back_button("reference-dataset-of-mycobacterium-tuberculosis-complex-isolates")


if __name__ == "__main__":
Expand Down
3 changes: 1 addition & 2 deletions streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ def page_info():
)


@st.cache_data(experimental_allow_widgets=True, show_spinner=False)
def buttons():
bt1, bt2, bt3, bt4, bt5, bt6 = st.columns([3, 1, 1, 1, 1, 3])
bt1, bt2, bt3, bt4, bt5, bt6 = st.columns([3, 0.9, 0.9, 0.9, 0.9, 3])

with bt1:
pass
Expand Down
45 changes: 22 additions & 23 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def set_css():
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)


@st.cache_data(experimental_allow_widgets=True, show_spinner=False)
def home_page():
home = st.button("Home")
if home:
Expand Down Expand Up @@ -130,28 +129,28 @@ def lottie_spinner():
return st_lottie_spinner(animation, loop=True, height=100, key=get_random_key())


def back_button(anchor: str):
link = f"#{anchor}"
st.markdown(
f"""
<a
style="text-decoration: none"
href="{link}">
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
fill="#7A3777"
class="bi bi-arrow-up-square-fill"
viewBox="0 0 16 16">
<path
d="M2 16a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2zm6.5-4.5V5.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 5.707V11.5a.5.5 0 0 0 1 0z"/>
</svg>
<span style="color: #a65aa3; font-weight: bold">Back to top</span>
</a>
""",
unsafe_allow_html=True,
)
# def back_button(anchor: str):
# link = f"#{anchor}"
# st.markdown(
# f"""
# <a
# style="text-decoration: none"
# href="{link}">
# <svg
# xmlns="http://www.w3.org/2000/svg"
# width="20"
# height="20"
# fill="#7A3777"
# class="bi bi-arrow-up-square-fill"
# viewBox="0 0 16 16">
# <path
# d="M2 16a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2zm6.5-4.5V5.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 5.707V11.5a.5.5 0 0 0 1 0z"/>
# </svg>
# <span style="color: #a65aa3; font-weight: bold">Back to top</span>
# </a>
# """,
# unsafe_allow_html=True,
# )


@st.cache_data(show_spinner=False)
Expand Down

0 comments on commit 4bcba2a

Please sign in to comment.