@@ -16,6 +16,7 @@ import XYZ from 'ol/source/XYZ'
16
16
import ReactDOMServer from 'react-dom/server'
17
17
import * as S from '~pages/WalkPage/styles'
18
18
import { MIN_ACCURACY , MIN_DISTANCE , MIN_TIME_INTERVAL } from '~types/map'
19
+ import { useNavigate } from 'react-router-dom'
19
20
20
21
const ORS_API_URL = '/ors/v2/directions/foot-walking/geojson'
21
22
@@ -30,7 +31,12 @@ export const getMarkerIconString = () => {
30
31
return svgString
31
32
}
32
33
33
- export default function MapComponent ( ) {
34
+ // ๋ชจ๋ฌ ์ํ๋ฅผ props๋ก ๋ฐ๋๋ก ์์
35
+ interface MapComponentProps {
36
+ isModalOpen ?: boolean
37
+ }
38
+
39
+ export default function MapComponent ( { isModalOpen = false } : MapComponentProps ) {
34
40
// ์ง๋ ๊ด๋ จ ref
35
41
const mapRef = useRef < Map | null > ( null )
36
42
const currentLocationMarkerRef = useRef < Feature < Geometry > | null > ( null )
@@ -63,6 +69,8 @@ export default function MapComponent() {
63
69
const [ autoRotate , setAutoRotate ] = useState < boolean > ( false )
64
70
const lastHeadingRef = useRef < number > ( 0 )
65
71
72
+ const navigate = useNavigate ( )
73
+
66
74
useEffect ( ( ) => {
67
75
return ( ) => {
68
76
if ( currentLocationMarkerRef . current ) {
@@ -591,6 +599,8 @@ export default function MapComponent() {
591
599
duration : 500 ,
592
600
} )
593
601
}
602
+
603
+ navigate ( '/walk-complete' )
594
604
}
595
605
}
596
606
@@ -700,6 +710,7 @@ export default function MapComponent() {
700
710
$bgColor = { isWalking ? 'font_1' : 'default' }
701
711
$fontWeight = '700'
702
712
$isWalking = { isWalking }
713
+ disabled = { isModalOpen } // ๋ชจ๋ฌ์ด ์ด๋ ค์์ ๋ ๋ฒํผ ๋นํ์ฑํ
703
714
>
704
715
{ isWalking ? '์ฐ์ฑ
๋' : '์ฐ์ฑ
์์' }
705
716
</ S . StyledActionButton >
@@ -716,6 +727,7 @@ export default function MapComponent() {
716
727
$bgColor = { isWalking ? 'font_1' : 'default' }
717
728
$fontWeight = '700'
718
729
$isWalking = { isWalking }
730
+ disabled = { isModalOpen } // ๋ชจ๋ฌ์ด ์ด๋ ค์์ ๋ ๋ฒํผ ๋นํ์ฑํ
719
731
>
720
732
{ isWalking ? '์ฐ์ฑ
๋' : '์ฐ์ฑ
์์' }
721
733
</ S . StyledActionButton >
0 commit comments