From 0b4ed3522d89d45908b4bfe6bbd4ad4d80b6b449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Thu, 3 Oct 2024 17:25:09 -0600 Subject: [PATCH 01/37] Se renombra un texto --- .../sa_panel_admin/sa_panel_admin_list/sa_panel_admin_list.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/components/sa_panel_admin/sa_panel_admin_list/sa_panel_admin_list.tsx b/web/src/components/sa_panel_admin/sa_panel_admin_list/sa_panel_admin_list.tsx index 229cae1c..f4ca3657 100644 --- a/web/src/components/sa_panel_admin/sa_panel_admin_list/sa_panel_admin_list.tsx +++ b/web/src/components/sa_panel_admin/sa_panel_admin_list/sa_panel_admin_list.tsx @@ -110,7 +110,7 @@ export const SuperAdminPanelAdminList = ({isWindowActive, statesList}: props) => } - Estado + Pueblo mágico +

{errors.email?.message}

+ + + )} + {step === 2 && ( +
+
+ +
+ +
+ +
+

{errors.code?.message}

+
+ +
+ +
+ + +
+

{errors.newPassword?.message}

+
+ +
+ +
+ + +
+

{errors.confirmNewPassword?.message}

+
+ +
+ +
+
+
+ )} + + + + ); +}; -- GitLab From f92ee90ebb6579f928b35008325f184a62355d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Thu, 10 Oct 2024 10:49:12 -0600 Subject: [PATCH 19/37] =?UTF-8?q?Se=20agrega=20el=20bot=C3=B3n=20para=20ab?= =?UTF-8?q?rir=20la=20ventana=20para=20reiniciar=20la=20contrase=C3=B1a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/login_page/login_page.tsx | 111 +++++++++++++----------- 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/web/src/pages/login_page/login_page.tsx b/web/src/pages/login_page/login_page.tsx index 2d587c7a..6c6f117c 100644 --- a/web/src/pages/login_page/login_page.tsx +++ b/web/src/pages/login_page/login_page.tsx @@ -1,95 +1,100 @@ -import { usePasswoordVisibility } from "../../hooks/usePasswordVisibility" -import "./styles/styles.css" +import { usePasswoordVisibility } from "../../hooks/usePasswordVisibility"; +import "./styles/styles.css"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faCircleExclamation, faEye , faEyeSlash, faWindowClose} from "@fortawesome/free-solid-svg-icons"; +import { + faCircleExclamation, + faEye, + faEyeSlash, + faWindowClose, +} from "@fortawesome/free-solid-svg-icons"; import { useLogin } from "../../hooks/useLogin"; import { useState } from "react"; -import { LoadingScreen } from "../../components/loading_screen/loading_screen"; +import { ResetPasswordWindow } from "../../components/reset_password_window/reset_password_window"; export const LoginPage = () => { - const { - values, - handleClickShowPassword, - handleMouseDownPassword, - } = usePasswoordVisibility(); - + const { values, handleClickShowPassword, handleMouseDownPassword } = + usePasswoordVisibility(); + const [isWindowActive, setIsWindowActive] = useState(false); const [isLoading, setIsLoading] = useState(false); - const { - register, - handleSubmit, - errors, - onSubmit, - clearErrors, - } = useLogin(setIsLoading); + const { register, handleSubmit, errors, onSubmit, clearErrors } = + useLogin(setIsLoading); + + const handleClickToClose = () => { + setIsWindowActive(false); + }; return (
- {errors.root?.serverError.type==500 && + {errors.root?.serverError.type === "500" && (
-
- Error -
+
Error
{clearErrors("root.serverError")}} + onClick={() => { + clearErrors("root.serverError"); + }} />
- + {errors.root?.serverError.message}
- } + )} - {isLoading &&
} + {isWindowActive && ( + + )} + {isLoading &&
}
-
- Inicia sesión -
+
Inicia sesión
- + -

{errors.email?.message}

- -

{errors.password?.message}

-

{errors.root?.serverError.type==401 && errors.root?.serverError.message}

+

+ {errors.root?.serverError.type === "401" && + errors.root?.serverError.message} +

+

setIsWindowActive(true)} + > + ¿Contraseña olvidada? +

