diff --git a/src/assets/img/escudo-b2.png b/src/assets/img/escudo-b2.png new file mode 100644 index 0000000..1b8b234 Binary files /dev/null and b/src/assets/img/escudo-b2.png differ diff --git a/src/assets/img/logo_unam-b.png b/src/assets/img/logo_unam-b.png new file mode 100644 index 0000000..a9a0ea0 Binary files /dev/null and b/src/assets/img/logo_unam-b.png differ diff --git a/src/components/Card/Card.css b/src/components/Card/Card.css index 8c98e9a..9a2b6db 100644 --- a/src/components/Card/Card.css +++ b/src/components/Card/Card.css @@ -21,6 +21,10 @@ } .transition.show { + display: flex; + justify-content: center; + width: 40vw; + min-width: 340px; opacity: 1; transform: translateY(0); } @@ -68,4 +72,10 @@ .status-label.inactive { background-color: red; + } + + .profesores-container { + display: flex; + flex-wrap: wrap; + justify-content: center; } \ No newline at end of file diff --git a/src/components/Card/CardProfesores/CardProfesor.js b/src/components/Card/CardProfesores/CardProfesor.js index af25730..e7a101e 100644 --- a/src/components/Card/CardProfesores/CardProfesor.js +++ b/src/components/Card/CardProfesores/CardProfesor.js @@ -5,7 +5,12 @@ import { useDeleteTeacher } from "../../../services/teacher.services"; const API_URL = process.env.REACT_APP_API_URL; -const CardProfesor = ({ profesor, edificioNombre, permissions }) => { +const CardProfesor = ({ + profesor, + edificioNombre, + permissions, + currentPage, +}) => { const [showDialog, setShowDialog] = useState(false); const [confirmText, setConfirmText] = useState(""); const { deleteTeacher } = useDeleteTeacher(); @@ -29,6 +34,7 @@ const CardProfesor = ({ profesor, edificioNombre, permissions }) => { }; const handleViewProfesor = () => { + localStorage.setItem("lastPage", currentPage); window.location.href = `${PublicRoutes.DATAPROFESOR}${profesor.id_profesor}`; }; @@ -40,9 +46,11 @@ const CardProfesor = ({ profesor, edificioNombre, permissions }) => {
{profesor.nombre} { e.preventDefault(); @@ -106,7 +106,12 @@ function FilterProfesor() {
- +
); } diff --git a/src/components/Card/CardProfesores/Mapeo.js b/src/components/Card/CardProfesores/Mapeo.js index 1daf3b1..4a0d68f 100644 --- a/src/components/Card/CardProfesores/Mapeo.js +++ b/src/components/Card/CardProfesores/Mapeo.js @@ -29,18 +29,40 @@ const Mapeo = ({ filters, edificios, currentPage, setCurrentPage }) => { ? { profesores: profesoresData, totalPages: totalDataPages } : { profesores: profesoresActivesData, totalPages: totalActivePages }; + const [maxPagesToShow, setMaxPagesToShow] = useState(10); + + useEffect(() => { + const updateMaxPagesToShow = () => { + if (window.innerWidth < 650) { + setMaxPagesToShow(5); + } else { + setMaxPagesToShow(10); + } + }; + + window.addEventListener("resize", updateMaxPagesToShow); + updateMaxPagesToShow(); + return () => window.removeEventListener("resize", updateMaxPagesToShow); + }, []); + + useEffect(() => { + const storedPage = localStorage.getItem("lastPage"); + if (storedPage) { + localStorage.removeItem("lastPage"); + } + }, [setCurrentPage]); useEffect(() => { - setShownCards([]); if (!loadingData && !loadingActives && profesores) { + setShownCards([]); profesores.forEach((_, index) => { setTimeout(() => { setShownCards((prev) => [...prev, index]); }, index * 120); }); } - }, [loadingData, loadingActives, profesores]); - + }, [loadingData, loadingActives, profesores, currentPage]); + useEffect(() => { setTimeout(() => { window.scrollTo({ top: 0, behavior: "smooth" }); @@ -76,16 +98,15 @@ const Mapeo = ({ filters, edificios, currentPage, setCurrentPage }) => { setCurrentPage((prevPage) => prevPage + 1); } }; - + const handlePrevPage = () => { if (currentPage > 1) { setCurrentPage((prevPage) => prevPage - 1); } - }; + }; const renderPageNumbers = () => { const pageNumbers = []; - const maxPagesToShow = 5; let startPage = Math.max(1, currentPage - Math.floor(maxPagesToShow / 2)); let endPage = Math.min(totalPages, startPage + maxPagesToShow - 1); @@ -133,21 +154,29 @@ const Mapeo = ({ filters, edificios, currentPage, setCurrentPage }) => { ) : null} - {profesores.map((profesor,index) => { - const edificio = edificios.find( - (e) => e.id_edificio === profesor.id_edificio - ); - const edificioNombre = edificio ? edificio.edificio : "Desconocido"; - return ( -
-
- ); - })} +
+ {profesores.map((profesor, index) => { + const edificio = edificios.find( + (e) => e.id_edificio === profesor.id_edificio + ); + const edificioNombre = edificio ? edificio.edificio : "Desconocido"; + return ( +
+ +
+ ); + })} +