|
import scholarpy |
|
import streamlit as st |
|
from streamlit_option_menu import option_menu |
|
from apps import ( |
|
grant, |
|
home, |
|
google, |
|
journal, |
|
orcid, |
|
organization, |
|
publication, |
|
researcher, |
|
) |
|
|
|
st.set_page_config( |
|
page_title="Scholar Web App", page_icon="chart_with_upwards_trend", layout="wide" |
|
) |
|
|
|
|
|
|
|
|
|
apps = { |
|
"home": {"title": "Home", "icon": "house"}, |
|
"grant": {"title": "Grant", "icon": "coin"}, |
|
"journal": {"title": "Journal", "icon": "journals"}, |
|
"publication": {"title": "Publication", "icon": "journal"}, |
|
"researcher": {"title": "Researcher", "icon": "person-circle"}, |
|
"orcid": {"title": "ORCID", "icon": "person-square"}, |
|
"organization": {"title": "Organization", "icon": "building"}, |
|
|
|
} |
|
|
|
|
|
titles = [app["title"] for app in apps.values()] |
|
icons = [app["icon"] for app in apps.values()] |
|
params = st.experimental_get_query_params() |
|
|
|
if "page" in params: |
|
default_index = int(titles.index(params["page"][0].lower())) |
|
else: |
|
default_index = 0 |
|
|
|
with st.sidebar: |
|
selected = option_menu( |
|
"Main Menu", |
|
options=titles, |
|
icons=icons, |
|
menu_icon="cast", |
|
default_index=default_index, |
|
) |
|
|
|
|
|
st.sidebar.info( |
|
""" |
|
**URL:** <https://scholar.gishub.org> |
|
""" |
|
) |
|
st.sidebar.info( |
|
""" |
|
**Contact:** [Qiusheng Wu](https://gishub.org) |
|
""" |
|
) |
|
|
|
|
|
if "dsl" not in st.session_state: |
|
st.session_state["dsl"] = scholarpy.Dsl() |
|
|
|
for app in apps: |
|
if apps[app]["title"] == selected: |
|
eval(f"{app}.app()") |
|
break |
|
|