From 7dc74a699423a422489158e25005a82cd18fc4a9 Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Mon, 27 May 2024 22:51:41 +0900 Subject: [PATCH 01/15] =?UTF-8?q?fix:=20=EC=A7=80=EB=8F=84=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EB=B0=94?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B8=ED=92=8B=20=ED=8F=AC=EC=BB=A4=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/MapSearchResult.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/map/MapSearchResult.tsx b/src/components/map/MapSearchResult.tsx index 6cab580..344676a 100644 --- a/src/components/map/MapSearchResult.tsx +++ b/src/components/map/MapSearchResult.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import { Branch } from '@/api/types/branch'; import Image from 'next/image'; import { calculateDistance, formatDistance } from '@/utils/calculateDistance'; @@ -6,6 +6,14 @@ import { MapSearchResultProps } from '@/api/types/branch'; const MapSearchResult: React.FC = ({ onClose, results, onMarkerClick, currentLatitude, currentLongitude }) => { const [searchTerm, setSearchTerm] = useState(''); + const inputRef = useRef(null); + + useEffect(() => { + if (inputRef.current) { + inputRef.current.focus(); + } + }, []); + const filteredResults = results .filter(branch => branch.branchName.includes(searchTerm)) .sort((a, b) => { @@ -29,6 +37,7 @@ const MapSearchResult: React.FC = ({ onClose, results, onM style={{ backgroundColor: '#F0F0F0' }} value={searchTerm} onChange={e => setSearchTerm(e.target.value)} + ref={inputRef} /> Date: Mon, 27 May 2024 22:53:08 +0900 Subject: [PATCH 02/15] =?UTF-8?q?fix:=20=EA=B2=80=EC=83=89=EB=B0=94=20read?= =?UTF-8?q?Only?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/MapSearchBar.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/map/MapSearchBar.tsx b/src/components/map/MapSearchBar.tsx index 6e39516..9d8d172 100644 --- a/src/components/map/MapSearchBar.tsx +++ b/src/components/map/MapSearchBar.tsx @@ -1,10 +1,5 @@ import React from 'react'; - -interface MapSearchBarProps { - onFocus: () => void; - // eslint-disable-next-line no-unused-vars - onChange: (value: string) => void -} +import { MapSearchBarProps } from '@/api/types/branch'; const MapSearchBar: React.FC = ({ onFocus, onChange }) => { const handleInputChange = (event: React.ChangeEvent) => { @@ -20,6 +15,7 @@ const MapSearchBar: React.FC = ({ onFocus, onChange }) => { className="w-full p-3 shadow-lg rounded-lg pl-10" onFocus={onFocus} onChange={handleInputChange} + readOnly /> Date: Mon, 27 May 2024 22:55:00 +0900 Subject: [PATCH 03/15] =?UTF-8?q?fix:=20=EA=B2=80=EC=83=89=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=20=EB=A7=88=EC=9A=B0=EC=8A=A4=20=EC=BB=A4=EC=84=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/MapSearchResult.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/map/MapSearchResult.tsx b/src/components/map/MapSearchResult.tsx index 344676a..eb11db9 100644 --- a/src/components/map/MapSearchResult.tsx +++ b/src/components/map/MapSearchResult.tsx @@ -57,7 +57,7 @@ const MapSearchResult: React.FC = ({ onClose, results, onM {filteredResults.map(branch => (
  • handleItemClick(branch)}> Location - {branch.branchName} + {branch.branchName} {formatDistance(calculateDistance(currentLatitude, currentLongitude, branch.branchLatitude, branch.branchLongitude))}
  • ))} From ab36fcc1db23d0a3c9d6de901178961b73f7ed0d Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Mon, 27 May 2024 22:56:30 +0900 Subject: [PATCH 04/15] =?UTF-8?q?fix:=20=EC=98=A4=ED=94=BC=EC=8A=A4=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=EC=A0=95=EB=B3=B4=20swiper=20spaceBetween?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/OfficeInfo.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/map/OfficeInfo.tsx b/src/components/map/OfficeInfo.tsx index e8dce25..ce445da 100644 --- a/src/components/map/OfficeInfo.tsx +++ b/src/components/map/OfficeInfo.tsx @@ -26,6 +26,7 @@ const OfficeInfo: React.FC = ({ branchName, branchAddress }) => From 6fb24e11dfb05f360475ed5610a6dbe0ea1f717f Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 28 May 2024 02:08:02 +0900 Subject: [PATCH 05/15] =?UTF-8?q?design:=20=EC=98=A4=ED=94=BC=EC=8A=A4=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=EC=A0=95=EB=B3=B4=20=EC=A3=BC=EC=B0=A8=20?= =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/OfficeInfo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/map/OfficeInfo.tsx b/src/components/map/OfficeInfo.tsx index ce445da..ea7e983 100644 --- a/src/components/map/OfficeInfo.tsx +++ b/src/components/map/OfficeInfo.tsx @@ -54,7 +54,7 @@ const OfficeInfo: React.FC = ({ branchName, branchAddress }) =>
    OfficeParkImg -

    {branchAddress}

    +

    출차 전 2층 데스크에서 1시간 무료 적용,
    이후 10분당 800원 비용 발생

    From 0cabfb60cb2182afe7cba89b860122b893e015e7 Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 28 May 2024 13:53:12 +0900 Subject: [PATCH 06/15] =?UTF-8?q?fix:=20=EB=A7=88=EC=BB=A4=20=ED=81=B4?= =?UTF-8?q?=EB=A6=AD=20=ED=9B=84=20=EC=A7=80=EB=8F=84=20=EB=88=84=EB=A5=B4?= =?UTF-8?q?=EB=A9=B4=20=EB=A7=88=EC=BB=A4=20=ED=81=AC=EA=B8=B0=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/UseMap.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/map/UseMap.tsx b/src/components/map/UseMap.tsx index ef89f4b..89ab5ed 100644 --- a/src/components/map/UseMap.tsx +++ b/src/components/map/UseMap.tsx @@ -34,6 +34,11 @@ const UseMap: React.FC = () => { }; const mapInstance = new naver.maps.Map(mapRef.current, mapOptions); setMap(mapInstance); + + naver.maps.Event.addListener(mapInstance, 'click', () => { + setSelectedMarker(null); + setMarkers(mapInstance); + }); } }; From 2abd889fc095ad4bdd8d89f04b4a94a2d65fe9c0 Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 28 May 2024 14:09:42 +0900 Subject: [PATCH 07/15] =?UTF-8?q?fix:=20=EC=A7=80=EB=8F=84=20=EC=A7=84?= =?UTF-8?q?=EC=9E=85=20=EC=8B=9C=20=EB=A7=88=EC=BB=A4=20=EC=95=A1=ED=8B=B0?= =?UTF-8?q?=EB=B8=8C=20=EC=83=89=EC=83=81,=20=ED=95=9C=20=EC=A7=80?= =?UTF-8?q?=EC=A0=90=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EB=82=98=EB=A8=B8?= =?UTF-8?q?=EC=A7=80=20=EB=A7=88=EC=BB=A4=EB=93=A4=20=EC=9D=B8=EC=95=A1?= =?UTF-8?q?=ED=8B=B0=EB=B8=8C=20=EC=83=89=EC=83=81=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/map/OfficeInActive.svg | 31 +++++++++++++++++++++++++++++-- src/components/map/UseMap.tsx | 5 +++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/public/map/OfficeInActive.svg b/public/map/OfficeInActive.svg index 7df7270..e2a5f4d 100644 --- a/public/map/OfficeInActive.svg +++ b/public/map/OfficeInActive.svg @@ -1,3 +1,30 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/map/UseMap.tsx b/src/components/map/UseMap.tsx index 89ab5ed..fe625ee 100644 --- a/src/components/map/UseMap.tsx +++ b/src/components/map/UseMap.tsx @@ -35,9 +35,10 @@ const UseMap: React.FC = () => { const mapInstance = new naver.maps.Map(mapRef.current, mapOptions); setMap(mapInstance); + // 지도 클릭 시 선택된 마커를 초기화 naver.maps.Event.addListener(mapInstance, 'click', () => { setSelectedMarker(null); - setMarkers(mapInstance); + setMarkers(mapInstance); // 마커를 다시 설정하여 크기를 초기화 }); } }; @@ -90,7 +91,7 @@ const UseMap: React.FC = () => { position: new naver.maps.LatLng(branch.branchLatitude, branch.branchLongitude), map: map, icon: { - url: '/map/OfficeActive.svg', + url: isSelected || selectedMarker === null ? '/map/OfficeActive.svg' : '/map/OfficeInActive.svg', size: new naver.maps.Size(48, 48), scaledSize: new naver.maps.Size(isSelected ? 60 : 48, isSelected ? 60 : 48), origin: new naver.maps.Point(0, 0), From 984ac81ef08c92403c3e203491459afa672845f5 Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 28 May 2024 14:18:48 +0900 Subject: [PATCH 08/15] =?UTF-8?q?fix:=20=ED=98=84=EC=9E=AC=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EB=B2=84=ED=8A=BC=20=EB=B0=8F=20=ED=85=8D=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=9C=84=EC=B9=98=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/UseMap.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/map/UseMap.tsx b/src/components/map/UseMap.tsx index fe625ee..805ad4c 100644 --- a/src/components/map/UseMap.tsx +++ b/src/components/map/UseMap.tsx @@ -179,11 +179,11 @@ const UseMap: React.FC = () => {
    {showMessage && ( <> -
    +
    더 정확한 접속위치를 확인해보세요!
    - Current Location + Current Location )} setShowSearchResults(true)} onChange={handleSearchQueryChange} /> @@ -204,7 +204,7 @@ const UseMap: React.FC = () => { />
    - Current Location + Current Location )} setShowSearchResults(true)} onChange={handleSearchQueryChange} /> @@ -207,7 +216,7 @@ const UseMap: React.FC = () => { className={`absolute ${isModalOpen ? 'bottom-[210px]' : 'bottom-[35px]'} left-4 p-2 flex items-center justify-center`} onMouseEnter={() => setImageSrc('/map/MapLocationActive.png')} onMouseLeave={() => setImageSrc('/map/MapLocation.png')} - onClick={() => setImageSrc('/map/MapLocationActive.png')} + onClick={handleCurrentLocationClick} > Current Location From 49ce7e6e8c89fe4b0ceb120ff4d2a3781957274b Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 28 May 2024 14:39:44 +0900 Subject: [PATCH 10/15] =?UTF-8?q?fix:=20=EC=A7=80=EB=8F=84=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=A7=84=EC=9E=85=20=EC=8B=9C,=20?= =?UTF-8?q?=EB=A7=88=EC=BB=A4=20=ED=81=B4=EB=A6=AD=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EA=B3=A0=20=EC=A7=80=EB=8F=84=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EC=8B=9C=20=EB=A7=88=EC=BB=A4=20=EC=82=AC=EB=9D=BC=EC=A7=80?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/UseMap.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/map/UseMap.tsx b/src/components/map/UseMap.tsx index ccb6f3f..b0d7690 100644 --- a/src/components/map/UseMap.tsx +++ b/src/components/map/UseMap.tsx @@ -34,14 +34,15 @@ const UseMap: React.FC = () => { }; const mapInstance = new naver.maps.Map(mapRef.current, mapOptions); setMap(mapInstance); - + naver.maps.Event.addListener(mapInstance, 'click', () => { setSelectedMarker(null); setIsModalOpen(false); - setMarkers(mapInstance); }); + setMarkers(mapInstance); } }; + if (typeof window !== 'undefined' && window.naver) { initMap(); From da7c3d7dc4568ba09730e3925ec97f961f2619ee Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 28 May 2024 14:42:21 +0900 Subject: [PATCH 11/15] =?UTF-8?q?fix:=20useMap=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20eslint-disable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/UseMap.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/map/UseMap.tsx b/src/components/map/UseMap.tsx index b0d7690..875e3aa 100644 --- a/src/components/map/UseMap.tsx +++ b/src/components/map/UseMap.tsx @@ -1,3 +1,4 @@ +/* eslint-disable react-hooks/exhaustive-deps */ import React, { useEffect, useRef, useState } from 'react'; import Image from 'next/image'; import MapSearchBar from './MapSearchBar'; @@ -67,14 +68,12 @@ const UseMap: React.FC = () => { if (map && branches.length > 0) { setMarkers(map); } - // eslint-disable-next-line react-hooks/exhaustive-deps }, [branches, map]); useEffect(() => { if (map) { setMarkers(map); } - // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedMarker]); useEffect(() => { From a9f406892ac99696b5e6cf915d20aa3cfb8df6e9 Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 28 May 2024 14:47:45 +0900 Subject: [PATCH 12/15] =?UTF-8?q?fix:=20=EB=8D=94=20=EC=A0=95=ED=99=95?= =?UTF-8?q?=ED=95=9C=20=EC=9C=84=EC=B9=98=20=ED=99=95=EC=9D=B8=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=AA=A8=EB=8B=AC=20=EB=A0=8C=EB=8D=94?= =?UTF-8?q?=EB=A7=81=20=EC=8B=9C,=20=ED=81=B4=EB=A6=AD=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EC=9E=91=EB=8F=99=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/OfficeModal.tsx | 15 ++++++++++++--- src/components/map/UseMap.tsx | 15 ++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/components/map/OfficeModal.tsx b/src/components/map/OfficeModal.tsx index 7b9ccb4..1afca2e 100644 --- a/src/components/map/OfficeModal.tsx +++ b/src/components/map/OfficeModal.tsx @@ -10,21 +10,30 @@ const OfficeModal: React.FC = ({ isOpen, onClose, branchName, branch useEffect(() => { const handleClickOutside = (event: MouseEvent) => { const currentLocationButton = document.getElementById('current-location-button'); - if (modalRef.current && !modalRef.current.contains(event.target as Node) && currentLocationButton && !currentLocationButton.contains(event.target as Node)) { + const currentLocationText = document.getElementById('current-location-text'); + if ( + modalRef.current && + !modalRef.current.contains(event.target as Node) && + currentLocationButton && + !currentLocationButton.contains(event.target as Node) && + currentLocationText && + !currentLocationText.contains(event.target as Node) + ) { onClose(); } }; - + if (isOpen) { document.addEventListener('mousedown', handleClickOutside); } else { document.removeEventListener('mousedown', handleClickOutside); } - + return () => { document.removeEventListener('mousedown', handleClickOutside); }; }, [isOpen, onClose]); + if (!isOpen) return null; diff --git a/src/components/map/UseMap.tsx b/src/components/map/UseMap.tsx index 875e3aa..b77bd6a 100644 --- a/src/components/map/UseMap.tsx +++ b/src/components/map/UseMap.tsx @@ -157,10 +157,6 @@ const UseMap: React.FC = () => { }; }, [map]); - const handleDismissMessage = () => { - setShowMessage(false); - }; - const handleMarkerClick = (branch: Branch) => { const position = new naver.maps.LatLng(branch.branchLatitude, branch.branchLongitude); map?.panTo(position); @@ -183,6 +179,15 @@ const UseMap: React.FC = () => { } }; + const handleCurrentLocationTextClick = (e: React.MouseEvent) => { + e.stopPropagation(); + setShowMessage(false); + const button = document.getElementById('current-location-text'); + if (button) { + button.click(); + } + }; + return (
    @@ -190,7 +195,7 @@ const UseMap: React.FC = () => { <>
    더 정확한 접속위치를 확인해보세요! - +
    Current Location From 37c5c33a7c91f823323613197ad923376e4cb855 Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 28 May 2024 15:10:11 +0900 Subject: [PATCH 13/15] =?UTF-8?q?fix:=20api=20url=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/map/getOffice.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/map/getOffice.ts b/src/api/map/getOffice.ts index 6240261..76113bc 100644 --- a/src/api/map/getOffice.ts +++ b/src/api/map/getOffice.ts @@ -3,7 +3,7 @@ const backendUrl = process.env.NEXT_PUBLIC_BASE_URL; export const getBranchInfo = async () => { try { const token = document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1"); - const response = await fetch(`${backendUrl}/branches`, { + const response = await fetch(`${backendUrl}branches`, { method: 'GET', headers: { 'Authorization': `Bearer ${token}`, From 347a335243a3a79b25fa514d177760b321a881a3 Mon Sep 17 00:00:00 2001 From: hojin Date: Tue, 28 May 2024 15:11:10 +0900 Subject: [PATCH 14/15] =?UTF-8?q?fix:=20=EC=BB=A4=EB=AE=A4=EB=8B=88?= =?UTF-8?q?=ED=8B=B0=20=EA=B8=80=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20scale=20d?= =?UTF-8?q?own?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/community/shared/PostDetail.tsx | 2 +- src/components/community/shared/PostItemImageItem.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/community/shared/PostDetail.tsx b/src/components/community/shared/PostDetail.tsx index 216982b..2ace12b 100644 --- a/src/components/community/shared/PostDetail.tsx +++ b/src/components/community/shared/PostDetail.tsx @@ -95,7 +95,7 @@ const PostDetail = ({ postData }: PostDetailType) => {
    {postData.images?.map((image, i) => (
    - +
    ))}
    diff --git a/src/components/community/shared/PostItemImageItem.tsx b/src/components/community/shared/PostItemImageItem.tsx index 9ac8c72..2cad06a 100644 --- a/src/components/community/shared/PostItemImageItem.tsx +++ b/src/components/community/shared/PostItemImageItem.tsx @@ -3,7 +3,7 @@ import React from 'react'; const PostItemImageItem = ({ image, count }: { image: string; count: number }) => { return (
    1 ? 'w-[260px] h-[180px] ' : 'w-[360px] h-[180px] z-1'}`}> - +
    ); }; From cb58bfde47dc3f481efb99d1239def8de2313afe Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 28 May 2024 16:05:23 +0900 Subject: [PATCH 15/15] fix: useMap section tag h-screen --- src/components/map/UseMap.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/map/UseMap.tsx b/src/components/map/UseMap.tsx index b77bd6a..cf0e166 100644 --- a/src/components/map/UseMap.tsx +++ b/src/components/map/UseMap.tsx @@ -189,7 +189,7 @@ const UseMap: React.FC = () => { }; return ( -
    +
    {showMessage && ( <>