Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,45 +1,72 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from datetime import datetime
|
| 3 |
import time
|
| 4 |
|
| 5 |
-
st.set_page_config(page_title="
|
| 6 |
|
| 7 |
-
|
| 8 |
-
st.markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
if
|
| 25 |
-
|
| 26 |
-
elif data["status"] == "Pendiente":
|
| 27 |
-
st.warning(f"Estado: {data['status']}")
|
| 28 |
-
else:
|
| 29 |
-
st.error(f"Estado: {data['status']}")
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
st.
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import time
|
| 3 |
|
| 4 |
+
st.set_page_config(page_title="Control 300 Apps", layout="centered")
|
| 5 |
|
| 6 |
+
# Inyectamos CSS para reducir márgenes y hacer el panel ultra compacto para móvil
|
| 7 |
+
st.markdown("""
|
| 8 |
+
<style>
|
| 9 |
+
.block-container {
|
| 10 |
+
padding-top: 1rem;
|
| 11 |
+
padding-bottom: 1rem;
|
| 12 |
+
padding-left: 0.5rem;
|
| 13 |
+
padding-right: 0.5rem;
|
| 14 |
+
}
|
| 15 |
+
h1 { font-size: 1.4rem !important; margin-bottom: 0px; }
|
| 16 |
+
p { font-size: 0.85rem !important; }
|
| 17 |
+
.row-container {
|
| 18 |
+
display: flex;
|
| 19 |
+
align-items: center;
|
| 20 |
+
justify-content: space-between;
|
| 21 |
+
padding: 4px 8px;
|
| 22 |
+
margin-bottom: 4px;
|
| 23 |
+
background-color: #1e1e1e;
|
| 24 |
+
border-radius: 6px;
|
| 25 |
+
border-left: 4px solid #555;
|
| 26 |
+
}
|
| 27 |
+
.row-active { border-left-color: #28a745; }
|
| 28 |
+
.row-error { border-left-color: #dc3545; }
|
| 29 |
+
.app-name { font-size: 0.8rem; font-weight: bold; color: #fff; width: 35%%; }
|
| 30 |
+
.app-status { font-size: 0.75rem; width: 30%%; }
|
| 31 |
+
</style>
|
| 32 |
+
""", unsafe_allow_html=True)
|
| 33 |
|
| 34 |
+
st.title("⚡ Control 300 Apps (Modo Compacto)")
|
| 35 |
+
st.text("Vista de alta densidad para iPhone")
|
| 36 |
+
|
| 37 |
+
# Simulación de generación de 300 apps (puedes cargar tu lista real aquí)
|
| 38 |
+
if 'apps_list' not in st.session_state:
|
| 39 |
+
st.session_state.apps_list = {
|
| 40 |
+
f"App_{i:03d}": {"active": i % 3 != 0, "last": "02:00"}
|
| 41 |
+
for i in range(1, 301)
|
| 42 |
}
|
| 43 |
|
| 44 |
+
# Buscador rápido para filtrar entre las 300
|
| 45 |
+
search = st.text_input("🔍 Filtrar App...", placeholder="Ej: App_045")
|
| 46 |
|
| 47 |
+
# Contenedor con scroll para ver muchas en poco espacio vertical
|
| 48 |
+
with st.container():
|
| 49 |
+
for name, data in st.session_state.apps_list.items():
|
| 50 |
+
if search and search.lower() not in name.lower():
|
| 51 |
+
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
is_active = data["active"]
|
| 54 |
+
border_class = "row-active" if is_active else "row-error"
|
| 55 |
+
status_text = "🟢 Activa" if is_active else "🔴 Detenida"
|
| 56 |
|
| 57 |
+
# Estructura en fila usando columnas de Streamlit ultra ajustadas
|
| 58 |
+
cols = st.columns([3, 2, 2])
|
| 59 |
+
|
| 60 |
+
with cols[0]:
|
| 61 |
+
st.markdown(f"<p style='margin:0; font-size:0.8rem;'><b>{name}</b></p>", unsafe_allow_html=True)
|
| 62 |
+
|
| 63 |
+
with cols[1]:
|
| 64 |
+
st.markdown(f"<p style='margin:0; font-size:0.75rem;'>{status_text}</p>", unsafe_allow_html=True)
|
| 65 |
+
|
| 66 |
+
with cols[2]:
|
| 67 |
+
if st.button("Ejecutar", key=f"btn_{name}", help=f"Forzar {name}"):
|
| 68 |
+
st.toast(f"🚀 Ejecutando {name}...")
|
| 69 |
+
time.sleep(0.5)
|
| 70 |
+
st.rerun()
|
| 71 |
+
|
| 72 |
+
st.markdown("<hr style='margin:2px 0; border-color:#333;'>", unsafe_allow_html=True)
|