Loading web/src/components/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -10,12 +10,12 @@ import { Dispatch, SetStateAction, useEffect } from 'react'; interface props{ idTown: number; isWindowActive: boolean; setIsWindowActive: Dispatch<SetStateAction<boolean>>; setWindowVisibility: (visibility: boolean) => void; setActualPlace: Dispatch<SetStateAction<Place | undefined>>; setIsRegisterPane: Dispatch<SetStateAction<boolean>>; } export const AdminPanelPlaceList = ({idTown, isWindowActive, setIsWindowActive, setActualPlace, setIsRegisterPane}: props) => { export const AdminPanelPlaceList = ({idTown, isWindowActive, setWindowVisibility, setActualPlace, setIsRegisterPane}: props) => { const { placeList, pending, Loading @@ -25,7 +25,7 @@ export const AdminPanelPlaceList = ({idTown, isWindowActive, setIsWindowActive, const handleEditSelectedCategory = (place: Place) => { setIsRegisterPane(false); setActualPlace(place); setIsWindowActive(true); setWindowVisibility(true); } useEffect(() => { Loading web/src/components/admin_panel_places/admin_panel_place_register/admin_panel_place_register.tsx +4 −4 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ import { AvailableDays, availableDaysList, EmptyPlace, Place } from "../../../in import { Category } from "../../../infraestructure/entities/category"; interface props { setIsWindowActive: Dispatch<SetStateAction<boolean>>; setWindowVisibility: (visibility: boolean) => void; categoriesList: Category[]; idTown: number; forceRenderList: () => void; Loading @@ -19,7 +19,7 @@ interface props { form?: Place; } export const AdminPanelPlaceRegister = ({setIsWindowActive, idTown, categoriesList, forceRenderList, isRegister, form}: props) => { export const AdminPanelPlaceRegister = ({setWindowVisibility, idTown, categoriesList, forceRenderList, isRegister, form}: props) => { const { register, handleSubmit, Loading @@ -39,7 +39,7 @@ export const AdminPanelPlaceRegister = ({setIsWindowActive, idTown, categoriesLi onSubmitRegister, onSubmitUpdate, clearErrors } = usePlace(forceRenderList, setIsWindowActive); } = usePlace(forceRenderList, setWindowVisibility); const [clickedCategories, setClickedCategories] = useState<boolean[]>(new Array(categoriesList.length).fill(false)); const [isLoading, setIsLoading] = useState(false); const [actualPlace, setActualPlace] = useState<Place>(EmptyPlace); Loading Loading @@ -112,7 +112,7 @@ export const AdminPanelPlaceRegister = ({setIsWindowActive, idTown, categoriesLi <div className="place_register_header"> Registra el lugar <FontAwesomeIcon icon={faWindowClose} className="close_btn" onClick={() => setIsWindowActive(false)}/> onClick={() => setWindowVisibility(false)}/> </div> <div className="place_register_body"> {isLoading Loading web/src/components/admin_panel_places/admin_panel_place_screen/admin_panel_place_screen.tsx +10 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: const [renderCount, setRenderCount] = useState(0); const [isRegisterPane, setIsRegisterPane] = useState(true); const [actualPlace, setActualPlace] = useState<Place | undefined>(); const [isPlaceRegisterWindowActive, setIsPlaceRegisterWindowActive] = useState(false); const { categoriesList, updateCategoriesList, Loading @@ -26,6 +27,11 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: setIsWindowActive(false); } const setWindowVisibility = (visibility: boolean) => { setIsPlaceRegisterWindowActive(visibility); setIsWindowActive(visibility); } useEffect(()=>{ updateCategoriesList(); },[]); Loading @@ -39,7 +45,7 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: disabled={isWindowActive || !town} onClick={() => { setIsRegisterPane(true); setIsWindowActive(true); setWindowVisibility(true); }} > Registrar lugar Loading @@ -47,8 +53,8 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: </div> <div className="panel_place_body"> { isWindowActive && <AdminPanelPlaceRegister setIsWindowActive={setIsWindowActive} isPlaceRegisterWindowActive && <AdminPanelPlaceRegister setWindowVisibility={setWindowVisibility} idTown={town?.idTown || -1} categoriesList={categoriesList} forceRenderList={forceRenderList} Loading @@ -57,7 +63,7 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: /> } <AdminPanelPlaceList idTown={town?.idTown || -1} key={renderCount} isWindowActive={isWindowActive} setIsWindowActive={setIsWindowActive} isWindowActive={isWindowActive} setWindowVisibility={setWindowVisibility} setActualPlace={setActualPlace} setIsRegisterPane={setIsRegisterPane}/> </div> </div> Loading web/src/components/admin_town_info/admin_town_info.tsx +10 −4 Original line number Diff line number Diff line import { Dispatch, SetStateAction} from "react"; import { Dispatch, SetStateAction, useState} from "react"; import { Town } from "../../infraestructure/entities/town"; import "./assets/css/styles.css"; import { faEdit, faLanguage } from "@fortawesome/free-solid-svg-icons"; Loading @@ -24,6 +24,12 @@ export const AdminTownInfo = ({updateTown, isWindowActive, setIsWindowActive, to forceRenderList, statesList } = useAdminTownInfo(updateTown); const [isTownRegisterWindowActive, setIsTownRegisterWindowActive] = useState(false); const setWindowVisibility = (visibility: boolean) => { setIsTownRegisterWindowActive(visibility); setIsWindowActive(visibility); } if(!town){ return ( Loading @@ -35,10 +41,10 @@ export const AdminTownInfo = ({updateTown, isWindowActive, setIsWindowActive, to return ( <div className="town_info_root"> {isWindowActive && {isTownRegisterWindowActive && <SuperadminPanelTownRegister setWindowActive={setIsWindowActive} setActualWindowActive={setIsWindowActive} setActualWindowActive={setIsTownRegisterWindowActive} forceRenderList={forceRenderList} isRegister={false} form={town} Loading Loading @@ -85,7 +91,7 @@ export const AdminTownInfo = ({updateTown, isWindowActive, setIsWindowActive, to onClick={ ()=>{ if(!isWindowActive){ setIsWindowActive(true); setWindowVisibility(true); } } } Loading web/src/hooks/usePlace.tsx +2 −2 Original line number Diff line number Diff line import { FieldErrors, Resolver, SubmitHandler, useForm } from "react-hook-form" import { Place, AvailableDays } from "../infraestructure/entities/place"; import { toast } from "react-toastify"; import { Dispatch, SetStateAction, useEffect, useState } from "react"; import { useEffect, useState } from "react"; import axios, { AxiosError } from "axios"; import { languaguesList } from "../constants/languages"; import { MIN_NUMBER_PLACE_IMAGES } from "../constants/images_nuber"; Loading Loading @@ -128,7 +128,7 @@ const resolver: Resolver<Place> = async (data) => { }; export const usePlace = (forceRenderList?: () => void, setIsWindowActive?: Dispatch<SetStateAction<boolean>>) => { setIsWindowActive?: (visibility: boolean) => void) => { const { register, handleSubmit, Loading Loading
web/src/components/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -10,12 +10,12 @@ import { Dispatch, SetStateAction, useEffect } from 'react'; interface props{ idTown: number; isWindowActive: boolean; setIsWindowActive: Dispatch<SetStateAction<boolean>>; setWindowVisibility: (visibility: boolean) => void; setActualPlace: Dispatch<SetStateAction<Place | undefined>>; setIsRegisterPane: Dispatch<SetStateAction<boolean>>; } export const AdminPanelPlaceList = ({idTown, isWindowActive, setIsWindowActive, setActualPlace, setIsRegisterPane}: props) => { export const AdminPanelPlaceList = ({idTown, isWindowActive, setWindowVisibility, setActualPlace, setIsRegisterPane}: props) => { const { placeList, pending, Loading @@ -25,7 +25,7 @@ export const AdminPanelPlaceList = ({idTown, isWindowActive, setIsWindowActive, const handleEditSelectedCategory = (place: Place) => { setIsRegisterPane(false); setActualPlace(place); setIsWindowActive(true); setWindowVisibility(true); } useEffect(() => { Loading
web/src/components/admin_panel_places/admin_panel_place_register/admin_panel_place_register.tsx +4 −4 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ import { AvailableDays, availableDaysList, EmptyPlace, Place } from "../../../in import { Category } from "../../../infraestructure/entities/category"; interface props { setIsWindowActive: Dispatch<SetStateAction<boolean>>; setWindowVisibility: (visibility: boolean) => void; categoriesList: Category[]; idTown: number; forceRenderList: () => void; Loading @@ -19,7 +19,7 @@ interface props { form?: Place; } export const AdminPanelPlaceRegister = ({setIsWindowActive, idTown, categoriesList, forceRenderList, isRegister, form}: props) => { export const AdminPanelPlaceRegister = ({setWindowVisibility, idTown, categoriesList, forceRenderList, isRegister, form}: props) => { const { register, handleSubmit, Loading @@ -39,7 +39,7 @@ export const AdminPanelPlaceRegister = ({setIsWindowActive, idTown, categoriesLi onSubmitRegister, onSubmitUpdate, clearErrors } = usePlace(forceRenderList, setIsWindowActive); } = usePlace(forceRenderList, setWindowVisibility); const [clickedCategories, setClickedCategories] = useState<boolean[]>(new Array(categoriesList.length).fill(false)); const [isLoading, setIsLoading] = useState(false); const [actualPlace, setActualPlace] = useState<Place>(EmptyPlace); Loading Loading @@ -112,7 +112,7 @@ export const AdminPanelPlaceRegister = ({setIsWindowActive, idTown, categoriesLi <div className="place_register_header"> Registra el lugar <FontAwesomeIcon icon={faWindowClose} className="close_btn" onClick={() => setIsWindowActive(false)}/> onClick={() => setWindowVisibility(false)}/> </div> <div className="place_register_body"> {isLoading Loading
web/src/components/admin_panel_places/admin_panel_place_screen/admin_panel_place_screen.tsx +10 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: const [renderCount, setRenderCount] = useState(0); const [isRegisterPane, setIsRegisterPane] = useState(true); const [actualPlace, setActualPlace] = useState<Place | undefined>(); const [isPlaceRegisterWindowActive, setIsPlaceRegisterWindowActive] = useState(false); const { categoriesList, updateCategoriesList, Loading @@ -26,6 +27,11 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: setIsWindowActive(false); } const setWindowVisibility = (visibility: boolean) => { setIsPlaceRegisterWindowActive(visibility); setIsWindowActive(visibility); } useEffect(()=>{ updateCategoriesList(); },[]); Loading @@ -39,7 +45,7 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: disabled={isWindowActive || !town} onClick={() => { setIsRegisterPane(true); setIsWindowActive(true); setWindowVisibility(true); }} > Registrar lugar Loading @@ -47,8 +53,8 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: </div> <div className="panel_place_body"> { isWindowActive && <AdminPanelPlaceRegister setIsWindowActive={setIsWindowActive} isPlaceRegisterWindowActive && <AdminPanelPlaceRegister setWindowVisibility={setWindowVisibility} idTown={town?.idTown || -1} categoriesList={categoriesList} forceRenderList={forceRenderList} Loading @@ -57,7 +63,7 @@ export const AdminPanelPlaceScreen = ({isWindowActive,setIsWindowActive, town}: /> } <AdminPanelPlaceList idTown={town?.idTown || -1} key={renderCount} isWindowActive={isWindowActive} setIsWindowActive={setIsWindowActive} isWindowActive={isWindowActive} setWindowVisibility={setWindowVisibility} setActualPlace={setActualPlace} setIsRegisterPane={setIsRegisterPane}/> </div> </div> Loading
web/src/components/admin_town_info/admin_town_info.tsx +10 −4 Original line number Diff line number Diff line import { Dispatch, SetStateAction} from "react"; import { Dispatch, SetStateAction, useState} from "react"; import { Town } from "../../infraestructure/entities/town"; import "./assets/css/styles.css"; import { faEdit, faLanguage } from "@fortawesome/free-solid-svg-icons"; Loading @@ -24,6 +24,12 @@ export const AdminTownInfo = ({updateTown, isWindowActive, setIsWindowActive, to forceRenderList, statesList } = useAdminTownInfo(updateTown); const [isTownRegisterWindowActive, setIsTownRegisterWindowActive] = useState(false); const setWindowVisibility = (visibility: boolean) => { setIsTownRegisterWindowActive(visibility); setIsWindowActive(visibility); } if(!town){ return ( Loading @@ -35,10 +41,10 @@ export const AdminTownInfo = ({updateTown, isWindowActive, setIsWindowActive, to return ( <div className="town_info_root"> {isWindowActive && {isTownRegisterWindowActive && <SuperadminPanelTownRegister setWindowActive={setIsWindowActive} setActualWindowActive={setIsWindowActive} setActualWindowActive={setIsTownRegisterWindowActive} forceRenderList={forceRenderList} isRegister={false} form={town} Loading Loading @@ -85,7 +91,7 @@ export const AdminTownInfo = ({updateTown, isWindowActive, setIsWindowActive, to onClick={ ()=>{ if(!isWindowActive){ setIsWindowActive(true); setWindowVisibility(true); } } } Loading
web/src/hooks/usePlace.tsx +2 −2 Original line number Diff line number Diff line import { FieldErrors, Resolver, SubmitHandler, useForm } from "react-hook-form" import { Place, AvailableDays } from "../infraestructure/entities/place"; import { toast } from "react-toastify"; import { Dispatch, SetStateAction, useEffect, useState } from "react"; import { useEffect, useState } from "react"; import axios, { AxiosError } from "axios"; import { languaguesList } from "../constants/languages"; import { MIN_NUMBER_PLACE_IMAGES } from "../constants/images_nuber"; Loading Loading @@ -128,7 +128,7 @@ const resolver: Resolver<Place> = async (data) => { }; export const usePlace = (forceRenderList?: () => void, setIsWindowActive?: Dispatch<SetStateAction<boolean>>) => { setIsWindowActive?: (visibility: boolean) => void) => { const { register, handleSubmit, Loading