From 83a451124ade620e99ffa56864dcaa4d0ce081db Mon Sep 17 00:00:00 2001 From: leeleeleeleejun Date: Fri, 21 Nov 2025 00:54:42 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=9D=B4=ED=83=88=20=ED=9B=84=20=EC=9E=AC=EC=A7=84=EC=9E=85=20?= =?UTF-8?q?=EC=8B=9C=20=EC=9D=B4=EC=A0=84=20=EC=A7=80=EB=8F=84=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EB=A7=88=EC=A7=80=EB=A7=89=20=EC=9C=84=EC=B9=98?= =?UTF-8?q?=EB=A1=9C=20defalutCenter=20=EC=84=A4=EC=A0=95=20-=20=EB=A7=88?= =?UTF-8?q?=EC=A7=80=EB=A7=89=20=EC=A7=80=EB=8F=84=20=EC=A4=91=EC=95=99=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EC=A0=84=EC=97=AD=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EB=A1=9C=20=EA=B4=80=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/app/_store/prevMapCenter.ts | 12 ++++++++++++ apps/web/app/map/MapComponent.tsx | 13 ++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 apps/web/app/_store/prevMapCenter.ts diff --git a/apps/web/app/_store/prevMapCenter.ts b/apps/web/app/_store/prevMapCenter.ts new file mode 100644 index 0000000..5c97819 --- /dev/null +++ b/apps/web/app/_store/prevMapCenter.ts @@ -0,0 +1,12 @@ +import { create } from 'zustand' +import { Coord } from '@/map/_utils/toLatLng' + +type LastMapCenter = { + lastMapCenter: Coord | null + setLastMapCenter: (mapCenter: Coord) => void +} + +export const useLastMapCenterStore = create((set) => ({ + lastMapCenter: null, + setLastMapCenter: (mapCenter: Coord) => set({ lastMapCenter: mapCenter }), +})) diff --git a/apps/web/app/map/MapComponent.tsx b/apps/web/app/map/MapComponent.tsx index 866b6cd..955c017 100644 --- a/apps/web/app/map/MapComponent.tsx +++ b/apps/web/app/map/MapComponent.tsx @@ -6,6 +6,7 @@ import { Container, NaverMap } from 'react-naver-maps' import { CAMPUS_LOCATION } from '@/_constants/campus' import { useCampusStore } from '@/_store/campus' +import { useLastMapCenterStore } from '@/_store/prevMapCenter' import { usePlaceQueries } from '@/_apis/queries/place' import type { MapBounds } from '@/_apis/schemas/place' @@ -27,9 +28,11 @@ const MapComponent = () => { const [showUpdateButton, setShowUpdateButton] = useState(false) const { campus } = useCampusStore() + const { lastMapCenter, setLastMapCenter } = useLastMapCenterStore() const { userLocation } = useWatchLocation() const { data = [] } = useQuery(usePlaceQueries.byMap(currentBounds)) + const defaultCenter = toLatLng(lastMapCenter || CAMPUS_LOCATION[campus]) const previewPlace = previewPlaceId ? data.find((place) => place.placeId === previewPlaceId)! : null @@ -77,6 +80,14 @@ const MapComponent = () => { } useEffect(refreshMapBounds, [refreshMapBounds]) + useEffect(() => { + return () => { + if (!map) return + const { x: longitude, y: latitude } = map.getCenter() + + setLastMapCenter({ longitude, latitude }) + } + }, [map, setLastMapCenter]) return ( <> @@ -97,7 +108,7 @@ const MapComponent = () => { > {userLocation && } From 22848b594b17c3743752376d178599f159883db9 Mon Sep 17 00:00:00 2001 From: leeleeleeleejun Date: Fri, 21 Nov 2025 00:55:15 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20NaverMap=EC=97=90=20default=20and?= =?UTF-8?q?=20minimum=20zoom=20=EC=86=8D=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/requests/[id]/_components/Location/Location.tsx | 7 ++++++- apps/web/app/map/MapComponent.tsx | 2 ++ apps/web/app/places/[id]/_components/Location/Location.tsx | 7 ++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/admin/src/app/requests/[id]/_components/Location/Location.tsx b/apps/admin/src/app/requests/[id]/_components/Location/Location.tsx index 2f3a97c..b7d49c7 100644 --- a/apps/admin/src/app/requests/[id]/_components/Location/Location.tsx +++ b/apps/admin/src/app/requests/[id]/_components/Location/Location.tsx @@ -17,7 +17,12 @@ export const Location = ({ location }: Props) => { 위치 - + diff --git a/apps/web/app/map/MapComponent.tsx b/apps/web/app/map/MapComponent.tsx index 955c017..dd5fc36 100644 --- a/apps/web/app/map/MapComponent.tsx +++ b/apps/web/app/map/MapComponent.tsx @@ -107,6 +107,8 @@ const MapComponent = () => { onMouseUp={onCenterChanged} > { - + From 16096a4fd300d70bb6f54d4e692baed59951d941 Mon Sep 17 00:00:00 2001 From: leeleeleeleejun Date: Fri, 21 Nov 2025 00:55:47 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=EC=82=AC=EC=A7=84=EC=9D=B4=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EB=84=98=EC=96=B4?= =?UTF-8?q?=EA=B0=90=20=EB=B2=84=EA=B7=B8=20=EB=B0=9C=EC=83=9D=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/app/map/_components/PreviewPlace/PreviewPlace.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/app/map/_components/PreviewPlace/PreviewPlace.tsx b/apps/web/app/map/_components/PreviewPlace/PreviewPlace.tsx index a879262..d96dd08 100644 --- a/apps/web/app/map/_components/PreviewPlace/PreviewPlace.tsx +++ b/apps/web/app/map/_components/PreviewPlace/PreviewPlace.tsx @@ -35,7 +35,7 @@ export const PreviewPlace = ({ place }: { place: PlaceByMap }) => { {address} - {photos.map((photo) => ( + {photos.slice(0, 5).map((photo) => (