Skip to content

Commit fce060f

Browse files
committed
SALG-1278: Add index on poi
1 parent 3c444e6 commit fce060f

File tree

2 files changed

+41
-45
lines changed

2 files changed

+41
-45
lines changed

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

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function PointOfInterest({
2020
subtitles,
2121
podcast,
2222
IFrameUrl,
23-
},
23+
}, index
2424
}) {
2525
const { lat, long } = useContext(LatLongContext);
2626
const { setSource } = useContext(AudioContext);
@@ -85,17 +85,19 @@ function PointOfInterest({
8585
if (isExperienceIdInLocalstorage()) {
8686
setUnlocked(true);
8787
}
88-
8988
}, []);
9089

9190
return (
9291
<div
9392
className={
9493
unlocked
95-
? `flex items-start gap-4 p-4`
96-
: `flex items-start gap-4 p-4 opacity-10`
94+
? `relative flex items-start gap-4 p-2 bg-white dark:bg-zinc-700 rounded-lg`
95+
: `relative flex items-start gap-4 p-2 bg-white dark:bg-zinc-700 rounded-lg opacity-10`
9796
}
9897
>
98+
<div className="absolute -left-3 px-2 font-bold rounded-full bg-emerald-700 text-zinc-100 text-sm">
99+
{index}
100+
</div>
99101
<Image src={image} className="w-24 h-24 rounded-full" />
100102
<div className="flex flex-col">
101103
<h2 className="text-zinc-900 text-sm font-bold dark:text-zinc-200 my-3">
@@ -146,18 +148,6 @@ function PointOfInterest({
146148
{!unlocked && <div>Lås op ved at gå tættere på</div>}
147149
</div>
148150
</div>
149-
{unlocked && (
150-
<button type="button" onClick={() => setSource(podcast)}>
151-
Play
152-
</button>
153-
)}
154-
{unlocked && (
155-
<button type="button" onClick={() => setViewSubtitles(!viewSubtitles)}>
156-
Se tekst
157-
</button>
158-
)}
159-
{!unlocked && <div>kan ikke tilgås</div>}
160-
{viewSubtitles && <div>{subtitles}</div>}
161151
{unlocked && IFrameUrl && <PodcastWrapper IFrameUrl={IFrameUrl} />}
162152
</div>
163153
);

src/components/routes/RoutePage.jsx

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -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,14 +100,14 @@ 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 &&
107105
pointsOfInterest
108-
.toReversed()
109-
.map((pointOfInterest) => (
106+
.map((pointOfInterest, index) => (
110107
<PointOfInterest
111108
pointOfInterest={pointOfInterest}
112109
key={pointOfInterest.id}
110+
index={index + 1}
113111
/>
114112
))}
115113
</div>
@@ -118,32 +116,40 @@ function RoutePage() {
118116
<div>
119117
<span className="block text-sm text-bold">Afstand til del 1</span>
120118
<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>
128119
</div>
129120
<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-
/>
139-
</span>
140-
</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>
121+
{/* TODO: Make this check for compass */}
122+
{!location && (
123+
<button
124+
className="bg-zinc-700 dark:bg-zinc-200 dark:text-zinc-800 rounded text-sm py-1 px-3"
125+
type="button"
126+
onClick={() => startWaypointer()}
127+
>
128+
Vis mig vej
129+
</button>
130+
)}
131+
{/* TODO: Make this check for compass */}
132+
{location && (
133+
<div>
134+
<div className="flex justify-between mb-3">
135+
<span className="text-sm text-bold">Retning</span>
136+
<span className="w-1/2">
137+
<LocationArrow
138+
className="inline w-5"
139+
style={{
140+
transform: `rotate(${-rotation}deg)`,
141+
}}
142+
/>
143+
</span>
144+
</div>
145+
<div className="text-xs text-zinc-500">
146+
Lat: {userLatitude}/{latitude}
147+
</div>
148+
<div className="text-xs text-zinc-500">
149+
Long: {userLongitude}/{longitude}
150+
</div>
151+
</div>
152+
)}
147153
</div>
148154
</div>
149155
</div>

0 commit comments

Comments
 (0)