GuglielmoTor commited on
Commit
9f929e5
Β·
verified Β·
1 Parent(s): 0faf79e

Update ui/ui_generators.py

Browse files
Files changed (1) hide show
  1. ui/ui_generators.py +70 -69
ui/ui_generators.py CHANGED
@@ -32,15 +32,15 @@ ACTIVE_ICON = "❌ Close" # Ensure this matches app.py
32
 
33
  def build_home_tab_ui():
34
  """
35
- Constructs the entire UI for the Home tab, including the header,
36
- overview, feature cards, and navigation buttons.
37
 
38
  Returns:
39
- tuple: A tuple containing the Gradio Button components for
40
- Graphs, Reports, and OKR Table, allowing app.py to
41
- attach click handlers for tab navigation.
42
  """
43
- # Custom CSS for enhanced styling
44
  css_styles = """
45
  <style>
46
  .hero-section {
@@ -75,7 +75,7 @@ def build_home_tab_ui():
75
  font-size: 3.2em;
76
  font-weight: 800;
77
  margin-bottom: 24px;
78
- /* Apply gradient and text-fill to the text, but not the emoji */
79
  background: linear-gradient(45deg, #ffffff, #e0e7ff);
80
  -webkit-background-clip: text;
81
  -webkit-text-fill-color: transparent;
@@ -84,16 +84,16 @@ def build_home_tab_ui():
84
  line-height: 1.2;
85
  }
86
 
87
- /* NEW CSS: Style for the rocket emoji */
88
  .hero-title .rocket-emoji {
89
- background: none; /* Remove background effect */
90
- -webkit-background-clip: unset; /* Revert background clipping */
91
  background-clip: unset;
92
- -webkit-text-fill-color: initial; /* Revert text fill color to default */
93
- color: initial; /* Ensure emoji color is default (often colorful) */
94
- text-shadow: none; /* Remove text shadow for the emoji if it impacts it negatively */
95
- display: inline-block; /* Ensure it respects vertical alignment */
96
- vertical-align: middle; /* Adjust vertical alignment if needed */
97
  }
98
 
99
  .hero-subtitle {
@@ -371,11 +371,11 @@ def build_home_tab_ui():
371
  """
372
 
373
  with gr.Column(scale=1, elem_classes="home-page-container"):
374
- # Inject custom CSS
375
  gr.HTML(css_styles)
376
 
377
- # Main hero section
378
- # MODIFIED: Wrapped the rocket emoji in a <span> with class "rocket-emoji"
379
  gr.HTML("""
380
  <div class="hero-section">
381
  <div class="hero-content">
@@ -383,64 +383,64 @@ def build_home_tab_ui():
383
  <span class="rocket-emoji">πŸš€</span> LinkedIn Employer Brand Analytics
384
  </h1>
385
  <p class="hero-subtitle">
386
- Transform your LinkedIn presence with data-driven insights and actionable strategies
387
  </p>
388
  <p class="hero-description">
389
- Measure, analyze, and enhance your employer brand to attract top talent and build a stronger digital presence
390
  </p>
391
  </div>
392
  </div>
393
  """)
394
 
395
- # Overview section with improved spacing
396
  gr.HTML("""
397
  <div class="overview-section">
398
  <h2 class="overview-header">
399
- <span>πŸ“Š</span> What This Dashboard Offers
400
  </h2>
401
  <p class="overview-text">
402
- Our comprehensive analytics platform helps you understand and optimize your LinkedIn employer brand performance with real-time insights, automated reporting, and AI-powered recommendations.
403
  </p>
404
  <div class="features-grid">
405
  <div class="feature-item">
406
  <span class="feature-icon">πŸ“ˆ</span>
407
- <span class="feature-text">Real-time data visualization and trend analysis</span>
408
  </div>
409
  <div class="feature-item">
410
  <span class="feature-icon">πŸ“‹</span>
411
- <span class="feature-text">Automated quarterly and weekly performance reports</span>
412
  </div>
413
  <div class="feature-item">
414
  <span class="feature-icon">🎯</span>
415
- <span class="feature-text">AI-powered OKRs and actionable recommendations</span>
416
  </div>
417
  <div class="feature-item">
418
  <span class="feature-icon">πŸš€</span>
419
- <span class="feature-text">Strategic insights to improve employer branding</span>
420
  </div>
421
  </div>
422
  </div>
423
  """)
424
 
