diff --git a/src/components/home/CurrentOffice.tsx b/src/components/home/CurrentOffice.tsx index 87d5c75..b6fd49d 100644 --- a/src/components/home/CurrentOffice.tsx +++ b/src/components/home/CurrentOffice.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import SearchModal from './SearchModal'; import SelectOfficeMap from './SelectOfficeMap'; import { Branch } from '@/api/types/branch'; @@ -6,18 +6,28 @@ import { useBranchStore } from '@/store/branch.store'; const CurrentOffice = () => { const [showSearchModal, setShowSearchModal] = useState(false); + const [showSelectOfficeMap, setShowSelectOfficeMap] = useState(false); const selectedBranch = useBranchStore((state) => state.selectedBranch); const setSelectedBranch = useBranchStore((state) => state.setSelectedBranch); const handleBranchSelect = (branch: Branch) => { setSelectedBranch(branch); setShowSearchModal(false); + setShowSelectOfficeMap(true); }; const handleSearchClick = () => { setShowSearchModal(true); }; + const handleCloseSelectOfficeMap = () => { + setShowSelectOfficeMap(false); + }; + + useEffect(() => { + console.log('Selected Branch Updated:', selectedBranch); + }, [selectedBranch]); + return ( <>
@@ -32,7 +42,9 @@ const CurrentOffice = () => {
{showSearchModal && setShowSearchModal(false)} onBranchSelect={handleBranchSelect} />} - {selectedBranch && setSelectedBranch(null)} />} + {showSelectOfficeMap && selectedBranch && ( + + )} ); }; diff --git a/src/components/home/SearchModal.tsx b/src/components/home/SearchModal.tsx index 2fd08b6..eb42759 100644 --- a/src/components/home/SearchModal.tsx +++ b/src/components/home/SearchModal.tsx @@ -34,7 +34,7 @@ const SearchModal: React.FC = ({ onClose, onBranchSelect }) => const handleItemClick = (branch: Branch) => { setSelectedBranch(branch); - onBranchSelect(branch); + onBranchSelect(branch); }; return (