1
- import React , { useCallback , useEffect , useState } from "react" ;
1
+ import React , { Suspense , useCallback , useEffect , useState } from "react" ;
2
2
import { AnimatePresence , PanInfo , useDragControls } from "framer-motion" ;
3
3
import Button from "../components/customButton" ;
4
4
import GoBack from "../assets/icon/goBack.svg?react" ;
@@ -12,13 +12,17 @@ import NavigationMap from "../component/NavgationMap";
12
12
import NavigationDescription from "../components/navigation/navigationDescription" ;
13
13
import BottomSheetHandle from "../components/navigation/bottomSheet/bottomSheetHandle" ;
14
14
15
+ import useLoading from "../hooks/useLoading" ;
16
+ import { useSuspenseQuery } from "@tanstack/react-query" ;
17
+ import { getMockTest } from "../utils/fetch/mockFetch" ;
15
18
import Loading from "../components/loading/loading" ;
16
19
import BackButton from "../components/map/backButton" ;
17
20
18
21
import useLoading from "../hooks/useLoading" ;
19
22
import useUniversityInfo from "../hooks/useUniversityInfo" ;
20
23
import useRedirectUndefined from "../hooks/useRedirectUndefined" ;
21
24
25
+
22
26
// 1. 돌아가면 위치 reset ✅
23
27
// 2. 상세경로 scroll 끝까지 가능하게 하기 ❎
24
28
// 3. 코드 리팩토링 하기
@@ -43,14 +47,16 @@ const NavigationResultPage = () => {
43
47
44
48
useScrollControl ( ) ;
45
49
50
+ const { data, status } = useSuspenseQuery ( {
51
+ queryKey : [ "test" ] ,
52
+ queryFn : getMockTest ,
53
+ } ) ;
46
54
const { university } = useUniversityInfo ( ) ;
47
55
useRedirectUndefined < string | undefined > ( [ university ] ) ;
48
56
49
57
useEffect ( ( ) => {
50
- show ( ) ;
51
- const timer = setTimeout ( hide , 5000 ) ;
52
- return ( ) => clearTimeout ( timer ) ;
53
- } , [ ] ) ;
58
+ console . log ( data ) ;
59
+ } , [ status ] ) ;
54
60
55
61
const dragControls = useDragControls ( ) ;
56
62
@@ -77,7 +83,12 @@ const NavigationResultPage = () => {
77
83
78
84
return (
79
85
< div className = "relative h-svh w-full max-w-[450px] mx-auto" >
80
- < Loading isLoading = { isLoading } loadingContent = "경로 탐색 중입니다" />
86
+ < NavigationMap
87
+ style = { { width : "100%" , height : "100%" } }
88
+ routes = { route }
89
+ topPadding = { topBarHeight }
90
+ bottomPadding = { sheetHeight }
91
+ />
81
92
< AnimatedContainer
82
93
isVisible = { ! isDetailView && ! isLoading }
83
94
positionDelta = { 286 }
@@ -87,12 +98,7 @@ const NavigationResultPage = () => {
87
98
>
88
99
< NavigationDescription isDetailView = { ! isDetailView && ! isLoading } />
89
100
</ AnimatedContainer >
90
- < NavigationMap
91
- style = { { width : "100%" , height : "100%" } }
92
- routes = { route }
93
- topPadding = { topBarHeight }
94
- bottomPadding = { sheetHeight }
95
- />
101
+
96
102
< AnimatedContainer
97
103
isVisible = { ! isDetailView && ! isLoading }
98
104
className = "absolute bottom-0 left-0 w-full mb-[30px] px-4"
0 commit comments