GuglielmoTor commited on
Commit
52e5c4d
Β·
verified Β·
1 Parent(s): 7ba1001

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -6
app.py CHANGED
@@ -28,6 +28,10 @@ from ui.ui_generators import (
28
  create_enhanced_report_tab, # NEW: Import the function to build the enhanced Report tab UI
29
  BOMB_ICON, EXPLORE_ICON, FORMULA_ICON, ACTIVE_ICON
30
  )
 
 
 
 
31
  # NEW: Import the new OKR UI functions
32
  from ui.okr_ui_generator import create_enhanced_okr_tab, format_okrs_for_enhanced_display, get_initial_okr_display
33
  from ui.analytics_plot_generator import update_analytics_plots_figures, create_placeholder_plot
@@ -95,8 +99,12 @@ except ImportError as e:
95
  return {'header_html': '<h1>Agentic modules not loaded.</h1>', 'body_markdown': 'Report display unavailable.'}
96
 
97
 
98
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
99
- title="LinkedIn Organization Dashboard") as app:
 
 
 
 
100
  # --- STATE MANAGEMENT ---
101
  token_state = gr.State(value={
102
  "token": None, "client_id": None, "org_urn": None,
@@ -127,7 +135,18 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
127
 
128
 
129
  # --- UI LAYOUT ---
130
- gr.Markdown("# πŸš€ LinkedIn Organization Dashboard")
 
 
 
 
 
 
 
 
 
 
 
131
  url_user_token_display = gr.Textbox(label="User Token (Hidden)", interactive=False, visible=False)
132
  org_urn_display = gr.Textbox(label="Org URN (Hidden)", interactive=False, visible=False)
133
  # MODIFIED: Initially hide the status_box and make its value empty
@@ -237,7 +256,15 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
237
 
238
  with gr.Tabs() as tabs:
239
  # --- NEW HOME TAB ---
240
- with gr.TabItem("1️⃣ Home", id="tab_home"):
 
 
 
 
 
 
 
 
241
  # Call the new function from ui_generators to build the Home tab content
242
  btn_graphs, btn_reports, btn_okr, btn_help = build_home_tab_ui()
243
 
@@ -253,14 +280,26 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
253
  # --- REPLACED: Agentic Analysis Report Tab with enhanced UI ---
254
  # The create_enhanced_report_tab function now builds this entire tab's UI.
255
  # It also returns the relevant Gradio components needed for callbacks.
256
- with gr.TabItem("3️⃣ Agentic Analysis Report", id="tab_agentic_report", visible=AGENTIC_MODULES_LOADED):
 
 
 
 
 
 
257
  # The create_enhanced_report_tab function handles the CSS and HTML structure
258
  # MODIFIED: Unpacked 4 values instead of 3
259
  agentic_pipeline_status_md, report_selector_dd, report_header_html_display, report_body_markdown_display = \
260
  create_enhanced_report_tab(AGENTIC_MODULES_LOADED)
261
 
262
 
263
- with gr.TabItem("4️⃣ Agentic OKRs & Tasks", id="tab_agentic_okrs", visible=AGENTIC_MODULES_LOADED):
 
 
 
 
 
 
264
  gr.Markdown("## 🎯 AI Generated OKRs and Actionable Tasks (from Bubble.io)")
265
  gr.Markdown("Basato sull'analisi AI, l'agente ha proposto i seguenti OKR.")
266
 
 
28
  create_enhanced_report_tab, # NEW: Import the function to build the enhanced Report tab UI
29
  BOMB_ICON, EXPLORE_ICON, FORMULA_ICON, ACTIVE_ICON
30
  )
31
+
32
+ #ui import
33
+ from ui.config import custom_css, custom_theme
34
+
35
  # NEW: Import the new OKR UI functions
36
  from ui.okr_ui_generator import create_enhanced_okr_tab, format_okrs_for_enhanced_display, get_initial_okr_display
37
  from ui.analytics_plot_generator import update_analytics_plots_figures, create_placeholder_plot
 
99
  return {'header_html': '<h1>Agentic modules not loaded.</h1>', 'body_markdown': 'Report display unavailable.'}
100
 
101
 
102
+ with gr.Blocks(
103
+ theme=custom_theme,
104
+ css=custom_css,
105
+ title="LinkedIn Organization Dashboard - Enhanced",
106
+ head="<link href='https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap' rel='stylesheet'>"
107
+ ) as app:
108
  # --- STATE MANAGEMENT ---
109
  token_state = gr.State(value={
110
  "token": None, "client_id": None, "org_urn": None,
 
135
 
136
 
137
  # --- UI LAYOUT ---
138
+ # --- ENHANCED UI HEADER ---
139
+ with gr.Row():
140
+ with gr.Column():
141
+ gr.HTML("""
142
+ <div class="main-title">
143
+ πŸš€ LinkedIn Organization Dashboard
144
+ </div>
145
+ <div class="main-subtitle">
146
+ Advanced Analytics & AI-Powered Insights for Your LinkedIn Performance
147
+ </div>
148
+ """)
149
+
150
  url_user_token_display = gr.Textbox(label="User Token (Hidden)", interactive=False, visible=False)
151
  org_urn_display = gr.Textbox(label="Org URN (Hidden)", interactive=False, visible=False)
152
  # MODIFIED: Initially hide the status_box and make its value empty
 
256
 
257
  with gr.Tabs() as tabs:
258
  # --- NEW HOME TAB ---
259
+ with gr.TabItem("🏠 Home", id="tab_home"):
260
+ gr.HTML("""
261
+ <div style="text-align: center; margin: 40px 0;">
262
+ <h2 style="color: white; font-weight: 700; margin-bottom: 20px;">Welcome to Your Dashboard</h2>
263
+ <p style="color: rgba(255,255,255,0.7); font-size: 1.1rem; max-width: 600px; margin: 0 auto;">
264
+ Navigate through your LinkedIn analytics, AI-generated reports, and actionable insights to maximize your organization's social media performance.
265
+ </p>
266
+ </div>
267
+ """)
268
  # Call the new function from ui_generators to build the Home tab content
269
  btn_graphs, btn_reports, btn_okr, btn_help = build_home_tab_ui()
270
 
 
280
  # --- REPLACED: Agentic Analysis Report Tab with enhanced UI ---
281
  # The create_enhanced_report_tab function now builds this entire tab's UI.
282
  # It also returns the relevant Gradio components needed for callbacks.
283
+ with gr.TabItem("πŸ“Š AI Analysis Reports", id="tab_agentic_report", visible=AGENTIC_MODULES_LOADED):
284
+ gr.HTML("""
285
+ <div style="text-align: center; margin-bottom: 30px;">
286
+ <h2 style="color: white; font-weight: 700; margin-bottom: 10px;">Comprehensive AI Analysis</h2>
287
+ <p style="color: rgba(255,255,255,0.7);">Deep insights generated from your LinkedIn organization data</p>
288
+ </div>
289
+ """)
290
  # The create_enhanced_report_tab function handles the CSS and HTML structure
291
  # MODIFIED: Unpacked 4 values instead of 3
292
  agentic_pipeline_status_md, report_selector_dd, report_header_html_display, report_body_markdown_display = \
293
  create_enhanced_report_tab(AGENTIC_MODULES_LOADED)
294
 
295
 
296
+ with gr.TabItem("🎯 OKRs & Action Items", id="tab_agentic_okrs", visible=AGENTIC_MODULES_LOADED):
297
+ gr.HTML("""
298
+ <div style="text-align: center; margin-bottom: 30px;">
299
+ <h2 style="color: white; font-weight: 700; margin-bottom: 10px;">AI-Generated OKRs & Tasks</h2>
300
+ <p style="color: rgba(255,255,255,0.7);">Strategic objectives and actionable tasks based on your data analysis</p>
301
+ </div>
302
+ """)
303
  gr.Markdown("## 🎯 AI Generated OKRs and Actionable Tasks (from Bubble.io)")
304
  gr.Markdown("Basato sull'analisi AI, l'agente ha proposto i seguenti OKR.")
305