GuglielmoTor commited on
Commit
82011d2
Β·
verified Β·
1 Parent(s): eb60621

Update ui/ui_generators.py

Browse files
Files changed (1) hide show
  1. ui/ui_generators.py +201 -1
ui/ui_generators.py CHANGED
@@ -31,7 +31,207 @@ FORMULA_ICON = "Ζ’"
31
  ACTIVE_ICON = "❌ Close" # Ensure this matches app.py
32
 
33
 
34
- # Removed display_main_dashboard as its content is now directly embedded in app.py for the Home tab.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
 
37
  def run_mentions_tab_display(token_state):
 
31
  ACTIVE_ICON = "❌ Close" # Ensure this matches app.py
32
 
33
 
34
+ def build_home_tab_ui():
35
+ """
36
+ Constructs the entire UI for the Home tab, including the header,
37
+ overview, feature cards, and navigation buttons.
38
+
39
+ Returns:
40
+ tuple: A tuple containing the Gradio Button components for
41
+ Graphs, Reports, and OKR Table, allowing app.py to
42
+ attach click handlers for tab navigation.
43
+ """
44
+ with gr.Column(scale=1, elem_classes="home-page-container"):
45
+ # Main header with welcome message
46
+ gr.Markdown("""
47
+ <div style="text-align: center; padding: 30px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 15px; margin-bottom: 30px; box-shadow: 0 8px 25px rgba(0,0,0,0.15); color: white;">
48
+ <h1 style="color: white; margin-bottom: 20px; font-size: 2.5em; text-shadow: 2px 2px 4px rgba(0,0,0,0.3);">
49
+ πŸš€ LinkedIn Employer Brand Analytics Dashboard
50
+ </h1>
51
+ <p style="font-size: 1.3em; line-height: 1.8; margin-bottom: 15px; text-shadow: 1px 1px 2px rgba(0,0,0,0.3);">
52
+ Transform your LinkedIn presence with data-driven insights and actionable strategies
53
+ </p>
54
+ <p style="font-size: 1.1em; opacity: 0.9; text-shadow: 1px 1px 2px rgba(0,0,0,0.3);">
55
+ Measure, analyze, and enhance your employer brand to attract top talent
56
+ </p>
57
+ </div>
58
+ """)
59
+
60
+ # Overview section
61
+ gr.Markdown("""
62
+ <div style="background-color: #f8f9fa; padding: 25px; border-radius: 12px; margin-bottom: 25px; border-left: 5px solid #007bff;">
63
+ <h2 style="color: #2c3e50; margin-bottom: 15px; display: flex; align-items: center;">
64
+ <span style="margin-right: 10px;">πŸ“Š</span> What This Dashboard Offers
65
+ </h2>
66
+ <p style="font-size: 1.1em; color: #495057; line-height: 1.7; margin-bottom: 15px;">
67
+ Our comprehensive analytics platform helps you understand and optimize your LinkedIn employer brand performance through:
68
+ </p>
69
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-top: 20px;">
70
+ <div style="display: flex; align-items: center; padding: 10px;">
71
+ <span style="font-size: 1.5em; margin-right: 12px;">πŸ“ˆ</span>
72
+ <span style="color: #495057;">Real-time data visualization and trend analysis</span>
73
+ </div>
74
+ <div style="display: flex; align-items: center; padding: 10px;">
75
+ <span style="font-size: 1.5em; margin-right: 12px;">πŸ“‹</span>
76
+ <span style="color: #495057;">Automated quarterly and weekly performance reports</span>
77
+ </div>
78
+ <div style="display: flex; align-items: center; padding: 10px;">
79
+ <span style="font-size: 1.5em; margin-right: 12px;">🎯</span>
80
+ <span style="color: #495057;">AI-powered OKRs and actionable recommendations</span>
81
+ </div>
82
+ <div style="display: flex; align-items: center; padding: 10px;">
83
+ <span style="font-size: 1.5em; margin-right: 12px;">πŸš€</span>
84
+ <span style="color: #495057;">Strategic insights to improve employer branding</span>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ """)
89
+
90
+ # Main navigation cards
91
+ with gr.Row(equal_height=True):
92
+ with gr.Column():
93
+ gr.Markdown("""
94
+ <div style="background: linear-gradient(135deg, #4CAF50, #45a049); padding: 25px; border-radius: 15px; min-height: 220px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3); transition: transform 0.3s ease;">
95
+ <div>
96
+ <h3 style="color: white; margin-bottom: 15px; font-size: 1.4em; display: flex; align-items: center;">
97
+ <span style="font-size: 1.8em; margin-right: 12px;">πŸ“ˆ</span> Interactive Graphs
98
+ </h3>
99
+ <p style="color: rgba(255,255,255,0.95); line-height: 1.6; font-size: 1.05em; margin-bottom: 20px;">
100
+ Explore dynamic visualizations of your LinkedIn performance metrics. Track post engagement,
101
+ follower growth, mentions sentiment, and identify trends over time with interactive charts
102
+ and filtering options.
103
+ </p>
104
+ </div>
105
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-top: 15px;">
106
+ <div style="color: rgba(255,255,255,0.8); font-size: 0.9em;">
107
+ ✨ Real-time analytics<br/>
108
+ πŸ“Š Multiple chart types<br/>
109
+ πŸ” Advanced filtering
110
+ </div>
111
+ <div style="background: rgba(255,255,255,0.2); padding: 8px; border-radius: 8px;">
112
+ <span style="font-size: 2em;">πŸ“Š</span>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ """)
117
+ btn_graphs = gr.Button("πŸš€ Explore Graphs", variant="primary", size="lg",
118
+ elem_classes="nav-button", scale=1)
119
+
120
+ with gr.Column():
121
+ gr.Markdown("""
122
+ <div style="background: linear-gradient(135deg, #2196F3, #1976D2); padding: 25px; border-radius: 15px; min-height: 220px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 6px 20px rgba(33, 150, 243, 0.3); transition: transform 0.3s ease;">
123
+ <div>
124
+ <h3 style="color: white; margin-bottom: 15px; font-size: 1.4em; display: flex; align-items: center;">
125
+ <span style="font-size: 1.8em; margin-right: 12px;">πŸ“Š</span> Analysis Reports
126
+ </h3>
127
+ <p style="color: rgba(255,255,255,0.95); line-height: 1.6; font-size: 1.05em; margin-bottom: 20px;">
128
+ Access comprehensive quarterly and weekly reports powered by AI analysis. Get detailed
129
+ insights into your employer brand performance, competitor analysis, and market positioning
130
+ with automated report generation.
131
+ </p>
132
+ </div>
133
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-top: 15px;">
134
+ <div style="color: rgba(255,255,255,0.8); font-size: 0.9em;">
135
+ πŸ“‹ Automated reports<br/>
136
+ πŸ€– AI-powered insights<br/>
137
+ πŸ“… Weekly & quarterly
138
+ </div>
139
+ <div style="background: rgba(255,255,255,0.2); padding: 8px; border-radius: 8px;">
140
+ <span style="font-size: 2em;">πŸ“„</span>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ """)
145
+ btn_reports = gr.Button("πŸ“Š View Reports", variant="primary", size="lg",
146
+ elem_classes="nav-button", scale=1)
147
+
148
+ with gr.Row(equal_height=True):
149
+ with gr.Column():
150
+ gr.Markdown("""
151
+ <div style="background: linear-gradient(135deg, #FF9800, #F57C00); padding: 25px; border-radius: 15px; min-height: 220px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 6px 20px rgba(255, 152, 0, 0.3); transition: transform 0.3s ease;">
152
+ <div>
153
+ <h3 style="color: white; margin-bottom: 15px; font-size: 1.4em; display: flex; align-items: center;">
154
+ <span style="font-size: 1.8em; margin-right: 12px;">🎯</span> OKR Action Plan
155
+ </h3>
156
+ <p style="color: rgba(255,255,255,0.95); line-height: 1.6; font-size: 1.05em; margin-bottom: 20px;">
157
+ Discover AI-generated Objectives and Key Results (OKRs) with concrete action items.
158
+ Transform data insights into measurable goals and strategic initiatives to enhance
159
+ your employer brand effectively.
160
+ </p>
161
+ </div>
162
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-top: 15px;">
163
+ <div style="color: rgba(255,255,255,0.8); font-size: 0.9em;">
164
+ 🎯 Strategic objectives<br/>
165
+ βœ… Actionable tasks<br/>
166
+ πŸ“ˆ Measurable outcomes
167
+ </div>
168
+ <div style="background: rgba(255,255,255,0.2); padding: 8px; border-radius: 8px;">
169
+ <span style="font-size: 2em;">🎯</span>
170
+ </div>
171
+ </div>
172
+ </div>
173
+ """)
174
+ btn_okr = gr.Button("🎯 Access OKRs", variant="primary", size="lg",
175
+ elem_classes="nav-button", scale=1)
176
+
177
+ # Quick stats or tips column
178
+ with gr.Column():
179
+ gr.Markdown("""
180
+ <div style="background: linear-gradient(135deg, #9C27B0, #7B1FA2); padding: 25px; border-radius: 15px; min-height: 220px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 6px 20px rgba(156, 39, 176, 0.3);">
181
+ <div>
182
+ <h3 style="color: white; margin-bottom: 15px; font-size: 1.4em; display: flex; align-items: center;">
183
+ <span style="font-size: 1.8em; margin-right: 12px;">πŸ’‘</span> Getting Started
184
+ </h3>
185
+ <p style="color: rgba(255,255,255,0.95); line-height: 1.6; font-size: 1.05em;">
186
+ New to employer brand analytics? Start with the <strong>Graphs</strong> section to
187
+ understand your current performance, then check <strong>Reports</strong> for detailed
188
+ analysis, and finally explore <strong>OKRs</strong> for actionable next steps.
189
+ </p>
190
+ </div>
191
+ <div style="margin-top: 20px; padding: 15px; background: rgba(255,255,255,0.1); border-radius: 8px;">
192
+ <div style="color: rgba(255,255,255,0.9); font-size: 0.95em; text-align: center;">
193
+ <strong>πŸ’ͺ Pro Tip:</strong><br/>
194
+ <span style="font-size: 0.9em;">Regular monitoring leads to 40% better employer brand performance</span>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ """)
199
+ # Optional: Add a help or documentation button
200
+ btn_help = gr.Button("πŸ“š Documentation", variant="secondary", size="lg",
201
+ elem_classes="nav-button", scale=1)
202
+
203
+ # Additional information section
204
+ gr.Markdown("""
205
+ <div style="background-color: #e8f4fd; padding: 20px; border-radius: 12px; margin-top: 25px; border: 1px solid #b8daff;">
206
+ <h3 style="color: #004085; margin-bottom: 15px; display: flex; align-items: center;">
207
+ <span style="margin-right: 10px;">ℹ️</span> How It Works
208
+ </h3>
209
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px;">
210
+ <div style="display: flex; align-items: start;">
211
+ <div style="background: #007bff; color: white; border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; margin-right: 15px; flex-shrink: 0; font-weight: bold;">1</div>
212
+ <div>
213
+ <strong style="color: #004085;">Data Collection</strong><br/>
214
+ <span style="color: #495057; font-size: 0.95em;">Automatically syncs with your LinkedIn organization data</span>
215
+ </div>
216
+ </div>
217
+ <div style="display: flex; align-items: start;">
218
+ <div style="background: #007bff; color: white; border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; margin-right: 15px; flex-shrink: 0; font-weight: bold;">2</div>
219
+ <div>
220
+ <strong style="color: #004085;">AI Analysis</strong><br/>
221
+ <span style="color: #495057; font-size: 0.95em;">Advanced algorithms analyze trends and generate insights</span>
222
+ </div>
223
+ </div>
224
+ <div style="display: flex; align-items: start;">
225
+ <div style="background: #007bff; color: white; border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; margin-right: 15px; flex-shrink: 0; font-weight: bold;">3</div>
226
+ <div>
227
+ <strong style="color: #004085;">Actionable Results</strong><br/>
228
+ <span style="color: #495057; font-size: 0.95em;">Receive specific recommendations and measurable goals</span>
229
+ </div>
230
+ </div>
231
+ </div>
232
+ </div>
233
+ """)
234
+ return btn_graphs, btn_reports, btn_okr, btn_help # Return all buttons for click handlers
235
 
236
 
237
  def run_mentions_tab_display(token_state):