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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from PIL import Image
3
+ import base64
4
+ from streamlit_player import st_player
5
+ import logging
6
+
7
+ # Configurar logger
8
+ logging.basicConfig(level=logging.INFO)
9
+ logger = logging.getLogger(__name__)
10
+
11
+ def show_new_landing(lang_code, landing_t):
12
+ """
13
+ Nueva landing page optimizada para conversión
14
+ """
15
+
16
+ # ============================================
17
+ # 1. HEADER CON LOGOS Y SELECTOR IDIOMA
18
+ # ============================================
19
+ show_header(landing_t)
20
+
21
+ # ============================================
22
+ # 2. HERO SECTION - HEADLINE IMPACTANTE
23
+ # ============================================
24
+ show_hero_section(lang_code)
25
+
26
+ # ============================================
27
+ # 3. CUADRÍCULA 2x2 PRINCIPAL
28
+ # ============================================
29
+ show_main_grid(lang_code, landing_t)
30
+
31
+ # ============================================
32
+ # 4. CARRUSEL DE EVENTOS (FULL WIDTH)
33
+ # ============================================
34
+ show_events_carousel()
35
+
36
+ # ============================================
37
+ # 5. FOOTER
38
+ # ============================================
39
+ show_footer()
40
+
41
+ # ============================================
42
+ # COMPONENTE 1: HEADER CON LOGOS
43
+ # ============================================
44
+ def show_header(landing_t):
45
+ """Header con logos y selector de idioma"""
46
+
47
+ # Estilos CSS personalizados
48
+ st.markdown("""
49
+ <style>
50
+ .logo-grid {
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: space-between;
54
+ flex-wrap: wrap;
55
+ gap: 15px;
56
+ padding: 10px 0;
57
+ border-bottom: 1px solid #e0e0e0;
58
+ margin-bottom: 20px;
59
+ }
60
+ .logo-item {
61
+ display: flex;
62
+ flex-direction: column;
63
+ align-items: center;
64
+ justify-content: center;
65
+ }
66
+ .logo-caption {
67
+ font-size: 0.7em;
68
+ color: #666;
69
+ margin-top: 2px;
70
+ text-align: center;
71
+ }
72
+ .language-selector {
73
+ min-width: 150px;
74
+ }
75
+ </style>
76
+ """, unsafe_allow_html=True)
77
+
78
+ # Header en 5 columnas
79
+ col1, col2, col3, col4, col5 = st.columns([1.5, 1.5, 2, 2, 1.5])
80
+
81
+ with col1:
82
+ # Logo AIdeaText
83
+ st.markdown("""
84
+ <div class="logo-item">
85
+ <img src="https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/AIdeaText_Logo_vectores.png"
86
+ width="80">
87
+ <div class="logo-caption">AIdeaText</div>
88
+ </div>
89
+ """, unsafe_allow_html=True)
90
+
91
+ with col2:
92
+ # Logo ALPHA
93
+ st.markdown("""
94
+ <div class="logo-item">
95
+ <img src="https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/ALPHA_Startup%20Badges.png"
96
+ width="80">
97
+ <div class="logo-caption">ALPHA Startup</div>
98
+ </div>
99
+ """, unsafe_allow_html=True)
100
+
101
+ with col3:
102
+ # Logo NVIDIA
103
+ st.markdown("""
104
+ <div class="logo-item">
105
+ <img src="https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/socialmedia/nvidia/nvidia-inception-program-badge-rgb-for-screen.png"
106
+ width="180">
107
+ <div class="logo-caption">NVIDIA Inception Program</div>
108
+ </div>
109
+ """, unsafe_allow_html=True)
110
+
111
+ with col4:
112
+ # Logo F6S
113
+ st.markdown("""
114
+ <div class="logo-item">
115
+ <img src="https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/socialmedia/F6/F6S_Top_Company_EdTech_27.png"
116
+ width="180">
117
+ <div class="logo-caption">Top EdTech Company</div>
118
+ </div>
119
+ """, unsafe_allow_html=True)
120
+
121
+ with col5:
122
+ # Selector de idioma
123
+ languages = {'Español': 'es', 'English': 'en', 'Français': 'fr', 'Português': 'pt'}
124
+
125
+ st.markdown('<div class="language-selector">', unsafe_allow_html=True)
126
+ selected_lang = st.selectbox(
127
+ "🌐",
128
+ list(languages.keys()),
129
+ index=list(languages.values()).index(st.session_state.get('lang_code', 'es')),
130
+ label_visibility="collapsed"
131
+ )
132
+ st.markdown('</div>', unsafe_allow_html=True)
133
+
134
+ new_lang_code = languages[selected_lang]
135
+ if st.session_state.get('lang_code', 'es') != new_lang_code:
136
+ st.session_state.lang_code = new_lang_code
137
+ st.rerun()
138
+
139
+ # ============================================
140
+ # COMPONENTE 2: HERO SECTION
141
+ # ============================================
142
+ def show_hero_section(lang_code):
143
+ """Sección hero con headline impactante"""
144
+
145
+ # Headlines en diferentes idiomas
146
+ headlines = {
147
+ 'es': {
148
+ 'title': '🚀 Primer sistema de medición de desarrollo cognitivo',
149
+ 'subtitle': 'Basado en procesamiento avanzado del lenguaje natural',
150
+ 'tagline': 'No evaluamos lo que escribes. Visualizamos cómo piensas.'
151
+ },
152
+ 'en': {
153
+ 'title': '🚀 First cognitive development measurement system',
154
+ 'subtitle': 'Based on advanced natural language processing',
155
+ 'tagline': "We don't evaluate what you write. We visualize how you think."
156
+ },
157
+ 'fr': {
158
+ 'title': '🚀 Premier système de mesure du développement cognitif',
159
+ 'subtitle': 'Basé sur le traitement avancé du langage naturel',
160
+ 'tagline': "Nous n'évaluons pas ce que vous écrivez. Nous visualisons comment vous pensez."
161
+ },
162
+ 'pt': {
163
+ 'title': '🚀 Primeiro sistema de medição do desenvolvimento cognitivo',
164
+ 'subtitle': 'Baseado em processamento avançado de linguagem natural',
165
+ 'tagline': 'Não avaliamos o que você escreve. Visualizamos como você pensa.'
166
+ }
167
+ }
168
+
169
+ headline = headlines.get(lang_code, headlines['es'])
170
+
171
+ st.markdown(f"""
172
+ <div style='
173
+ background: linear-gradient(135deg, #1E3A8A 0%, #3730A3 100%);
174
+ padding: 40px 20px;
175
+ border-radius: 15px;
176
+ color: white;
177
+ margin: 20px 0 30px 0;
178
+ text-align: center;
179
+ box-shadow: 0 10px 30px rgba(30, 58, 138, 0.2);
180
+ '>
181
+ <h1 style='
182
+ font-size: 2.5em;
183
+ margin-bottom: 15px;
184
+ font-weight: 800;
185
+ '>
186
+ {headline['title']}
187
+ </h1>
188
+
189
+ <h2 style='
190
+ font-size: 1.3em;
191
+ opacity: 0.95;
192
+ margin-bottom: 20px;
193
+ font-weight: 400;
194
+ '>
195
+ {headline['subtitle']}
196
+ </h2>
197
+
198
+ <div style='
199
+ display: inline-block;
200
+ background: rgba(255, 255, 255, 0.15);
201
+ padding: 12px 25px;
202
+ border-radius: 50px;
203
+ backdrop-filter: blur(10px);
204
+ border: 1px solid rgba(255, 255, 255, 0.2);
205
+ margin: 15px 0;
206
+ '>
207
+ <strong>✨ {headline['tagline']}</strong>
208
+ </div>
209
+
210
+ <div style='
211
+ display: flex;
212
+ justify-content: center;
213
+ gap: 20px;
214
+ margin-top: 30px;
215
+ flex-wrap: wrap;
216
+ '>
217
+ <div style='text-align: center;'>
218
+ <div style='font-size: 2em;'>🏆</div>
219
+ <div><strong>Competimos por</strong></div>
220
+ <div style='font-size: 1.2em;'>$950K USD</div>
221
+ </div>
222
+
223
+ <div style='text-align: center;'>
224
+ <div style='font-size: 2em;'>🧠</div>
225
+ <div><strong>Tecnología</strong></div>
226
+ <div style='font-size: 1.2em;'>Grafos Semánticos</div>
227
+ </div>
228
+
229
+ <div style='text-align: center;'>
230
+ <div style='font-size: 2em;'>🚀</div>
231
+ <div><strong>Validado por</strong></div>
232
+ <div style='font-size: 1.2em;'>NVIDIA</div>
233
+ </div>
234
+ </div>
235
+ </div>
236
+ """, unsafe_allow_html=True)
237
+
238
+ # ============================================
239
+ # COMPONENTE 3: CUADRÍCULA 2x2 PRINCIPAL
240
+ # ============================================
241
+ def show_main_grid(lang_code, landing_t):
242
+ """Cuadrícula principal 2x2"""
243
+
244
+ # Contenedor principal
245
+ st.markdown("<div style='margin: 30px 0;'>", unsafe_allow_html=True)
246
+
247
+ # FILA 1: Formulario + Competencias
248
+ col_form, col_comp = st.columns([1, 1])
249
+
250
+ with col_form:
251
+ # CARD 1: FORMULARIO
252
+ with st.container(border=True, height=350):
253
+ st.markdown("### ✨ Accede Gratis")
254
+
255
+ # Tabs para login/registro
256
+ tab1, tab2 = st.tabs(["📝 Registrarse", "🔐 Iniciar Sesión"])
257
+
258
+ with tab1:
259
+ show_register_form(landing_t)
260
+
261
+ with tab2:
262
+ show_login_form(landing_t)
263
+
264
+ with col_comp:
265
+ # CARD 2: COMPETENCIAS
266
+ with st.container(border=True, height=350):
267
+ st.markdown("### 🏆 Competimos por $950K USD")
268
+
269
+ # Lista de competencias
270
+ competitions = [
271
+ {"name": "Learning Tools Competition", "amount": "$600K", "status": "✅ Fase II"},
272
+ {"name": "NVIDIA Inception", "amount": "$250K", "status": "💰 Capital Ventures"},
273
+ {"name": "Kaggle/Google", "amount": "$100K", "status": "🤖 Modelos Explicables"},
274
+ ]
275
+
276
+ for comp in competitions:
277
+ with st.expander(f"{comp['name']} - {comp['amount']}"):
278
+ st.markdown(f"""
279
+ **Estado:** {comp['status']}
280
+
281
+ *¿Quieres probar la tecnología que compite?*
282
+ """)
283
+
284
+ if st.button("🎯 Ser Beta Tester", use_container_width=True):
285
+ st.session_state.show_beta_form = True
286
+ st.rerun()
287
+
288
+ # FILA 2: Video + Alianzas
289
+ col_video, col_alliances = st.columns([1, 1])
290
+
291
+ with col_video:
292
+ # CARD 3: VIDEO PRINCIPAL
293
+ with st.container(border=True, height=350):
294
+ st.markdown("### 🎬 Demo en 30 Segundos")
295
+
296
+ # Player de video
297
+ try:
298
+ st_player(
299
+ "https://youtu.be/hXnwUvN1Q9Q",
300
+ height=200,
301
+ playing=False,
302
+ controls=True,
303
+ light=True
304
+ )
305
+ except:
306
+ st.image("https://via.placeholder.com/400x200?text=Demo+Video", use_column_width=True)
307
+
308
+ st.markdown("""
309
+ ---
310
+ **¿Qué verás?**
311
+ • Visualización de Grafos de Razonamiento
312
+ • Análisis en tiempo real
313
+ • Progreso cognitivo mapeado
314
+ """)
315
+
316
+ with col_alliances:
317
+ # CARD 4: ALIANZAS
318
+ with st.container(border=True, height=350):
319
+ st.markdown("### 🤝 Validado por Líderes")
320
+
321
+ # Grid de logos de aliados
322
+ cols = st.columns(4)
323
+ with cols[0]:
324
+ st.image("https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/socialmedia/nvidia/nvidia-inception-program-badge-rgb-for-screen.png",
325
+ width=70)
326
+ st.caption("NVIDIA")
327
+
328
+ with cols[1]:
329
+ st.image("https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/ALPHA_Startup%20Badges.png",
330
+ width=70)
331
+ st.caption("ALPHA")
332
+
333
+ with cols[2]:
334
+ st.image("https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/socialmedia/F6/F6S_Top_Company_EdTech_27.png",
335
+ width=70)
336
+ st.caption("F6S")
337
+
338
+ with cols[3]:
339
+ st.image("https://via.placeholder.com/70x70/4F46E5/FFFFFF?text=incMTY",
340
+ width=70)
341
+ st.caption("incMTY")
342
+
343
+ st.markdown("""
344
+ ---
345
+ **Alianzas Estratégicas:**
346
+ • NVIDIA Inception: Deep Tech
347
+ • ALPHA Startup: Validación mercado
348
+ • F6S: Top 27 EdTech global
349
+ • incMTY: Aceleración México
350
+ """)
351
+
352
+ # ============================================
353
+ # COMPONENTES DE FORMULARIOS
354
+ # ============================================
355
+ def show_register_form(landing_t):
356
+ """Formulario de registro simplificado"""
357
+
358
+ email = st.text_input("📧 Correo institucional", key="reg_email_new")
359
+ nombre = st.text_input("👤 Nombre completo", key="reg_name_new")
360
+
361
+ # Botón de registro
362
+ if st.button("🚀 Obtener Acceso Gratis", type="primary", use_container_width=True):
363
+ if email and nombre:
364
+ # Aquí iría la lógica de registro
365
+ st.success("¡Pronto recibirás acceso a la beta!")
366
+ else:
367
+ st.warning("Por favor completa todos los campos")
368
+
369
+ # Info adicional
370
+ st.markdown("""
371
+ <div style='font-size: 0.8em; color: #666; margin-top: 10px;'>
372
+ ✅ 30 días gratis<br>
373
+ ✅ Sin tarjeta de crédito<br>
374
+ ✅ Acceso inmediato a beta
375
+ </div>
376
+ """, unsafe_allow_html=True)
377
+
378
+ def show_login_form(landing_t):
379
+ """Formulario de login"""
380
+
381
+ username = st.text_input("👤 Usuario/Email", key="login_user_new")
382
+ password = st.text_input("🔒 Contraseña", type="password", key="login_pass_new")
383
+
384
+ if st.button("Ingresar", use_container_width=True):
385
+ # Aquí iría la lógica de login
386
+ st.info("Función de login en desarrollo")
387
+
388
+ # ============================================
389
+ # COMPONENTE 4: CARRUSEL DE EVENTOS
390
+ # ============================================
391
+ def show_events_carousel():
392
+ """Carrusel de eventos en full width"""
393
+
394
+ st.markdown("---")
395
+ st.markdown("### 📅 Eventos y Reconocimientos")
396
+
397
+ # Usar el carrusel existente o crear uno simplificado
398
+ try:
399
+ # Importar el carrusel existente
400
+ from .ui import show_carousel
401
+ show_carousel()
402
+ except:
403
+ # Carrusel simplificado de respaldo
404
+ eventos = [
405
+ {"titulo": "WebSummit Rio 2025", "lugar": "Rio de Janeiro, Brasil", "fecha": "Abril 2025"},
406
+ {"titulo": "PyCon 2024", "lugar": "Medellín, Colombia", "fecha": "Junio 2024"},
407
+ {"titulo": "Maker Faire 2024", "lugar": "Ciudad de México", "fecha": "Octubre 2024"},
408
+ ]
409
+
410
+ cols = st.columns(3)
411
+ for idx, evento in enumerate(eventos):
412
+ with cols[idx]:
413
+ with st.container(border=True):
414
+ st.markdown(f"#### {evento['titulo']}")
415
+ st.markdown(f"📍 **{evento['lugar']}**")
416
+ st.markdown(f"📅 {evento['fecha']}")
417
+ st.markdown("*Presentación y showcase*")
418
+
419
+ # ============================================
420
+ # COMPONENTE 5: FOOTER
421
+ # ============================================
422
+ def show_footer():
423
+ """Footer de la página"""
424
+
425
+ st.markdown("---")
426
+
427
+ col1, col2, col3 = st.columns(3)
428
+
429
+ with col1:
430
+ st.markdown("""
431
+ **📧 Contacto**
432
+
433
+ contacto@aideatext.ai
434
+ +51 123 456 789
435
+ """)
436
+
437
+ with col2:
438
+ st.markdown("""
439
+ **🔗 Enlaces**
440
+
441
+ [GitHub](https://github.com/AIdeaText)
442
+ [LinkedIn](https://linkedin.com/company/aideatext)
443
+ [Twitter](https://twitter.com/AIdeaText)
444
+ """)
445
+
446
+ with col3:
447
+ st.markdown("""
448
+ **⚖️ Legal**
449
+
450
+ © 2025 AIdeaText. Todos los derechos reservados.
451
+
452
+ NVIDIA y el logo de NVIDIA son marcas registradas de NVIDIA Corporation.
453
+ """)
454
+
455
+ st.markdown("---")
456
+ st.markdown("<div style='text-align: center; color: #666; font-size: 0.8em;'>🚀 Transformando cómo el mundo mide el pensamiento</div>",
457
+ unsafe_allow_html=True)
458
+
459
+ # ============================================
460
+ # FUNCIÓN PRINCIPAL PARA REEMPLAZAR LA ACTUAL
461
+ # ============================================
462
+ def main_new_landing():
463
+ """Función principal de la nueva landing page"""
464
+
465
+ # Inicializar estado si no existe
466
+ if 'lang_code' not in st.session_state:
467
+ st.session_state.lang_code = 'es'
468
+
469
+ # Obtener traducciones (usar el sistema existente)
470
+ from translations import get_landing_translations
471
+ landing_t = get_landing_translations(st.session_state.lang_code)
472
+
473
+ # Mostrar la nueva landing
474
+ show_new_landing(st.session_state.lang_code, landing_t)
475
+
476
+ # Exportar la función principal
477
+ __all__ = ['main_new_landing', 'show_new_landing']
478
+
479
+ if __name__ == "__main__":
480
+ main_new_landing()