From 001e9d39eb1daad1f94d08ec6bba6c624ef04fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Wed, 4 Dec 2024 18:06:19 -0600 Subject: [PATCH 1/4] Se creo el panel sobre nosotros y se elimino el footer --- web/src/core/constants/selected_panel.ts | 6 +- .../admin/panel/admin_home_page.tsx | 18 ++- .../admin/panel/assets/styles/style.css | 7 +- .../components/about_us/about_us_panel.tsx | 112 ++++++++++++++++++ .../components/about_us/assets/css/styles.css | 46 +++++++ .../components/footer/assets/css/styles.css | 39 ------ .../presentation/components/footer/footer.tsx | 89 -------------- .../superadmin/panel/assets/styles/style.css | 7 +- .../panel/super_admin_home_page.tsx | 18 ++- 9 files changed, 190 insertions(+), 152 deletions(-) create mode 100644 web/src/presentation/components/about_us/about_us_panel.tsx create mode 100644 web/src/presentation/components/about_us/assets/css/styles.css delete mode 100644 web/src/presentation/components/footer/assets/css/styles.css delete mode 100644 web/src/presentation/components/footer/footer.tsx diff --git a/web/src/core/constants/selected_panel.ts b/web/src/core/constants/selected_panel.ts index d9691ddb..090e9ed5 100644 --- a/web/src/core/constants/selected_panel.ts +++ b/web/src/core/constants/selected_panel.ts @@ -4,7 +4,8 @@ export enum AdminSelectedPanel { TOWN_INFO = "town_info", // Panel for town information PLACES = "places", // Panel for places - POINT_OF_INTEREST = "point_of_interest" // Panel for points of interest + POINT_OF_INTEREST = "point_of_interest", // Panel for points of interest + ABOUT_US = "about_us" // Panel for about us } /** @@ -13,5 +14,6 @@ export enum AdminSelectedPanel { export enum SuperAdminSelectedPanel { TOWNS = "towns", // Panel for towns ADMINS = "admins", // Panel for admins - CATEGORIES = "categories" // Panel for categories + CATEGORIES = "categories", // Panel for categories + ABOUT_US = "about_us", // Panel for about us } \ No newline at end of file diff --git a/web/src/presentation/admin/panel/admin_home_page.tsx b/web/src/presentation/admin/panel/admin_home_page.tsx index 4fdff781..dd816f06 100644 --- a/web/src/presentation/admin/panel/admin_home_page.tsx +++ b/web/src/presentation/admin/panel/admin_home_page.tsx @@ -2,6 +2,7 @@ import { Menu, MenuItem, Sidebar } from "react-pro-sidebar"; import "./assets/styles/style.css"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { + faInfo, faLocation, faMonument, faPlaceOfWorship, @@ -15,8 +16,8 @@ import { LoadingScreen } from "../../components/loading_screen/loading_screen"; import { ErrorWindow } from "../../components/error_window/error_window"; import { LoadingSpinner } from "../../components/loading_spinner/loading_spinner"; import { AdminTownInfo } from "../admin_town_info/admin_town_info"; -import { Footer } from "../../components/footer/footer"; import { AdminPanelPoiScreen } from "../admin_panel_poi/admin_panel_poi_screen/admin_panel_poi_screen"; +import { AboutUsPanel } from "../../components/about_us/about_us_panel"; // Main component for the admin home page export const AdminHomePage = () => { @@ -95,6 +96,15 @@ export const AdminHomePage = () => { > Puntos de interés + } + disabled={isWindowActive} + onClick={() => { + setSelectedPanel(AdminSelectedPanel.ABOUT_US); + }} + > + Sobre nosotros +
@@ -133,15 +143,13 @@ export const AdminHomePage = () => { town={town} /> ); + case AdminSelectedPanel.ABOUT_US: + return ; default: return null; } })()}
- {/* Footer */} -
-
); diff --git a/web/src/presentation/admin/panel/assets/styles/style.css b/web/src/presentation/admin/panel/assets/styles/style.css index 7683cef5..c94ef160 100644 --- a/web/src/presentation/admin/panel/assets/styles/style.css +++ b/web/src/presentation/admin/panel/assets/styles/style.css @@ -22,12 +22,7 @@ .admin-panel-content{ max-height: 80vh; - min-height: 80vh; + min-height: 94vh; display: flex; background: white; } - -.footer-cnt{ - height: 14vh; - background: #ECEAFF; -} \ No newline at end of file diff --git a/web/src/presentation/components/about_us/about_us_panel.tsx b/web/src/presentation/components/about_us/about_us_panel.tsx new file mode 100644 index 00000000..14ceb237 --- /dev/null +++ b/web/src/presentation/components/about_us/about_us_panel.tsx @@ -0,0 +1,112 @@ +import "./assets/css/styles.css"; + +// Define the Developer interface +interface Developer { + name: string; + lastName: string; + role: string; + linkedInURL: string; + email: string; +} + +// Main component function +export const AboutUsPanel = () => { + // Inline style for text elements + const style: React.CSSProperties = { + fontSize: 11, + textDecoration: "none", + color: "black", + padding: "0px 3px", + }; + + // List of developers + const developers: Developer[] = [ + { + name: "Lorenzo", + lastName: "Trujillo", + role: "Desarrollador FrontEnd Mobile", + linkedInURL: "https://www.linkedin.com/in/lorenzotrujillorojassd/", + email: "42102130@uaz.edu.mx", + }, + { + name: "Diego I.", + lastName: "Correa", + role: "Desarrollador BackEnd", + linkedInURL: "https://www.linkedin.com/in/diego-ivan-correa/", + email: "dcorreanavarrete@gmail.com", + }, + { + name: "Omar", + lastName: "Luna", + role: "Desarrollador FrontEnd Web", + linkedInURL: + "https://www.linkedin.com/in/omar-luna-hern%C3%A1ndez-a280ba267/", + email: "omar_luna_hernandez@hotmail.com", + }, + ]; + + // Main render of the component + return ( +
+
+

Acerca de nosotros

+
+
+ Este proyecto fue desarrollado por las siguientes personas: + {/* Footer credits section */} +
+ {/* Developer links */} +
+ {developers.map((dev, index) => { + return ( +
+ + @ {dev.name + " " + dev.lastName + " (" + dev.role + ")"} + +
+

Correo:

+ + {dev.email} + +
+
+ ); + })} +
+
+ {/* Logos section */} +
+ + +
+
+ +
+
+ ©2024 + + {" "} + Labsol Network. + +
+ + Bajo licencia GPL v.3. + +
+
+ ); +}; diff --git a/web/src/presentation/components/about_us/assets/css/styles.css b/web/src/presentation/components/about_us/assets/css/styles.css new file mode 100644 index 00000000..1ec36a1b --- /dev/null +++ b/web/src/presentation/components/about_us/assets/css/styles.css @@ -0,0 +1,46 @@ +.about_us_info_root { + height: 100%; + width: 100%; +} + +.info_header { + height: 7%; + width: 100%; + display: flex; + align-items: center; + justify-content: center; + padding: 5px; + background: gray; +} + +.info_header p { + font-size: 38; +} + +.about_us_info_body { + display: flex; + flex-direction: column; + margin: 20px; +} + +.about_us_developers { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100%; +} + +.about_us_logos { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 200px; +} + +.about_us_logos img { + max-height: 100px; + margin: 0 20px 0 20px; + width: auto; +} diff --git a/web/src/presentation/components/footer/assets/css/styles.css b/web/src/presentation/components/footer/assets/css/styles.css deleted file mode 100644 index f0934529..00000000 --- a/web/src/presentation/components/footer/assets/css/styles.css +++ /dev/null @@ -1,39 +0,0 @@ -.footer{ - display: flex; - height: 100%; - width: 100%; - align-items: center; - flex-wrap: wrap; - padding: 1em; -} - -.footer_license , -.footer_developers{ - display: flex; - flex-direction: column; -} - -.footer_license{ - margin-top: auto; -} - -.footer_credits{ - height: 100%; -} - -.footer_icons{ - height: 50%; - margin-left: auto; -} - -.footer_images{ - height: 100%; - display: flex; - align-items: center; -} - -.footer_images img{ - height: 100%; - width: 100%; - object-fit: contain; -} \ No newline at end of file diff --git a/web/src/presentation/components/footer/footer.tsx b/web/src/presentation/components/footer/footer.tsx deleted file mode 100644 index 664973f7..00000000 --- a/web/src/presentation/components/footer/footer.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import "./assets/css/styles.css"; - -// Define the Developer interface -interface Developer { - name: string; - lastName: string; - role: string; - linkedInURL: string; -} - -// Footer component -export const Footer = () => { - // Inline style for text elements - const style: React.CSSProperties = { - fontSize: 11, - textDecoration: "none", - color: "black", - textAlign: "left", - }; - - // List of developers - const developers: Developer[] = [ - { - name: "Lorenzo", - lastName: "Trujillo", - role: "Desarrollador FrontEnd Mobile", - linkedInURL: "https://www.linkedin.com/in/lorenzotrujillorojassd/", - }, - { - name: "Diego I.", - lastName: "Correa", - role: "Desarrollador BackEnd", - linkedInURL: "https://www.linkedin.com/in/diego-ivan-correa/", - }, - { - name: "Omar", - lastName: "Luna", - role: "Desarrollador FrontEnd Web", - linkedInURL: - "https://www.linkedin.com/in/omar-luna-hern%C3%A1ndez-a280ba267/", - }, - ]; - - return ( -
- {/* Footer credits section */} -
-
-
- ©2024 - - {" "} - Labsol Network. - -
- - Bajo licencia GPL v.3. - -
- {/* Developer links */} -
- {developers.map((dev, index) => { - return ( - - @ {dev.name + " " + dev.lastName + " (" + dev.role + ")"} - - ); - })} -
-
- - {/* Footer icons section */} -
-
- - -
-
-
- ); -}; diff --git a/web/src/presentation/superadmin/panel/assets/styles/style.css b/web/src/presentation/superadmin/panel/assets/styles/style.css index f83d1597..1a597ff8 100644 --- a/web/src/presentation/superadmin/panel/assets/styles/style.css +++ b/web/src/presentation/superadmin/panel/assets/styles/style.css @@ -22,11 +22,6 @@ .superadmin-panel-content{ max-height: 80vh; - min-height: 80vh; + min-height: 94vh; display: flex; } - -.footer-cnt{ - height: 14vh; - background: #ECEAFF; -} diff --git a/web/src/presentation/superadmin/panel/super_admin_home_page.tsx b/web/src/presentation/superadmin/panel/super_admin_home_page.tsx index d5a06c2f..7ab79184 100644 --- a/web/src/presentation/superadmin/panel/super_admin_home_page.tsx +++ b/web/src/presentation/superadmin/panel/super_admin_home_page.tsx @@ -3,6 +3,7 @@ import { Menu, MenuItem, Sidebar } from "react-pro-sidebar"; import "./assets/styles/style.css"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { + faInfo, faMonument, faTags, faUserTie, @@ -17,7 +18,7 @@ import { LoadingSpinner } from "../../components/loading_spinner/loading_spinner import { SuperAdminSelectedPanel } from "../../../core/constants/selected_panel"; import { useSuperAdminHomePage } from "../../../domain/useCase/useSuperadminHomePage"; import { SuperAdminPanelCategoryScreen } from "../sa_panel_category/sa_panel_category_screen/sa_panel_category_screen"; -import { Footer } from "../../components/footer/footer"; +import { AboutUsPanel } from "../../components/about_us/about_us_panel"; // Main component for the Super Admin Home Page export const SuperAdminHomePage = () => { @@ -96,6 +97,15 @@ export const SuperAdminHomePage = () => { > Categorías + } + disabled={isWindowActive} + onClick={() => { + setSelectedPanel(SuperAdminSelectedPanel.ABOUT_US); + }} + > + Sobre nosotros +
@@ -131,15 +141,13 @@ export const SuperAdminHomePage = () => { setIsWindowActive={setIsWindowActive} /> ); + case SuperAdminSelectedPanel.ABOUT_US: + return ; default: return null; } })()}
- {/* Footer component */} -
-
); -- GitLab From 0da439f2fc0fff094eaaf0126ed99a0381b4e4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Thu, 5 Dec 2024 10:45:41 -0600 Subject: [PATCH 2/4] Se cambio el dato que regresa la funcion de getPDFByPoints que antes era un string de base64 y ahora es un blob --- web/src/data/datasource/api/poi_datasource.ts | 7 +++---- web/src/data/datasource/poi_datasource.ts | 4 ++-- web/src/data/repository/poi_repository.ts | 4 ++-- web/src/domain/repository/poi_repository.ts | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/web/src/data/datasource/api/poi_datasource.ts b/web/src/data/datasource/api/poi_datasource.ts index 4e26660e..625313f9 100644 --- a/web/src/data/datasource/api/poi_datasource.ts +++ b/web/src/data/datasource/api/poi_datasource.ts @@ -1,5 +1,4 @@ import axios from "axios"; -import { Buffer } from "buffer"; import { PoiDatasourceInf } from "../poi_datasource"; import { PointOfInterest } from "./entities/poi"; import { APIUrl } from "../../../core/constants/api_url"; @@ -91,9 +90,9 @@ export class POIDatasourceProd implements PoiDatasourceInf { * Generates a PDF for the specified points of interest. * @param idPlace - The ID of the place. * @param pointsId - An array of point IDs to include in the PDF. - * @returns A promise that resolves to a base64-encoded string of the PDF. + * @returns A promise that resolves to a Blob containing the PDF data. */ - async getPDFByPoints(idPlace: number, pointsId: number[]): Promise { + async getPDFByPoints(idPlace: number, pointsId: number[]): Promise { const { data } = await axios.get( APIUrl + API_ROUTE_PLACE + `/${idPlace}` + API_ROUTE_POINT + "/generate", { @@ -103,6 +102,6 @@ export class POIDatasourceProd implements PoiDatasourceInf { responseType: "arraybuffer", } ); - return Buffer.from(data, "binary").toString("base64"); + return new Blob([data], { type: "application/pdf" }); } } diff --git a/web/src/data/datasource/poi_datasource.ts b/web/src/data/datasource/poi_datasource.ts index b03b50dd..1b2b208f 100644 --- a/web/src/data/datasource/poi_datasource.ts +++ b/web/src/data/datasource/poi_datasource.ts @@ -29,7 +29,7 @@ export interface PoiDatasourceInf { * Retrieves a PDF document containing information about specified POIs. * @param idPlace - The ID of the place. * @param pointsId - An array of POI IDs. - * @returns A promise that resolves to a string representing the PDF document. + * @returns A promise that resolves to a Blob containing the PDF data. */ - getPDFByPoints(idPlace: number, pointsId: number[]): Promise; + getPDFByPoints(idPlace: number, pointsId: number[]): Promise; } diff --git a/web/src/data/repository/poi_repository.ts b/web/src/data/repository/poi_repository.ts index 9a59ed06..d65f1824 100644 --- a/web/src/data/repository/poi_repository.ts +++ b/web/src/data/repository/poi_repository.ts @@ -39,9 +39,9 @@ export class POIRepositoryProd implements PoiRepositoryInf { * Retrieves a PDF document for the given points of interest. * @param idPlace - The ID of the place. * @param pointsId - An array of point IDs. - * @returns A promise that resolves to a string representing the PDF document. + * @returns A promise that resolves to a Blob containing the PDF data. */ - async getPDFByPoints(idPlace: number, pointsId: number[]): Promise { + async getPDFByPoints(idPlace: number, pointsId: number[]): Promise { return this.datasouce.getPDFByPoints(idPlace, pointsId); } } diff --git a/web/src/domain/repository/poi_repository.ts b/web/src/domain/repository/poi_repository.ts index e99c8092..a07c65cc 100644 --- a/web/src/domain/repository/poi_repository.ts +++ b/web/src/domain/repository/poi_repository.ts @@ -29,7 +29,7 @@ export interface PoiRepositoryInf { * Retrieves a PDF containing information about specified POIs. * @param idPlace - The ID of the place. * @param pointsId - An array of POI IDs. - * @returns A promise that resolves to a string representing the PDF. + * @returns A promise that resolves to a Blob containing the PDF data. */ - getPDFByPoints(idPlace: number, pointsId: number[]): Promise; + getPDFByPoints(idPlace: number, pointsId: number[]): Promise; } -- GitLab From 5a0bdbb3032a4114d9b1ef8420da5ac833aed4eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Thu, 5 Dec 2024 10:46:07 -0600 Subject: [PATCH 3/4] Correcion de error que no cargaba mas de 4 puntos en ell archivo pdf --- web/src/domain/useCase/usePointOfInterest.ts | 6 ++--- .../admin_panel_poi_list.tsx | 6 ++--- .../admin_panel_poi_screen.tsx | 23 +++++++++++++++---- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/web/src/domain/useCase/usePointOfInterest.ts b/web/src/domain/useCase/usePointOfInterest.ts index 722c190b..f3d7de22 100644 --- a/web/src/domain/useCase/usePointOfInterest.ts +++ b/web/src/domain/useCase/usePointOfInterest.ts @@ -206,10 +206,10 @@ export const usePointOfInterest = ( const getPdfById = async ( idPlace: number, pointsId: number[] - ): Promise => { + ): Promise => { try { - const pdfUrl = await POIRepository.getPDFByPoints(idPlace, pointsId); - return pdfUrl; + const pdfBlob = await POIRepository.getPDFByPoints(idPlace, pointsId); + return pdfBlob; } catch (error: any) { if (axios.isAxiosError(error)) { error as AxiosError; diff --git a/web/src/presentation/admin/admin_panel_poi/admin_panel_poi_list/admin_panel_poi_list.tsx b/web/src/presentation/admin/admin_panel_poi/admin_panel_poi_list/admin_panel_poi_list.tsx index 086ceb60..37002125 100644 --- a/web/src/presentation/admin/admin_panel_poi/admin_panel_poi_list/admin_panel_poi_list.tsx +++ b/web/src/presentation/admin/admin_panel_poi/admin_panel_poi_list/admin_panel_poi_list.tsx @@ -15,7 +15,7 @@ interface props { isWindowActive: boolean; setActualPoint: Dispatch>; setWindowVisibilityViewer: (visibility: boolean) => void; - setBinaryData: Dispatch>; + setBlobData: Dispatch>; setIsPDFViewerActive: Dispatch>; setIsWindowsActive: Dispatch>; } @@ -26,7 +26,7 @@ export const AdminPanelPoiList = ({ isWindowActive, setActualPoint, setWindowVisibilityViewer, - setBinaryData, + setBlobData, setIsPDFViewerActive, setIsWindowsActive, }: props) => { @@ -68,7 +68,7 @@ export const AdminPanelPoiList = ({ if (res !== null) { setIsPDFViewerActive(true); setIsWindowsActive(true); - setBinaryData(res); + setBlobData(res); } setIsPDFLoading(false); }; diff --git a/web/src/presentation/admin/admin_panel_poi/admin_panel_poi_screen/admin_panel_poi_screen.tsx b/web/src/presentation/admin/admin_panel_poi/admin_panel_poi_screen/admin_panel_poi_screen.tsx index 0b202fcf..820544bf 100644 --- a/web/src/presentation/admin/admin_panel_poi/admin_panel_poi_screen/admin_panel_poi_screen.tsx +++ b/web/src/presentation/admin/admin_panel_poi/admin_panel_poi_screen/admin_panel_poi_screen.tsx @@ -1,4 +1,4 @@ -import { Dispatch, SetStateAction, useState } from "react"; +import { Dispatch, SetStateAction, useEffect, useState } from "react"; import { AdminPanelPoiRegister } from "../admin_panel_poi_register/admin_panel_poi_register"; import "./assets/css/styles.css"; import { AdminPanelPoiList } from "../admin_panel_poi_list/admin_panel_poi_list"; @@ -28,7 +28,8 @@ export const AdminPanelPoiScreen = ({ const [isRegisterWindowActive, setIsRegisterWindowActive] = useState(false); // Register window visibility const [isViewerWindowActive, setIsViewerWindowActive] = useState(false); // Viewer window visibility const [isPDFViewerActive, setIsPDFViewerActive] = useState(false); // PDF viewer visibility - const [binaryData, setBinaryData] = useState(""); // Binary data for PDF + const [blobData, setBlobData] = useState(null); // Blob data for PDF + const [pdfUrl, setPdfUrl] = useState(""); // PDF URL // Function to force re-render the POI list const forceRenderList = () => { @@ -48,6 +49,18 @@ export const AdminPanelPoiScreen = ({ setIsWindowActive(visibility); }; + useEffect(() => { + if (blobData) { + const url = URL.createObjectURL(blobData); + console.log(url); + setPdfUrl(url); + + return () => { + URL.revokeObjectURL(url); + }; + } + }, [blobData]); + return (
@@ -85,7 +98,7 @@ export const AdminPanelPoiScreen = ({ setActualPoint={setActualPoint} setWindowVisibilityViewer={setWindowVisibilityViewer} isWindowActive={isWindowActive} - setBinaryData={setBinaryData} + setBlobData={setBlobData} setIsPDFViewerActive={setIsPDFViewerActive} setIsWindowsActive={setIsWindowActive} /> @@ -98,13 +111,13 @@ export const AdminPanelPoiScreen = ({ onClick={() => { setIsPDFViewerActive(false); setIsWindowActive(false); - setBinaryData(""); + setBlobData(null); }} />