aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcin Zelent <marcin@zelent.net>2022-12-05 11:21:35 +0100
committerMarcin Zelent <marcin@zelent.net>2022-12-05 11:21:35 +0100
commit9162b172802af37b6a26f7d7d3a2a39cd696f046 (patch)
tree4a4f3f9f71fb7c11c0352c3149875aa780652dfa /src
parentf2ecc1803f3ea294a0c6b7915b61348ed0395b26 (diff)
Fixed loading of assets with a path other than /
Diffstat (limited to 'src')
-rw-r--r--src/components/Map/Map.tsx22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/components/Map/Map.tsx b/src/components/Map/Map.tsx
index 6f2f469..33b9970 100644
--- a/src/components/Map/Map.tsx
+++ b/src/components/Map/Map.tsx
@@ -67,7 +67,10 @@ export default function Map({ group, handleMarkerClick }: Props): JSX.Element {
function getClusterGroupIcon(markerCluster: MarkerCluster): DivIcon {
const iconUrl = markerCluster
.getAllChildMarkers()
- .filter((m) => m.getIcon().options.iconUrl !== '/icons/thumb-placeholder.png')[0]
+ .filter(
+ (m) =>
+ m.getIcon().options.iconUrl !== `${process.env.PUBLIC_URL}/icons/thumb-placeholder.png`,
+ )[0]
.getIcon().options.iconUrl;
return new DivIcon({
@@ -95,7 +98,8 @@ export default function Map({ group, handleMarkerClick }: Props): JSX.Element {
position={[mediaItem.latitude as number, mediaItem.longitude as number]}
icon={
new Icon({
- iconUrl: mediaItem.thumbnail ?? '/icons/thumb-placeholder.png',
+ iconUrl:
+ mediaItem.thumbnail ?? `${process.env.PUBLIC_URL}/icons/thumb-placeholder.png`,
iconSize: [36, 36],
className: styles.markerIcon,
})
@@ -174,12 +178,22 @@ export default function Map({ group, handleMarkerClick }: Props): JSX.Element {
<Marker
key={`start-marker-${group.id}-${i}`}
position={startCoords as [number, number]}
- icon={new Icon({ iconUrl: '/icons/start.png', className: styles.iconShadow })}
+ icon={
+ new Icon({
+ iconUrl: `${process.env.PUBLIC_URL}/icons/start.png`,
+ className: styles.iconShadow,
+ })
+ }
/>
<Marker
key={`finish-marker-${group.id}-${i}`}
position={finishCoords as [number, number]}
- icon={new Icon({ iconUrl: '/icons/finish.png', className: styles.iconShadow })}
+ icon={
+ new Icon({
+ iconUrl: `${process.env.PUBLIC_URL}/icons/finish.png`,
+ className: styles.iconShadow,
+ })
+ }
/>
</React.Fragment>
);