425
- # Navigation cards with improved layout
426
  gr.HTML("""
427
  <div class="nav-cards-container">
428
  <div class="nav-card nav-card-graphs">
429
  <div>
430
  <h3 class="nav-card-header">
431
- <span class="nav-card-icon">πŸ“ˆ</span> Interactive Graphs
432
  </h3>
433
  <p class="nav-card-description">
434
- Explore dynamic visualizations of your LinkedIn performance metrics. Track post engagement,
435
- follower growth, mentions sentiment, and identify trends over time with interactive charts
436
- and advanced filtering options.
437
  </p>
438
  </div>
439
  <div class="nav-card-footer">
440
  <div class="nav-card-features">
441
- ✨ Real-time analytics<br/>
442
- πŸ“Š Multiple chart types<br/>
443
- πŸ” Advanced filtering
444
  </div>
445
  <div class="nav-card-badge">
446
  <span class="nav-card-badge-icon">πŸ“Š</span>
@@ -451,19 +451,19 @@ def build_home_tab_ui():
451
  <div class="nav-card nav-card-reports">
452
  <div>
453
  <h3 class="nav-card-header">
454
- <span class="nav-card-icon">πŸ“Š</span> Analysis Reports
455
  </h3>
456
  <p class="nav-card-description">
457
- Access comprehensive quarterly and weekly reports powered by AI analysis. Get detailed
458
- insights into your employer brand performance, competitor analysis, and market positioning
459
- with automated report generation.
460
  </p>
461
  </div>
462
  <div class="nav-card-footer">
463
  <div class="nav-card-features">
464
- πŸ“‹ Automated reports<br/>
465
- πŸ€– AI-powered insights<br/>
466
- πŸ“… Weekly & quarterly
467
  </div>
468
  <div class="nav-card-badge">
469
  <span class="nav-card-badge-icon">πŸ“„</span>
@@ -474,19 +474,19 @@ def build_home_tab_ui():
474
  <div class="nav-card nav-card-okr">
475
  <div>
476
  <h3 class="nav-card-header">
477
- <span class="nav-card-icon">🎯</span> OKR Action Plan
478
  </h3>
479
  <p class="nav-card-description">
480
- Discover AI-generated Objectives and Key Results (OKRs) with concrete action items.
481
- Transform data insights into measurable goals and strategic initiatives to enhance
482
- your employer brand effectively.
483
  </p>
484
  </div>
485
  <div class="nav-card-footer">
486
  <div class="nav-card-features">
487
- 🎯 Strategic objectives<br/>
488
- βœ… Actionable tasks<br/>
489
- πŸ“ˆ Measurable outcomes
490
  </div>
491
  <div class="nav-card-badge">
492
  <span class="nav-card-badge-icon">🎯</span>
@@ -497,19 +497,19 @@ def build_home_tab_ui():
497
  <div class="nav-card nav-card-help">
498
  <div>
499
  <h3 class="nav-card-header">
500
- <span class="nav-card-icon">πŸ’‘</span> Getting Started
501
  </h3>
502
  <p class="nav-card-description">
503
- New to employer brand analytics? Start with the Graphs section to
504
- understand your current performance, then check Reports for detailed
505
- analysis, and finally explore OKRs for actionable next steps.
506
  </p>
507
  </div>
508
  <div class="nav-card-footer">
509
  <div style="background: rgba(255,255,255,0.15); padding: 16px; border-radius: 12px; width: 100%; text-align: center;">
510
  <div style="color: rgba(255,255,255,0.95); font-size: 1em;">
511
- <strong>πŸ’ͺ Pro Tip:</strong><br/>
512
- <span style="font-size: 0.9em;">Regular monitoring leads to 40% better employer brand performance</span>
513
  </div>
514
  </div>
515
  </div>
@@ -517,51 +517,51 @@ def build_home_tab_ui():
517
  </div>
518
  """)
519
 
520
- # Create buttons with better spacing
521
  with gr.Row(equal_height=True):
522
  with gr.Column():
523
- btn_graphs = gr.Button("πŸš€ Explore Graphs", variant="primary", size="lg",
524
  elem_classes="nav-button", scale=1)
525
 
526
  with gr.Column():
527
- btn_reports = gr.Button("πŸ“Š View Reports", variant="primary", size="lg",
528
  elem_classes="nav-button", scale=1)
529
 
530
  with gr.Row(equal_height=True):
531
  with gr.Column():
