[0c6b92a] | 1 | import React, {useState, useEffect} from "react";
|
---|
| 2 | import ModalNameField from "../Components/ModalNameField.jsx";
|
---|
| 3 | import ModalDescriptionField from "../Components/ModalDescriptionField.jsx";
|
---|
| 4 | import ModalSaveButton from "../Components/ModalSaveButton.jsx";
|
---|
| 5 | import Modal from "../Components/Modal.jsx";
|
---|
| 6 | import ModalRoomTypes from "../Components/ModalRoomTypes.jsx";
|
---|
| 7 | import useModalState from "../Hooks/useModalState.jsx";
|
---|
| 8 | import {useModalEvent} from "../Hooks/useModalEvent.jsx";
|
---|
[79a0317] | 9 | import ModalUploadRoomImage from "../Components/ModalUploadRoomImage.jsx";
|
---|
[0c6b92a] | 10 |
|
---|
| 11 | export default function RoomModal({map,roomTypes}) {
|
---|
| 12 | const {
|
---|
| 13 | modalState: {isOpen,setIsOpen,setShape,shapeInfo,setShapeInfo},
|
---|
| 14 | handlers: {toggleModal,updateModalData,saveDetails}
|
---|
| 15 | } = useModalState(map);
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | useModalEvent((event) => {
|
---|
| 19 | const shape = event.detail.room;
|
---|
| 20 | setShape(shape);
|
---|
| 21 | setShapeInfo(shape.info);
|
---|
| 22 | setIsOpen(true);
|
---|
[79a0317] | 23 | event.detail.map.detachKeyPressEventListeners();
|
---|
[0c6b92a] | 24 |
|
---|
| 25 | },"openRoomModalEvent")
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | return (
|
---|
| 30 | <Modal isOpen={isOpen} toggleModal={toggleModal} title={"Enter Room Details"}>
|
---|
| 31 | <ModalNameField shapeInfo={shapeInfo} updateModalData={updateModalData}/>
|
---|
| 32 | <ModalRoomTypes updateModalData={updateModalData} shapeInfo={shapeInfo} roomTypes={roomTypes}/>
|
---|
| 33 | <ModalDescriptionField shapeInfo={shapeInfo} updateModalData={updateModalData}/>
|
---|
[79a0317] | 34 | <ModalUploadRoomImage></ModalUploadRoomImage>
|
---|
[0c6b92a] | 35 | <ModalSaveButton saveDetails={saveDetails}/>
|
---|
| 36 | </Modal>
|
---|
| 37 | );
|
---|
| 38 | }
|
---|