DRRK/main.py

45 lines
1.3 KiB
Python

from __future__ import annotations
import streamlit as st
from dotenv import load_dotenv
from app.auth.service import AuthService, clear_session
from app.core.logging import setup_logging
from app.ui.pages import manual_operations, market_data, quik_import, securities
def main() -> None:
load_dotenv()
setup_logging()
st.set_page_config(
page_title="Портфели ДРРК", page_icon=":bar_chart:", layout="wide"
)
if not AuthService().run():
return
navigation = st.navigation(
[
st.Page(securities.render, title="Бумаги", url_path="securities"),
st.Page(market_data.render, title="Рыночные данные", url_path="market"),
st.Page(quik_import.render, title="Загрузка сделок", url_path="quik"),
st.Page(
manual_operations.render, title="Ручные операции", url_path="manual"
),
]
)
with st.sidebar:
profile = st.session_state.get("user_profile", {})
st.caption(profile.get("name") or profile.get("email", ""))
if st.button("Выйти", type="secondary"):
clear_session()
st.rerun()
navigation.run()
if __name__ == "__main__":
main()