Skip to content

Commit 8e1037c

Browse files
committed
๐Ÿ› Fix: ๋ชจ๋‹ฌ ๊ด€๋ จ ์ถ”๊ฐ€
1 parent d557129 commit 8e1037c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

โ€Žsrc/pages/WalkPage/components/MapComponent/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import XYZ from 'ol/source/XYZ'
1616
import ReactDOMServer from 'react-dom/server'
1717
import * as S from '~pages/WalkPage/styles'
1818
import { MIN_ACCURACY, MIN_DISTANCE, MIN_TIME_INTERVAL } from '~types/map'
19+
import { useNavigate } from 'react-router-dom'
1920

2021
const ORS_API_URL = '/ors/v2/directions/foot-walking/geojson'
2122

@@ -30,7 +31,12 @@ export const getMarkerIconString = () => {
3031
return svgString
3132
}
3233

33-
export default function MapComponent() {
34+
// ๋ชจ๋‹ฌ ์ƒํƒœ๋ฅผ props๋กœ ๋ฐ›๋„๋ก ์ˆ˜์ •
35+
interface MapComponentProps {
36+
isModalOpen?: boolean
37+
}
38+
39+
export default function MapComponent({ isModalOpen = false }: MapComponentProps) {
3440
// ์ง€๋„ ๊ด€๋ จ ref
3541
const mapRef = useRef<Map | null>(null)
3642
const currentLocationMarkerRef = useRef<Feature<Geometry> | null>(null)
@@ -63,6 +69,8 @@ export default function MapComponent() {
6369
const [autoRotate, setAutoRotate] = useState<boolean>(false)
6470
const lastHeadingRef = useRef<number>(0)
6571

72+
const navigate = useNavigate()
73+
6674
useEffect(() => {
6775
return () => {
6876
if (currentLocationMarkerRef.current) {
@@ -591,6 +599,8 @@ export default function MapComponent() {
591599
duration: 500,
592600
})
593601
}
602+
603+
navigate('/walk-complete')
594604
}
595605
}
596606

@@ -700,6 +710,7 @@ export default function MapComponent() {
700710
$bgColor={isWalking ? 'font_1' : 'default'}
701711
$fontWeight='700'
702712
$isWalking={isWalking}
713+
disabled={isModalOpen} // ๋ชจ๋‹ฌ์ด ์—ด๋ ค์žˆ์„ ๋•Œ ๋ฒ„ํŠผ ๋น„ํ™œ์„ฑํ™”
703714
>
704715
{isWalking ? '์‚ฐ์ฑ… ๋' : '์‚ฐ์ฑ… ์‹œ์ž‘'}
705716
</S.StyledActionButton>
@@ -716,6 +727,7 @@ export default function MapComponent() {
716727
$bgColor={isWalking ? 'font_1' : 'default'}
717728
$fontWeight='700'
718729
$isWalking={isWalking}
730+
disabled={isModalOpen} // ๋ชจ๋‹ฌ์ด ์—ด๋ ค์žˆ์„ ๋•Œ ๋ฒ„ํŠผ ๋น„ํ™œ์„ฑํ™”
719731
>
720732
{isWalking ? '์‚ฐ์ฑ… ๋' : '์‚ฐ์ฑ… ์‹œ์ž‘'}
721733
</S.StyledActionButton>

โ€Žsrc/pages/WalkPage/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export default function WalkPage() {
3939
</S.Header>
4040

4141
<MapComponent isModalOpen={isModalOpen} />
42-
4342
<WalkerListModal isOpen={isWalkerListOpen} onClose={handleWalkerListClose} isClosing={isClosing} />
4443
</S.WalkPage>
4544
)

0 commit comments

Comments
ย (0)