import React, {useState, useEffect} from "react"; import styles from "./InfoPinModal.module.css"; import PropTypes, {instanceOf} from "prop-types"; import {MapBuilder} from "../../../scripts/main/MapBuilder.js"; import ModalNameField from "../Components/ModalNameField.jsx"; import ModalSelectConnections from "../Components/ModalSelectConnections.jsx"; import ModalDisplayConnections from "../Components/ModalDisplayConnections.jsx"; import ModalDescriptionField from "../Components/ModalDescriptionField.jsx"; import ModalSaveButton from "../Components/ModalSaveButton.jsx"; import Modal from "../Components/Modal.jsx"; import useModalState from "../Hooks/useModalState.jsx"; import useConnections from "../Hooks/useConnections.jsx"; import {useModalEvent} from "../Hooks/useModalEvent.jsx"; import ModalSelectConnections2 from "../Components/ModalSelectConnections2.jsx"; import ShapeQuery from "../../../scripts/util/ShapeQuery.js"; export default function InfoPinModal({map}) { const { modalState: {isOpen,shapeInfo,shape,setIsOpen,setShape,setShapeInfo}, handlers: {toggleModal,updateModalData,saveDetails} } = useModalState(map); const { connectionState: {connections,setConnections}, handlers: {addConnection,removeConnection} } = useConnections(map,shapeInfo,setShapeInfo) useModalEvent((event) => { const shape = event.detail.room; setShape(shape); setShapeInfo({ ...shape.info, selectedPin: "" }) setConnections(shape.info.selectedPins || []); setIsOpen(true); console.log(shape.info.selectedPins, "Loaded pins on modal open"); },"openPinModalEvent") return ( ); } InfoPinModal.propTypes = { map: PropTypes.instanceOf(MapBuilder), };