Spaces:
Sleeping
Sleeping
File size: 2,352 Bytes
ef78361 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | """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")
|