Skip to content

Commit 74da9df

Browse files
Merge pull request #11 from itk-dev/feature/route-index-indication
Feature/route index indication
2 parents fc85702 + e33677b commit 74da9df

File tree

2 files changed

+56
-42
lines changed

2 files changed

+56
-42
lines changed

src/components/points-of-interest/PointOfInterest.jsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function PointOfInterest({
2121
podcast,
2222
IFrameUrl,
2323
},
24+
index,
2425
}) {
2526
const { lat, long } = useContext(LatLongContext);
2627
const { setSource } = useContext(AudioContext);
@@ -91,10 +92,13 @@ function PointOfInterest({
9192
<div
9293
className={
9394
unlocked
94-
? `flex items-start gap-4 p-4`
95-
: `flex items-start gap-4 p-4 opacity-10`
95+
? `relative flex items-start gap-4 p-2 bg-white dark:bg-zinc-700 rounded-lg`
96+
: `relative flex items-start gap-4 p-2 bg-white dark:bg-zinc-700 rounded-lg opacity-10`
9697
}
9798
>
99+
<div className="absolute -left-3 px-2 font-bold rounded-full bg-emerald-700 text-zinc-100 text-sm">
100+
{index}
101+
</div>
98102
<Image src={image} className="w-24 h-24 rounded-full" />
99103
<div className="flex flex-col">
100104
<h2 className="text-zinc-900 text-sm font-bold dark:text-zinc-200 my-3">
@@ -138,7 +142,7 @@ function PointOfInterest({
138142
)}
139143
</div>
140144
{viewSubtitles && (
141-
<div className="bg-zinc-200 text-zinc-800 dark:bg-zinc-500 dark:text-white p-2 rounded mt-2">
145+
<div className="bg-zinc-200 text-zinc-800 dark:bg-zinc-600 dark:text-white p-2 rounded mt-2">
142146
{subtitles}
143147
</div>
144148
)}

src/components/routes/RoutePage.jsx

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function RoutePage() {
2121
const [userLatitude, setUserLatitude] = useState(0);
2222
const [userLongitude, setUserLongitude] = useState(0);
2323
const { audio } = useContext(AudioContext);
24-
let handlerAvailable = true;
25-
let locationHandlerAvailable = true;
24+
const handlerAvailable = true;
25+
const locationHandlerAvailable = true;
2626
const isIOS =
2727
navigator.userAgent.match(/(iPod|iPhone|iPad)/) &&
2828
navigator.userAgent.match(/AppleWebKit/);
@@ -86,10 +86,8 @@ function RoutePage() {
8686
);
8787
}
8888
}, []);
89-
9089
useEffect(() => {
9190
if (pointsOfInterest) {
92-
console.log(pointsOfInterest);
9391
setLatitude(pointsOfInterest[0].latitude);
9492
setLongitude(pointsOfInterest[0].longitude);
9593
setDestinationName(pointsOfInterest[0].name);
@@ -102,48 +100,60 @@ function RoutePage() {
102100
<div className="flex flex-col place-items-start pb-20">
103101
<BackButton>Afslut</BackButton>
104102
<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">
106104
{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+
))}
115112
</div>
116113
{/* TODO: Make room for audio player below when playing */}
117114
<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">
118115
<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
139120
</span>
140121
</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+
)}
147157
</div>
148158
</div>
149159
</div>

0 commit comments

Comments
 (0)