Spaces:
Running
Running
Update modules/ui/ui.py
Browse files- modules/ui/ui.py +39 -45
modules/ui/ui.py
CHANGED
|
@@ -131,11 +131,11 @@ def login_register_page(lang_code, t):
|
|
| 131 |
|
| 132 |
#############################################################
|
| 133 |
#############################################################
|
| 134 |
-
def login_form(lang_code,
|
| 135 |
with st.form("login_form"):
|
| 136 |
-
username = st.text_input(
|
| 137 |
-
password = st.text_input(
|
| 138 |
-
submit_button = st.form_submit_button(
|
| 139 |
|
| 140 |
if submit_button:
|
| 141 |
success, role = authenticate_user(username, password)
|
|
@@ -150,44 +150,43 @@ def login_form(lang_code, t):
|
|
| 150 |
logger.info(f"Usuario autenticado: {username}, Rol: {role}")
|
| 151 |
st.rerun()
|
| 152 |
else:
|
| 153 |
-
st.error(
|
| 154 |
|
| 155 |
|
| 156 |
#############################################################
|
| 157 |
#############################################################
|
| 158 |
-
def register_form(lang_code,
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
[t.get("professor", "Profesor"), t.get("student", "Estudiante"), t.get("administrative", "Administrativo")])
|
| 165 |
|
| 166 |
# Definimos el rol por defecto como estudiante
|
| 167 |
-
desired_role =
|
| 168 |
|
| 169 |
-
email = st.text_input(
|
| 170 |
-
reason = st.text_area(
|
| 171 |
|
| 172 |
-
if st.button(
|
| 173 |
-
logger.info(f"
|
| 174 |
-
logger.debug(f"
|
| 175 |
|
| 176 |
if not name or not lastname or not email or not institution or not reason:
|
| 177 |
-
logger.warning("
|
| 178 |
-
st.error(
|
| 179 |
elif not is_institutional_email(email):
|
| 180 |
-
logger.warning(f"
|
| 181 |
-
st.error(
|
| 182 |
else:
|
| 183 |
-
logger.info(f"
|
| 184 |
success = store_application_request(name, lastname, email, institution, current_role, desired_role, reason)
|
| 185 |
if success:
|
| 186 |
-
st.success(
|
| 187 |
-
logger.info(f"
|
| 188 |
else:
|
| 189 |
-
st.error(
|
| 190 |
-
logger.error(f"
|
| 191 |
|
| 192 |
|
| 193 |
#############################################################
|
|
@@ -199,17 +198,17 @@ def is_institutional_email(email):
|
|
| 199 |
|
| 200 |
#############################################################
|
| 201 |
#############################################################
|
| 202 |
-
def display_videos_and_info(lang_code,
|
| 203 |
# Crear tabs para cada secci贸n
|
| 204 |
tab_use_case, tab_videos, tab_events, tab_gallery, tab_news = st.tabs([
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
])
|
| 211 |
|
| 212 |
-
# Tab de Casos de uso
|
| 213 |
with tab_use_case:
|
| 214 |
use_case_videos = {
|
| 215 |
"English - Radar use chart": "https://youtu.be/fFbbtlIewgs",
|
|
@@ -223,7 +222,7 @@ def display_videos_and_info(lang_code, t):
|
|
| 223 |
"Espa帽ol - Uso del bot para buscar respuestas" : "https://www.youtube.com/watch?v=GFKDS0K2s7E"
|
| 224 |
}
|
| 225 |
|
| 226 |
-
selected_title = st.selectbox(
|
| 227 |
if selected_title in use_case_videos:
|
| 228 |
try:
|
| 229 |
st_player(use_case_videos[selected_title])
|
|
@@ -242,7 +241,7 @@ def display_videos_and_info(lang_code, t):
|
|
| 242 |
"Demo de la versi贸n de escritorio.": "https://www.youtube.com/watch?v=nP6eXbog-ZY"
|
| 243 |
}
|
| 244 |
|
| 245 |
-
selected_title = st.selectbox(
|
| 246 |
if selected_title in videos:
|
| 247 |
try:
|
| 248 |
st_player(videos[selected_title])
|
|
@@ -332,16 +331,11 @@ def display_videos_and_info(lang_code, t):
|
|
| 332 |
width=540) # Ajusta este valor seg煤n necesites
|
| 333 |
|
| 334 |
|
| 335 |
-
# Tab de Novedades
|
| 336 |
with tab_news:
|
| 337 |
-
st.markdown(""
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
- Optimizaci贸n del an谩lisis morfosint谩ctico
|
| 341 |
-
- Soporte para m煤ltiples idiomas
|
| 342 |
-
- Nuevo m贸dulo de an谩lisis del discurso
|
| 343 |
-
- Sistema de chat integrado para soporte
|
| 344 |
-
""")
|
| 345 |
|
| 346 |
# Definici贸n de __all__ para especificar qu茅 se exporta
|
| 347 |
__all__ = ['main', 'login_register_page', 'initialize_session_state']
|
|
|
|
| 131 |
|
| 132 |
#############################################################
|
| 133 |
#############################################################
|
| 134 |
+
def login_form(lang_code, landing_t):
|
| 135 |
with st.form("login_form"):
|
| 136 |
+
username = st.text_input(landing_t['email'])
|
| 137 |
+
password = st.text_input(landing_t['password'], type="password")
|
| 138 |
+
submit_button = st.form_submit_button(landing_t['login_button'])
|
| 139 |
|
| 140 |
if submit_button:
|
| 141 |
success, role = authenticate_user(username, password)
|
|
|
|
| 150 |
logger.info(f"Usuario autenticado: {username}, Rol: {role}")
|
| 151 |
st.rerun()
|
| 152 |
else:
|
| 153 |
+
st.error(landing_t['invalid_credentials'])
|
| 154 |
|
| 155 |
|
| 156 |
#############################################################
|
| 157 |
#############################################################
|
| 158 |
+
def register_form(lang_code, landing_t):
|
| 159 |
+
name = st.text_input(landing_t['name'])
|
| 160 |
+
lastname = st.text_input(landing_t['lastname'])
|
| 161 |
+
institution = st.text_input(landing_t['institution'])
|
| 162 |
+
current_role = st.selectbox(landing_t['current_role'],
|
| 163 |
+
[landing_t['professor'], landing_t['student'], landing_t['administrative']])
|
|
|
|
| 164 |
|
| 165 |
# Definimos el rol por defecto como estudiante
|
| 166 |
+
desired_role = landing_t['student']
|
| 167 |
|
| 168 |
+
email = st.text_input(landing_t['institutional_email'])
|
| 169 |
+
reason = st.text_area(landing_t['interest_reason'])
|
| 170 |
|
| 171 |
+
if st.button(landing_t['submit_application']):
|
| 172 |
+
logger.info(f"Intentando enviar solicitud para {email}")
|
| 173 |
+
logger.debug(f"Datos del formulario: name={name}, lastname={lastname}, email={email}, institution={institution}, current_role={current_role}, desired_role={desired_role}, reason={reason}")
|
| 174 |
|
| 175 |
if not name or not lastname or not email or not institution or not reason:
|
| 176 |
+
logger.warning("Env铆o de formulario incompleto")
|
| 177 |
+
st.error(landing_t['complete_all_fields'])
|
| 178 |
elif not is_institutional_email(email):
|
| 179 |
+
logger.warning(f"Email no institucional utilizado: {email}")
|
| 180 |
+
st.error(landing_t['use_institutional_email'])
|
| 181 |
else:
|
| 182 |
+
logger.info(f"Intentando almacenar solicitud para {email}")
|
| 183 |
success = store_application_request(name, lastname, email, institution, current_role, desired_role, reason)
|
| 184 |
if success:
|
| 185 |
+
st.success(landing_t['application_sent'])
|
| 186 |
+
logger.info(f"Solicitud almacenada exitosamente para {email}")
|
| 187 |
else:
|
| 188 |
+
st.error(landing_t['application_error'])
|
| 189 |
+
logger.error(f"Error al almacenar solicitud para {email}")
|
| 190 |
|
| 191 |
|
| 192 |
#############################################################
|
|
|
|
| 198 |
|
| 199 |
#############################################################
|
| 200 |
#############################################################
|
| 201 |
+
def display_videos_and_info(lang_code, landing_t):
|
| 202 |
# Crear tabs para cada secci贸n
|
| 203 |
tab_use_case, tab_videos, tab_events, tab_gallery, tab_news = st.tabs([
|
| 204 |
+
landing_t['use_cases'],
|
| 205 |
+
landing_t['presentation_videos'],
|
| 206 |
+
landing_t['academic_presentations'],
|
| 207 |
+
landing_t['event_photos'],
|
| 208 |
+
landing_t['version_control']
|
| 209 |
])
|
| 210 |
|
| 211 |
+
# Tab de Casos de uso
|
| 212 |
with tab_use_case:
|
| 213 |
use_case_videos = {
|
| 214 |
"English - Radar use chart": "https://youtu.be/fFbbtlIewgs",
|
|
|
|
| 222 |
"Espa帽ol - Uso del bot para buscar respuestas" : "https://www.youtube.com/watch?v=GFKDS0K2s7E"
|
| 223 |
}
|
| 224 |
|
| 225 |
+
selected_title = st.selectbox(landing_t['select_use_case'], list(use_case_videos.keys()))
|
| 226 |
if selected_title in use_case_videos:
|
| 227 |
try:
|
| 228 |
st_player(use_case_videos[selected_title])
|
|
|
|
| 241 |
"Demo de la versi贸n de escritorio.": "https://www.youtube.com/watch?v=nP6eXbog-ZY"
|
| 242 |
}
|
| 243 |
|
| 244 |
+
selected_title = st.selectbox(landing_t['select_presentation'], list(videos.keys()))
|
| 245 |
if selected_title in videos:
|
| 246 |
try:
|
| 247 |
st_player(videos[selected_title])
|
|
|
|
| 331 |
width=540) # Ajusta este valor seg煤n necesites
|
| 332 |
|
| 333 |
|
| 334 |
+
# Tab de Novedades - Usar contenido traducido
|
| 335 |
with tab_news:
|
| 336 |
+
st.markdown(f"### {landing_t['latest_version_title']}")
|
| 337 |
+
for update in landing_t['version_updates']:
|
| 338 |
+
st.markdown(f"- {update}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
|
| 340 |
# Definici贸n de __all__ para especificar qu茅 se exporta
|
| 341 |
__all__ = ['main', 'login_register_page', 'initialize_session_state']
|