Spaces:
Sleeping
Sleeping
| """ChainShift Brand Risk Monitoring Dashboard v10.0. | |
| Feature Plugin Architecture: ์ ๊ธฐ๋ฅ = features/ ๋๋ ํ ๋ฆฌ ์์ฑ โ ์๋ ๋ฑ๋ก. | |
| """ | |
| import streamlit as st | |
| from core.styles import DASHBOARD_CSS | |
| from sidebar import render_sidebar | |
| from registry import discover_features | |
| # ============================================================================= | |
| # Page Config | |
| # ============================================================================= | |
| st.set_page_config( | |
| page_title="ChainShift Dashboard", | |
| page_icon="โก", | |
| layout="wide", | |
| initial_sidebar_state="expanded", | |
| ) | |
| st.markdown(DASHBOARD_CSS, unsafe_allow_html=True) | |
| st.title("ChainShift") | |
| st.caption("AI ๊ฒ์ ํ๋ซํผ์์ ๋ธ๋๋๊ฐ ์ด๋ป๊ฒ ์ธ๊ธ๋๊ณ ์ธ์ฉ๋๋์ง ๋ถ์ํฉ๋๋ค") | |
| # ============================================================================= | |
| # Sidebar (์ธ์ฆ + ์บ ํ์ธ ์ ํ) | |
| # ============================================================================= | |
| sidebar_result = render_sidebar() | |
| if not sidebar_result: | |
| st.stop() | |
| auth_info, selected_campaign_id, selected_campaign_display = sidebar_result | |
| # ============================================================================= | |
| # Feature Discovery + Rendering | |
| # ============================================================================= | |
| features = discover_features() | |
| if not features: | |
| st.error("๋ฑ๋ก๋ Feature๊ฐ ์์ต๋๋ค. features/ ๋๋ ํ ๋ฆฌ๋ฅผ ํ์ธํ์ธ์.") | |
| st.stop() | |
| # Base context shared by all features | |
| base_ctx = { | |
| "api_key": auth_info.get("api_key"), | |
| "access_token": auth_info.get("access_token"), | |
| "campaign_id": selected_campaign_id, | |
| "campaign_name": selected_campaign_display, | |
| "user_email": auth_info.get("email"), | |
| } | |
| # Create tabs from discovered features | |
| tab_labels = [f"{f['config']['icon']} {f['config']['name']}" for f in features] | |
| tabs = st.tabs(tab_labels) | |
| for tab, feature in zip(tabs, features): | |
| with tab: | |
| try: | |
| feature["module"].render(base_ctx) | |
| except Exception as e: | |
| st.error(f"{feature['config']['name']} ๋ก๋ฉ ์คํจ: {e}") | |
| # ============================================================================= | |
| # Footer | |
| # ============================================================================= | |
| st.markdown("---") | |
| st.caption("ChainShift v10.0") | |