532
- btn_okr = gr.Button("🎯 Access OKRs", variant="primary", size="lg",
533
- elem_classes="nav-button", scale=1)
534
 
535
  with gr.Column():
536
- btn_help = gr.Button("πŸ“š Documentation", variant="secondary", size="lg",
537
  elem_classes="nav-button", scale=1)
538
 
539
- # How it works section with enhanced styling
540
  gr.HTML("""
541
  <div class="how-it-works-section">
542
  <h3 class="how-it-works-header">
543
- <span>ℹ️</span> How It Works
544
  </h3>
545
  <div class="steps-grid">
546
  <div class="step-item">
547
  <div class="step-number">1</div>
548
  <div class="step-content">
549
- <div class="step-title">Data Collection</div>
550
- <div class="step-description">Automatically syncs with your LinkedIn organization data and processes engagement metrics in real-time</div>
551
  </div>
552
  </div>
553
  <div class="step-item">
554
  <div class="step-number">2</div>
555
  <div class="step-content">
556
- <div class="step-title">AI Analysis</div>
557
- <div class="step-description">Advanced algorithms analyze trends, sentiment, and performance patterns to generate actionable insights</div>
558
  </div>
559
  </div>
560
  <div class="step-item">
561
  <div class="step-number">3</div>
562
  <div class="step-content">
563
- <div class="step-title">Actionable Results</div>
564
- <div class="step-description">Receive specific recommendations, measurable goals, and strategic action plans to improve your employer brand</div>
565
  </div>
566
  </div>
567
  </div>
@@ -571,6 +571,7 @@ def build_home_tab_ui():
571
  return btn_graphs, btn_reports, btn_okr, btn_help
572
 
573
 
 
574
  def create_analytics_plot_panel(plot_label_str, plot_id_str):
575
  """
576
  Creates an individual plot panel with its plot component and action buttons.
 
32
 
33
  def build_home_tab_ui():
34
  """
35
+ Costruisce l'intera interfaccia utente per la scheda Home, inclusi l'intestazione,
36
+ la panoramica, le schede delle funzionalitΓ  e i pulsanti di navigazione.
37
 
38
  Returns:
39
+ tuple: Una tupla contenente i componenti Gradio Button per
40
+ Grafici, Report e Tabella OKR, consentendo ad app.py di
41
+ associare gestori di click per la navigazione tra le schede.
42
  """
43
+ # CSS personalizzato per uno stile migliorato
44
  css_styles = """
45
  <style>
46
  .hero-section {
 
75
  font-size: 3.2em;
76
  font-weight: 800;
77
  margin-bottom: 24px;
78
+ /* Applica gradiente e riempimento del testo al testo, ma non all'emoji */
79
  background: linear-gradient(45deg, #ffffff, #e0e7ff);
80
  -webkit-background-clip: text;
81
  -webkit-text-fill-color: transparent;
 
84
  line-height: 1.2;
85
  }
86
 
87
+ /* NUOVO CSS: Stile per l'emoji del razzo */
88
  .hero-title .rocket-emoji {
89
+ background: none; /* Rimuovi effetto di sfondo */
90
+ -webkit-background-clip: unset; /* Ripristina il ritaglio dello sfondo */
91
  background-clip: unset;
92
+ -webkit-text-fill-color: initial; /* Ripristina il colore di riempimento del testo al valore predefinito */
93
+ color: initial; /* Assicurati che il colore dell'emoji sia quello predefinito (spesso colorato) */
94
+ text-shadow: none; /* Rimuovi l'ombra del testo per l'emoji se la influisce negativamente */
95
+ display: inline-block; /* Assicurati che rispetti l'allineamento verticale */
96
+ vertical-align: middle; /* Regola l'allineamento verticale se necessario */
97
  }
98
 
99
  .hero-subtitle {
 
371
  """
372
 
373
  with gr.Column(scale=1, elem_classes="home-page-container"):
374
+ # Inietta CSS personalizzato
375
  gr.HTML(css_styles)
376
 
377
+ # Sezione principale "hero"
378
+ # MODIFICATO: Racchiuso l'emoji del razzo in uno <span> con la classe "rocket-emoji"
379
  gr.HTML("""
380
  <div class="hero-section">
381
  <div class="hero-content">
 
383
  <span class="rocket-emoji">πŸš€</span> LinkedIn Employer Brand Analytics
384
  </h1>
385
  <p class="hero-subtitle">
386
+ Trasforma la tua presenza su LinkedIn con approfondimenti basati sui dati e strategie attuabili
387
  </p>
388
  <p class="hero-description">
389
+ Misura, analizza e migliora il tuo marchio del datore di lavoro per attrarre i migliori talenti e costruire una presenza digitale piΓΉ forte
390
  </p>
391
  </div>
392
  </div>
393
  """)
394
 
395
+ # Sezione di panoramica con spaziatura migliorata
396
  gr.HTML("""
397
  <div class="overview-section">
398
  <h2 class="overview-header">
399
+ <span>πŸ“Š</span> Cosa Offre Questa Dashboard
400
  </h2>
401
  <p class="overview-text">
402
+ La nostra piattaforma di analisi completa ti aiuta a comprendere e ottimizzare le prestazioni del tuo marchio del datore di lavoro su LinkedIn con approfondimenti in tempo reale, report automatizzati e raccomandazioni basate sull'intelligenza artificiale.
403
  </p>
404
  <div class="features-grid">
405
  <div class="feature-item">
406
  <span class="feature-icon">πŸ“ˆ</span>
407
+ <span class="feature-text">Visualizzazione dei dati in tempo reale e analisi delle tendenze</span>
408
  </div>
409
  <div class="feature-item">
410
  <span class="feature-icon">πŸ“‹</span>
411
+ <span class="feature-text">Report automatici trimestrali e settimanali sulle prestazioni</span>
412
  </div>
413
  <div class="feature-item">
414
  <span class="feature-icon">🎯</span>
415
+ <span class="feature-text">OKR basati sull'IA e raccomandazioni attuabili</span>
416
  </div>
417
  <div class="feature-item">
418
  <span class="feature-icon">πŸš€</span>
419
+ <span class="feature-text">Approfondimenti strategici per migliorare il marchio del datore di lavoro</span>
420
  </div>
421
  </div>
422
  </div>
423
  """)
424
 
425
+ # Schede di navigazione con layout migliorato
426
  gr.HTML("""
427
  <div class="nav-cards-container">
428
  <div class="nav-card nav-card-graphs">
429
  <div>
430
  <h3 class="nav-card-header">
431
+ <span class="nav-card-icon">πŸ“ˆ</span> Grafici Interattivi
432
  </h3>
433
  <p class="nav-card-description">
434
+ Esplora visualizzazioni dinamiche delle tue metriche di performance su LinkedIn. Tieni traccia del coinvolgimento dei post,
435
+ della crescita dei follower, del sentiment delle menzioni e identifica le tendenze nel tempo con grafici interattivi
436
+ e opzioni di filtro avanzate.
437
  </p>
438
  </div>
439
  <div class="nav-card-footer">
440
  <div class="nav-card-features">
441
+ ✨ Analisi in tempo reale<br/>
442
+ πŸ“Š Tipi di grafici multipli<br/>
443
+ πŸ” Filtri avanzati
444
  </div>
445
  <div class="nav-card-badge">
446
  <span class="nav-card-badge-icon">πŸ“Š</span>
 
451
  <div class="nav-card nav-card-reports">
452
  <div>
453
  <h3 class="nav-card-header">
454
+ <span class="nav-card-icon">πŸ“Š</span> Report di Analisi
455
  </h3>
456
  <p class="nav-card-description">
457
+ Accedi a report trimestrali e settimanali completi basati sull'analisi dell'IA. Ottieni approfondimenti dettagliati
458
+ sulle prestazioni del tuo marchio del datore di lavoro, analisi della concorrenza e posizionamento di mercato
459
+ con la generazione automatica di report.
460
  </p>
461
  </div>
462
  <div class="nav-card-footer">
463
  <div class="nav-card-features">
464
+ πŸ“‹ Report automatizzati<br/>
465
+ πŸ€– Approfondimenti basati sull'IA<br/>
466
+ πŸ“… Settimanali e trimestrali
467
  </div>
468
  <div class="nav-card-badge">
469
  <span class="nav-card-badge-icon">πŸ“„</span>
 
474
  <div class="nav-card nav-card-okr">
475
  <div>
476
  <h3 class="nav-card-header">
477
+ <span class="nav-card-icon">🎯</span> Piano d'Azione OKR
478
  </h3>
479
  <p class="nav-card-description">
480
+ Scopri Obiettivi e Risultati Chiave (OKR) generati dall'IA con azioni concrete.
481
+ Trasforma gli approfondimenti dei dati in obiettivi misurabili e iniziative strategiche per migliorare
482
+ efficacemente il tuo marchio del datore di lavoro.
483
  </p>
484
  </div>
485
  <div class="nav-card-footer">
486
  <div class="nav-card-features">
487
+ 🎯 Obiettivi strategici<br/>
488
+ βœ… Compiti attuabili<br/>
489
+ πŸ“ˆ Risultati misurabili
490
  </div>
491
  <div class="nav-card-badge">
492
  <span class="nav-card-badge-icon">🎯</span>
 
497
  <div class="nav-card nav-card-help">
498
  <div>
499
  <h3 class="nav-card-header">
500
+ <span class="nav-card-icon">πŸ’‘</span> Per Iniziare
501
  </h3>
502
  <p class="nav-card-description">
503
+ Nuovo all'analisi del marchio del datore di lavoro? Inizia con la sezione Grafici per
504
+ comprendere le tue prestazioni attuali, quindi controlla i Report per un'analisi dettagliata
505
+ e infine esplora gli OKR per i prossimi passi attuabili.
506
  </p>
507
  </div>
508
  <div class="nav-card-footer">
509
  <div style="background: rgba(255,255,255,0.15); padding: 16px; border-radius: 12px; width: 100%; text-align: center;">
510
  <div style="color: rgba(255,255,255,0.95); font-size: 1em;">
511
+ <strong>πŸ’ͺ Consiglio Pro:</strong><br/>
512
+ <span style="font-size: 0.9em;">Il monitoraggio regolare porta a un miglioramento del 40% nelle prestazioni del marchio del datore di lavoro</span>
513
  </div>
514
  </div>
515
  </div>
 
517
  </div>
518
  """)
519
 
520
+ # Crea pulsanti con una migliore spaziatura
521
  with gr.Row(equal_height=True):
522
  with gr.Column():
523
+ btn_graphs = gr.Button("πŸš€ Esplora Grafici", variant="primary", size="lg",
524
  elem_classes="nav-button", scale=1)
525
 
526
  with gr.Column():
527
+ btn_reports = gr.Button("πŸ“Š Visualizza Report", variant="primary", size="lg",
528
  elem_classes="nav-button", scale=1)
529
 
530
  with gr.Row(equal_height=True):
531
  with gr.Column():
532
+ btn_okr = gr.Button("🎯 Accedi agli OKR", variant="primary", size="lg",
533
+ elem_classes="nav-button", scale=1)
534
 
535
  with gr.Column():
536
+ btn_help = gr.Button("πŸ“š Documentazione", variant="secondary", size="lg",
537
  elem_classes="nav-button", scale=1)
538
 
539
+ # Sezione "Come funziona" con stile migliorato
540
  gr.HTML("""
541
  <div class="how-it-works-section">
542
  <h3 class="how-it-works-header">
543
+ <span>ℹ️</span> Come Funziona
544
  </h3>
545
  <div class="steps-grid">
546
  <div class="step-item">
547
  <div class="step-number">1</div>
548
  <div class="step-content">
549
+ <div class="step-title">Raccolta Dati</div>
550
+ <div class="step-description">Si sincronizza automaticamente con i dati della tua organizzazione LinkedIn ed elabora le metriche di coinvolgimento in tempo reale</div>
551
  </div>
552
  </div>
553
  <div class="step-item">
554
  <div class="step-number">2</div>
555
  <div class="step-content">
556
+ <div class="step-title">Analisi IA</div>
557
+ <div class="step-description">Algoritmi avanzati analizzano tendenze, sentiment e modelli di performance per generare approfondimenti attuabili</div>
558
  </div>
559
  </div>
560
  <div class="step-item">
561
  <div class="step-number">3</div>
562
  <div class="step-content">
563
+ <div class="step-title">Risultati Attuabili</div>
564
+ <div class="step-description">Ricevi raccomandazioni specifiche, obiettivi misurabili e piani d'azione strategici per migliorare il tuo marchio del datore di lavoro</div>
565
  </div>
566
  </div>
567
  </div>
 
571
  return btn_graphs, btn_reports, btn_okr, btn_help
572
 
573
 
574
+
575
  def create_analytics_plot_panel(plot_label_str, plot_id_str):
576
  """
577
  Creates an individual plot panel with its plot component and action buttons.