Loading web/src/components/admin_panel_poi/admin_panel_poi_screen/admin_panel_poi_screen.tsx 0 → 100644 +60 −0 Original line number Diff line number Diff line 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"; import { Town } from "../../../infraestructure/entities/town"; import { PointOfInterest } from "../../../infraestructure/entities/poi"; interface props { isWindowActive: boolean; setIsWindowActive: Dispatch<SetStateAction<boolean>>; town: Town | undefined; } export const AdminPanelPoiScreen = ({isWindowActive,setIsWindowActive, town}: props) => { const [renderCount, setRenderCount] = useState(0); const [isRegisterPane, setIsRegisterPane] = useState(true); const [actualPoint, setActualPoint] = useState<PointOfInterest | undefined>(); const [isPlaceRegisterWindowActive, setIsPlaceRegisterWindowActive] = useState(false); const forceRenderList = () =>{ setRenderCount(prevCount => prevCount + 1); setIsWindowActive(false); } const setWindowVisibility = (visibility: boolean) => { setIsPlaceRegisterWindowActive(visibility); setIsWindowActive(visibility); } return ( <div className="admin_panel_poi_content"> <div className="panel_poi_header"> Administrar puntos de interés dentro de un lugar <button className="poi_add_btn" disabled={isWindowActive || !town} onClick={() => { setIsRegisterPane(true); setWindowVisibility(true); }} > Registrar punto </button> </div> <div className="panel_poi_body"> { isPlaceRegisterWindowActive && <AdminPanelPoiRegister idTown={town?.idTown || -1} setWindowVisibility={setWindowVisibility} forceRenderList={forceRenderList} isRegister={isRegisterPane} form={actualPoint} /> } <AdminPanelPoiList idTown={town?.idTown || -1} key={renderCount} isWindowActive={isWindowActive} setWindowVisibility={setWindowVisibility} setActualPoint={setActualPoint} setIsRegisterPane={setIsRegisterPane}/> </div> </div> ); } No newline at end of file web/src/components/admin_panel_poi/admin_panel_poi_screen/assets/css/styles.css 0 → 100644 +29 −0 Original line number Diff line number Diff line .admin_panel_poi_content{ width: 100%; max-height: 100%; display: flex; flex-direction: column; } .panel_poi_header{ height: 7%; width: 100%; display: flex; align-items: center; justify-content: center; padding: 5px; background: gray; } .panel_poi_header .poi_add_btn{ display: inline-block; cursor: pointer; position: absolute; right: 5px; } .panel_poi_body{ height: 93%; width: 100%; background: white; } No newline at end of file Loading
web/src/components/admin_panel_poi/admin_panel_poi_screen/admin_panel_poi_screen.tsx 0 → 100644 +60 −0 Original line number Diff line number Diff line 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"; import { Town } from "../../../infraestructure/entities/town"; import { PointOfInterest } from "../../../infraestructure/entities/poi"; interface props { isWindowActive: boolean; setIsWindowActive: Dispatch<SetStateAction<boolean>>; town: Town | undefined; } export const AdminPanelPoiScreen = ({isWindowActive,setIsWindowActive, town}: props) => { const [renderCount, setRenderCount] = useState(0); const [isRegisterPane, setIsRegisterPane] = useState(true); const [actualPoint, setActualPoint] = useState<PointOfInterest | undefined>(); const [isPlaceRegisterWindowActive, setIsPlaceRegisterWindowActive] = useState(false); const forceRenderList = () =>{ setRenderCount(prevCount => prevCount + 1); setIsWindowActive(false); } const setWindowVisibility = (visibility: boolean) => { setIsPlaceRegisterWindowActive(visibility); setIsWindowActive(visibility); } return ( <div className="admin_panel_poi_content"> <div className="panel_poi_header"> Administrar puntos de interés dentro de un lugar <button className="poi_add_btn" disabled={isWindowActive || !town} onClick={() => { setIsRegisterPane(true); setWindowVisibility(true); }} > Registrar punto </button> </div> <div className="panel_poi_body"> { isPlaceRegisterWindowActive && <AdminPanelPoiRegister idTown={town?.idTown || -1} setWindowVisibility={setWindowVisibility} forceRenderList={forceRenderList} isRegister={isRegisterPane} form={actualPoint} /> } <AdminPanelPoiList idTown={town?.idTown || -1} key={renderCount} isWindowActive={isWindowActive} setWindowVisibility={setWindowVisibility} setActualPoint={setActualPoint} setIsRegisterPane={setIsRegisterPane}/> </div> </div> ); } No newline at end of file
web/src/components/admin_panel_poi/admin_panel_poi_screen/assets/css/styles.css 0 → 100644 +29 −0 Original line number Diff line number Diff line .admin_panel_poi_content{ width: 100%; max-height: 100%; display: flex; flex-direction: column; } .panel_poi_header{ height: 7%; width: 100%; display: flex; align-items: center; justify-content: center; padding: 5px; background: gray; } .panel_poi_header .poi_add_btn{ display: inline-block; cursor: pointer; position: absolute; right: 5px; } .panel_poi_body{ height: 93%; width: 100%; background: white; } No newline at end of file