@@ -21,8 +21,8 @@ function RoutePage() {
21
21
const [ userLatitude , setUserLatitude ] = useState ( 0 ) ;
22
22
const [ userLongitude , setUserLongitude ] = useState ( 0 ) ;
23
23
const { audio } = useContext ( AudioContext ) ;
24
- let handlerAvailable = true ;
25
- let locationHandlerAvailable = true ;
24
+ const handlerAvailable = true ;
25
+ const locationHandlerAvailable = true ;
26
26
const isIOS =
27
27
navigator . userAgent . match ( / ( i P o d | i P h o n e | i P a d ) / ) &&
28
28
navigator . userAgent . match ( / A p p l e W e b K i t / ) ;
@@ -86,10 +86,8 @@ function RoutePage() {
86
86
) ;
87
87
}
88
88
} , [ ] ) ;
89
-
90
89
useEffect ( ( ) => {
91
90
if ( pointsOfInterest ) {
92
- console . log ( pointsOfInterest ) ;
93
91
setLatitude ( pointsOfInterest [ 0 ] . latitude ) ;
94
92
setLongitude ( pointsOfInterest [ 0 ] . longitude ) ;
95
93
setDestinationName ( pointsOfInterest [ 0 ] . name ) ;
@@ -102,48 +100,60 @@ function RoutePage() {
102
100
< div className = "flex flex-col place-items-start pb-20" >
103
101
< BackButton > Afslut</ BackButton >
104
102
< h1 className = "text-xl font-bold my-3" > { selectedRoute . name } </ h1 >
105
- < div className = "overflow-y-auto h-4/6 relative w-full bg-white dark:bg-zinc-700 dark:highlight-white/5 shadow-lg ring-1 ring-black/5 rounded-lg flex flex-col divide-y dark:divide-zinc-200/5 " >
103
+ < div className = "relative w-full rounded-lg flex flex-col-reverse gap-1 " >
106
104
{ pointsOfInterest &&
107
- pointsOfInterest
108
- . toReversed ( )
109
- . map ( ( pointOfInterest ) => (
110
- < PointOfInterest
111
- pointOfInterest = { pointOfInterest }
112
- key = { pointOfInterest . id }
113
- />
114
- ) ) }
105
+ pointsOfInterest . map ( ( pointOfInterest , index ) => (
106
+ < PointOfInterest
107
+ pointOfInterest = { pointOfInterest }
108
+ key = { pointOfInterest . id }
109
+ index = { index + 1 }
110
+ />
111
+ ) ) }
115
112
</ div >
116
113
{ /* TODO: Make room for audio player below when playing */ }
117
114
< div className = "fixed left-3 bottom-3 right-3 bg-zinc-200 dark:bg-zinc-700 flex gap-3 rounded-lg p-3 pb-15 divide-x dark:divide-zinc-200/5" >
118
115
< div >
119
- < span className = "block text-sm text-bold" > Afstand til del 1</ span >
120
- < span className = "block" > 180 meter</ span >
121
- < button
122
- className = "bg-zinc-700 dark:bg-zinc-200 dark:text-zinc-800 rounded text-sm py-1 px-3"
123
- type = "button"
124
- onClick = { ( ) => startWaypointer ( ) }
125
- >
126
- Vis mig vej
127
- </ button >
128
- </ div >
129
- < div className = "pl-3" >
130
- < div className = "flex justify-between mb-3" >
131
- < span className = "text-sm text-bold" > Retning</ span >
132
- < span className = "w-1/2" >
133
- < LocationArrow
134
- className = "inline w-5"
135
- style = { {
136
- transform : `rotate(${ - rotation } deg)` ,
137
- } }
138
- />
116
+ < div className = "text-sm text-bold" >
117
+ Afstand til del
118
+ < span className = "ml-1 px-2 font-bold rounded-full bg-emerald-700 text-zinc-100 text-sm" >
119
+ 1
139
120
</ span >
140
121
</ div >
141
- < div className = "text-xs text-zinc-500" >
142
- Lat: { userLatitude } /{ latitude }
143
- </ div >
144
- < div className = "text-xs text-zinc-500" >
145
- Long: { userLongitude } /{ longitude }
146
- </ div >
122
+ < div className = "" > 180 meter</ div >
123
+ </ div >
124
+ < div className = "pl-3" >
125
+ { /* TODO: Make this check for compass */ }
126
+ { ! location && (
127
+ < button
128
+ className = "bg-zinc-700 dark:bg-zinc-200 dark:text-zinc-800 rounded text-sm py-1 px-3"
129
+ type = "button"
130
+ onClick = { ( ) => startWaypointer ( ) }
131
+ >
132
+ Vis mig vej
133
+ </ button >
134
+ ) }
135
+ { /* TODO: Make this check for compass */ }
136
+ { location && (
137
+ < div >
138
+ < div className = "flex justify-between mb-3" >
139
+ < span className = "text-sm text-bold" > Retning</ span >
140
+ < span className = "w-1/2" >
141
+ < LocationArrow
142
+ className = "inline w-5"
143
+ style = { {
144
+ transform : `rotate(${ - rotation } deg)` ,
145
+ } }
146
+ />
147
+ </ span >
148
+ </ div >
149
+ < div className = "text-xs text-zinc-500" >
150
+ Lat: { userLatitude } /{ latitude }
151
+ </ div >
152
+ < div className = "text-xs text-zinc-500" >
153
+ Long: { userLongitude } /{ longitude }
154
+ </ div >
155
+ </ div >
156
+ ) }
147
157
</ div >
148
158
</ div >
149
159
</ div >
0 commit comments