Actualizar frontend/src/pages/OtrosGeneral.jsx
This commit is contained in:
@@ -13,6 +13,7 @@ export default function OtrosGeneral() {
|
||||
const [filtros, setFiltros] = useState({ anos: [2026] });
|
||||
const [data, setData] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [recargando, setRecargando] = useState(false);
|
||||
const [error, setError] = useState(null);
|
||||
const [expAlways, setExpAlways] = useState({});
|
||||
const [expAlwaysProg, setExpAlwaysProg] = useState({});
|
||||
@@ -34,11 +35,12 @@ export default function OtrosGeneral() {
|
||||
|
||||
useEffect(() => {
|
||||
let activo = true;
|
||||
if (!data) setLoading(true); // spinner solo en la primera carga
|
||||
if (!data) setLoading(true); else setRecargando(true); // spinner solo 1a carga
|
||||
setError(null);
|
||||
api.otrosGeneral(ano, mes, dia)
|
||||
.then((res) => { if (activo) { setData(res); setLoading(false); } })
|
||||
.catch((e) => { if (activo) { setError(e.message); setLoading(false); } });
|
||||
.then((res) => { if (activo) setData(res); })
|
||||
.catch((e) => { if (activo) setError(e.message); })
|
||||
.finally(() => { if (activo) { setLoading(false); setRecargando(false); } });
|
||||
return () => { activo = false; };
|
||||
}, [ano, mes, dia, reload]);
|
||||
|
||||
@@ -63,7 +65,8 @@ export default function OtrosGeneral() {
|
||||
{loading ? <Loader text="Cargando..." /> :
|
||||
error ? <ErrorBox msg={error} /> :
|
||||
!data ? <ErrorBox msg="Sin datos" /> :
|
||||
<>
|
||||
<div style={{ opacity: recargando ? 0.45 : 1, pointerEvents: recargando ? "none" : "auto",
|
||||
transition: "opacity 0.25s ease" }}>
|
||||
{/* ── Inversión Publicitaria por Sede (Always On) ── */}
|
||||
{data.matriz_always && data.matriz_always.filas && (
|
||||
<div className="card" style={{ marginTop: 4, padding: 0, overflow: "hidden" }}>
|
||||
@@ -328,7 +331,7 @@ export default function OtrosGeneral() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>}
|
||||
</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user