diff --git a/login.py b/login.py index 9b3f24e..f4b46fd 100644 --- a/login.py +++ b/login.py @@ -39,8 +39,11 @@ def check_local_token(): st.session_state["token"] = local_saved_token else: local_storage.deleteItem("saved_token") + _login() + else: + _login() -def login(): +def _login(): """start login process of a user""" get_email = st.form("get_email") get_email.text_input('ایمیل خود را وارد کنید', diff --git a/main.py b/main.py index 5863ada..c0d3a0a 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,7 @@ import pandas as pd import altair as alt -from login import check_local_token, login +from login import check_local_token from request import vasahm_query from menu import add_menu from text_constant import MAIN_PAGE @@ -17,7 +17,7 @@ page_title="وسهم", page_icon="./assets/favicon.ico", initial_sidebar_state='expanded') -st.session_state.ver = '0.1.7' +st.session_state.ver = '0.1.8' STREAMLIT_STATIC_PATH = Path(st.__path__[0]) / "static/static" CSS_PATH = STREAMLIT_STATIC_PATH / "media/" @@ -49,9 +49,7 @@ def sfmono(): st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') check_local_token() -if "token" not in st.session_state: - login() -else: +if "token" in st.session_state: df = pd.read_csv("data.csv").dropna() list_of_name = df['name'].to_list() name = st.sidebar.selectbox("لیست سهام", options = list_of_name) diff --git a/pages/changelog.py b/pages/changelog.py index d4001a2..1b5751f 100644 --- a/pages/changelog.py +++ b/pages/changelog.py @@ -11,8 +11,13 @@ with open("style.css", encoding="utf-8") as css: st.markdown( f'' , unsafe_allow_html= True) add_menu() +if "ver" in st.session_state: + st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') - +st.subheader('changelog: `version 0.1.8`', divider='rainbow') +st.markdown(''' + * افزودن صفحه بررسی و مقایسه صندوقهای اهرمی + * رفع باگهای کوچک''', unsafe_allow_html=False, help=None) st.subheader('changelog: `version 0.1.7`', divider='rainbow') st.markdown(''' * تغییر فرآیند لاگین کردن diff --git a/pages/leveraged_funds.py b/pages/leveraged_funds.py index a0fcf4d..eeb37f0 100644 --- a/pages/leveraged_funds.py +++ b/pages/leveraged_funds.py @@ -17,8 +17,6 @@ with open( "style.css", encoding='UTF-8') as css: st.markdown( f'' , unsafe_allow_html= True) add_menu() - -# st.sidebar.image(image="./assets/logo.png") if "ver" in st.session_state: st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') diff --git a/pages/monte_carlo.py b/pages/monte_carlo.py index 99cb0bc..c892100 100644 --- a/pages/monte_carlo.py +++ b/pages/monte_carlo.py @@ -20,8 +20,6 @@ with open( "style.css", encoding='UTF-8') as css: st.markdown( f'' , unsafe_allow_html= True) add_menu() - -# st.sidebar.image(image="./assets/logo.png") if "ver" in st.session_state: st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') diff --git a/pages/monthly_compare.py b/pages/monthly_compare.py index 06189b4..52f7cc1 100644 --- a/pages/monthly_compare.py +++ b/pages/monthly_compare.py @@ -5,7 +5,7 @@ from pages.helper.query import Queries -from login import check_local_token, login +from login import check_local_token from request import vasahm_query from slider import create_range_slider from menu import add_menu @@ -19,14 +19,11 @@ with open( "style.css", encoding='UTF-8') as css: st.markdown( f'' , unsafe_allow_html= True) add_menu() - - -st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') +if "ver" in st.session_state: + st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') check_local_token() -if "token" not in st.session_state: - login() -else: +if "token" in st.session_state: queries = Queries() has_error, data = vasahm_query(queries.QUERY_MONTHLY_COMPARE) if has_error: diff --git a/pages/portfolio.py b/pages/portfolio.py index 15598b0..2ff522b 100644 --- a/pages/portfolio.py +++ b/pages/portfolio.py @@ -5,7 +5,7 @@ import pandas as pd import altair as alt -from login import check_local_token, login +from login import check_local_token from request import index_price_history, index_price_history2 from request import vasahm_query from menu import add_menu @@ -20,7 +20,8 @@ with open("style.css", encoding="utf-8") as css: st.markdown( f'' , unsafe_allow_html= True) add_menu() - +if "ver" in st.session_state: + st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') df = pd.read_csv("data.csv").dropna() list_of_name = df['name'].to_list() @@ -72,9 +73,7 @@ def create_form(): portfolio_analyzer.form_submit_button("بررسی عملکرد سبد", on_click=add_submit_state) check_local_token() -if "token" not in st.session_state: - login() -else: +if "token" in st.session_state: if "porto_submition" not in st.session_state: st.number_input('تعداد سهام موجود در سبد خود را وارد کنید', min_value=1, diff --git a/pages/simple_chart.py b/pages/simple_chart.py index d5a4323..79b6d4b 100644 --- a/pages/simple_chart.py +++ b/pages/simple_chart.py @@ -20,9 +20,6 @@ with open( "style.css", encoding='UTF-8') as css: st.markdown( f'' , unsafe_allow_html= True) add_menu() - - -# st.sidebar.image(image="./assets/logo.png") if "ver" in st.session_state: st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') diff --git a/pages/workbench.py b/pages/workbench.py index d2b63c8..682964b 100644 --- a/pages/workbench.py +++ b/pages/workbench.py @@ -3,7 +3,7 @@ import streamlit as st import pandas as pd -from login import check_local_token, login +from login import check_local_token from request import vasahm_query from menu import add_menu @@ -19,12 +19,11 @@ add_menu() -st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') +if "ver" in st.session_state: + st.sidebar.header(f'Vasahm DashBoard `{st.session_state.ver}`') check_local_token() -if "token" not in st.session_state: - login() -else: +if "token" in st.session_state: txt = st.text_area( "Text to analyze",