Skip to content

Commit 70baada

Browse files
authored
Update 7_Dashboard.py
1 parent 73ed8fd commit 70baada

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

pages/7_Dashboard.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,49 @@
2323
except FileNotFoundError:
2424
pass
2525

26+
# ==========================================
27+
# 🔐 Subscription Guard Check
28+
# ==========================================
29+
user_plan = st.session_state.get("user_plan", "Pro") # الخيارات: 'Free', 'Pro', 'Enterprise'
30+
2631
st.title("📊 Executive Dashboard & AI Assistant")
32+
st.write("Interactive executive metrics, dynamic visual breakdowns, and real-time AI data copilot.")
33+
34+
# فحص مستوى اشتراك المستخدم
35+
if user_plan == "Free":
36+
st.warning("🔒 **Premium Feature Locked:** Executive Dashboard and Interactive AI Copilot are available on **Pro** and **Enterprise** plans.")
37+
38+
col_p1, col_p2 = st.columns(2)
39+
with col_p1:
40+
st.info("💡 **Upgrade to Pro Plan**\n- Dynamic executive slicers & KPIs\n- Full interactive chart breakdown\n- Real-time AI Data Copilot")
41+
with col_p2:
42+
st.success("🚀 **Enterprise Plan**\n- Custom dashboard layouts\n- Automated reporting exports\n- Dedicated priority support")
43+
44+
if st.button("⭐ Upgrade Subscription Now", type="primary", use_container_width=True):
45+
st.switch_page("pages/8_Pricing.py")
46+
st.stop()
2747

2848
# ==========================================
2949
# 1. Check Dataset Availability
3050
# ==========================================
3151
if "df" not in st.session_state or st.session_state["df"] is None:
32-
st.warning("⚠️ Please upload a dataset first in the Upload page!")
52+
st.warning("📂 Please upload a dataset or select the Demo Dataset from the Home / Upload page first.")
53+
54+
col_nav1, col_nav2 = st.columns(2)
55+
with col_nav1:
56+
if st.button("🏠 Go to Home Page", type="primary", use_container_width=True):
57+
st.switch_page("Home.py")
58+
with col_nav2:
59+
if st.button("📤 Go to Upload Page", type="secondary", use_container_width=True):
60+
st.switch_page("pages/2_Upload.py")
61+
3362
st.stop()
3463

3564
df = st.session_state["df"]
65+
file_name = st.session_state.get("file_name", "Dataset")
66+
67+
st.info(f"📁 Active Dataset: **{file_name}** | Dimensions: **{df.shape[0]:,} rows × {df.shape[1]} columns** | Plan: **{user_plan} Member** 🌟")
68+
st.divider()
3669

3770
# تصنيف الأعمدة
3871
categorical_cols = df.select_dtypes(include=['object', 'category']).columns.tolist()
@@ -255,4 +288,4 @@
255288
col_b1, col_b2, col_b3 = st.columns([1, 2, 1])
256289
with col_b2:
257290
if st.button("Proceed to AI Analysis ➔", type="primary", use_container_width=True, key="btn_proceed_ml"):
258-
st.switch_page("pages/8_AI_Analysis.py") # أو اسم الملف الفعلي لديك لصفحة AI Analysis
291+
st.switch_page("pages/8_AI_Analysis.py")

0 commit comments

Comments
 (0)