- +
- ) -} \ No newline at end of file + ); +}; -- GitLab From 59c4948acf320f395d19c115481b1c9a843213da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Thu, 10 Oct 2024 10:49:25 -0600 Subject: [PATCH 20/37] =?UTF-8?q?Se=20le=20da=20estilo=20al=20boton=20para?= =?UTF-8?q?=20reiniciar=20la=20contrase=C3=B1a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/login_page/styles/styles.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/src/pages/login_page/styles/styles.css b/web/src/pages/login_page/styles/styles.css index d55bf18d..900dbfec 100644 --- a/web/src/pages/login_page/styles/styles.css +++ b/web/src/pages/login_page/styles/styles.css @@ -121,6 +121,10 @@ form .login-form-button input:active { transform: scale(0.95); } +.reset_password_btn:hover{ + color: blue; +} + .login_error{ color: red; font-size: 12px; -- GitLab From 3b319e49c1a8f7c644381c169e5d6dd245ef095c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Thu, 10 Oct 2024 11:00:29 -0600 Subject: [PATCH 21/37] Se cambia el nombre del componente a MapGoogleComponent --- .../admin_panel_place_register.tsx | 457 ++++++++++-------- web/src/components/map/map.tsx | 54 --- web/src/components/map/map_google.tsx | 63 +++ 3 files changed, 329 insertions(+), 245 deletions(-) delete mode 100644 web/src/components/map/map.tsx create mode 100644 web/src/components/map/map_google.tsx diff --git a/web/src/components/admin_panel_places/admin_panel_place_register/admin_panel_place_register.tsx b/web/src/components/admin_panel_places/admin_panel_place_register/admin_panel_place_register.tsx index 9a2e93cc..d0e52407 100644 --- a/web/src/components/admin_panel_places/admin_panel_place_register/admin_panel_place_register.tsx +++ b/web/src/components/admin_panel_places/admin_panel_place_register/admin_panel_place_register.tsx @@ -1,13 +1,18 @@ import { faWindowClose } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { useEffect, useState} from "react"; +import { useEffect, useState } from "react"; import "./assets/css/styles.css"; -import { MapComponent, Position } from "../../map/map"; +import { MapGoogleComponent, Position } from "../../map/map_google"; import { usePlace } from "../../../hooks/usePlace"; import { languaguesList } from "../../../constants/languages"; import { LoadingScreen } from "../../loading_screen/loading_screen"; import { MultipleImagesDropzone } from "../../multiple_images_dropzone/multiple_images_dropzone"; -import { AvailableDays, availableDaysList, EmptyPlace, Place } from "../../../infraestructure/entities/place"; +import { + AvailableDays, + availableDaysList, + EmptyPlace, + Place, +} from "../../../infraestructure/entities/place"; import { Category } from "../../../infraestructure/entities/category"; import { Geocoding } from "../../geocoding/geocoding"; import { APIProvider } from "@vis.gl/react-google-maps"; @@ -23,7 +28,14 @@ interface props { form?: Place; } -export const AdminPanelPlaceRegister = ({setWindowVisibility, idTown, categoriesList, forceRenderList, isRegister, form}: props) => { +export const AdminPanelPlaceRegister = ({ + setWindowVisibility, + idTown, + categoriesList, + forceRenderList, + isRegister, + form, +}: props) => { const { register, handleSubmit, @@ -43,264 +55,327 @@ export const AdminPanelPlaceRegister = ({setWindowVisibility, idTown, categories onSubmitRegister, onSubmitUpdate, clearErrors, - getValues + getValues, } = usePlace(forceRenderList, setWindowVisibility); - const [clickedCategories, setClickedCategories] = useState(new Array(categoriesList.length).fill(false)); + const [clickedCategories, setClickedCategories] = useState( + new Array(categoriesList.length).fill(false) + ); const [isLoading, setIsLoading] = useState(false); const [actualPlace, setActualPlace] = useState(null); - const [openHourInput, setOpenHourInput] = useState(''); - const [closeHourInput, setCloseHourInput] = useState(''); + const [openHourInput, setOpenHourInput] = useState(""); + const [closeHourInput, setCloseHourInput] = useState(""); //Maps const [position, setPosition] = useState(null); - const [ isSearching , setIsSearching] = useState(false); + const [isSearching, setIsSearching] = useState(false); const onClickCategory = (idCategory: number) => { const index = categoriesId.indexOf(idCategory); - const indexList = categoriesList.findIndex(category => category.idCategory === idCategory); - const clickedCategoriesBackup = clickedCategories.map((clickedCategory, index)=> { - if(index === indexList){ - return !clickedCategory; - }else{ - return clickedCategory; + const indexList = categoriesList.findIndex( + (category) => category.idCategory === idCategory + ); + const clickedCategoriesBackup = clickedCategories.map( + (clickedCategory, index) => { + if (index === indexList) { + return !clickedCategory; + } else { + return clickedCategory; + } } - }) - if(index > -1){ - setCategoriesId( - categoriesId.filter(cat => cat !== idCategory) - ); - }else{ - setCategoriesId( - [...categoriesId, - idCategory - ] - ) + ); + if (index > -1) { + setCategoriesId(categoriesId.filter((cat) => cat !== idCategory)); + } else { + setCategoriesId([...categoriesId, idCategory]); } setClickedCategories(clickedCategoriesBackup); - } + }; useEffect(() => { setIsLoading(true); const fetchData = async () => { - setValue('idTown', idTown); + setValue("idTown", idTown); if (!isRegister && form) { const placeGetted = await getPlaceById(form.idPlace || 0); - if(placeGetted){ + if (placeGetted) { setActualPlace(placeGetted); - setValue('idPlace', placeGetted.idPlace); - setValue('name', placeGetted.name); - setValue('descriptions', placeGetted.descriptions); - setDescriptions(placeGetted.descriptions || ['', '']); - setValue('openAt', placeGetted.openAt); - setOpenHourInput(placeGetted.openAt < 10 ? `0${placeGetted.openAt}:00` : `${placeGetted.openAt}:00`); - setCloseHourInput(placeGetted.closeAt < 10 ? `0${placeGetted.closeAt}:00` : `${placeGetted.closeAt}:00`); - setValue('closeAt', placeGetted.closeAt); - setValue('available', placeGetted.available); - setAvailableDays(placeGetted.available); - setPosition({latitude: Number(placeGetted.latitude), longitude: Number(placeGetted.longitude)}); - setValue('address', placeGetted.address); - const clickedCategoriesBackup : boolean[] = []; + setValue("idPlace", placeGetted.idPlace); + setValue("name", placeGetted.name); + setValue("descriptions", placeGetted.descriptions); + setDescriptions(placeGetted.descriptions || ["", ""]); + setValue("openAt", placeGetted.openAt); + setOpenHourInput( + placeGetted.openAt < 10 + ? `0${placeGetted.openAt}:00` + : `${placeGetted.openAt}:00` + ); + setCloseHourInput( + placeGetted.closeAt < 10 + ? `0${placeGetted.closeAt}:00` + : `${placeGetted.closeAt}:00` + ); + setValue("closeAt", placeGetted.closeAt); + setValue("available", placeGetted.available); + setAvailableDays(placeGetted.available); + setPosition({ + latitude: Number(placeGetted.latitude), + longitude: Number(placeGetted.longitude), + }); + setValue("address", placeGetted.address); + const clickedCategoriesBackup: boolean[] = []; categoriesList.forEach((category) => { - if(placeGetted.categoriesId.indexOf(category.idCategory) > -1){ + if (placeGetted.categoriesId.indexOf(category.idCategory) > -1) { clickedCategoriesBackup.push(true); - }else{ + } else { clickedCategoriesBackup.push(false); } - }); + }); setClickedCategories(clickedCategoriesBackup); setCategoriesId(placeGetted.categoriesId); } } else { - setValue('available', availableDays, { shouldValidate: true }); + setValue("available", availableDays, { shouldValidate: true }); } }; fetchData(); setIsLoading(false); - },[]); + }, []); return (
Registra el lugar - setWindowVisibility(false)}/> + setWindowVisibility(false)} + />
- {isLoading || (!isRegister && actualPlace===null) - ? - - : -
-
-
-
- Nombre del lugar + {isLoading || (!isRegister && actualPlace === null) ? ( + + ) : ( + +
+
+
Nombre del lugar
+ +

{errors.name?.message}

- -

{errors.name?.message}

-
-
-
- Descripción del lugar - + setLanguageDescriptionIndexSelected( + Number(e.target.value) + ) + } + > {languaguesList.map((language, index) => { return ( - + ); })} - -
- { - languaguesList.map((language, index) => { - if(index===languageDescriptionIndexSelected){ - return ( -