From 2081093ea4a45147c069c72fe1eaad858c0ab118 Mon Sep 17 00:00:00 2001 From: evlist Date: Tue, 24 Jan 2023 10:54:36 +0100 Subject: [PATCH] Testing missing icons --- src/components/gpx/styles.ts | 9 ++++++++- src/components/map-tile-provider/MapTileProvider.tsx | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/gpx/styles.ts b/src/components/gpx/styles.ts index d076d32..d39bde3 100644 --- a/src/components/gpx/styles.ts +++ b/src/components/gpx/styles.ts @@ -25,6 +25,7 @@ import { indexOf } from 'lodash'; import { getZoomInteger } from '../map/Map'; import { isHighlighted } from '../map-tile-provider'; import { + getAllPoiTypes, getHighlightedTagValue, getTagValue, } from '../map-tile-provider/MapTileProvider'; @@ -35,6 +36,12 @@ interface StyleParameters { isSelected: boolean; } +getAllPoiTypes().forEach((type) => { + if (!Object.keys(osmIcons).includes(type)) { + console.warn({ caller: 'styles', message: 'missing icon', type }); + } +}); + const icons = { house: { src: houseIcon, @@ -178,7 +185,7 @@ const styles = { }; }, getStyle: memoize((params: any) => { - console.log({ caller: 'getStyle', params }); + // console.log({ caller: 'getStyle', params }); const { isSelected, text, customIcon, hidden } = params; if (hidden) { return null; diff --git a/src/components/map-tile-provider/MapTileProvider.tsx b/src/components/map-tile-provider/MapTileProvider.tsx index 2836bf1..e4eac60 100644 --- a/src/components/map-tile-provider/MapTileProvider.tsx +++ b/src/components/map-tile-provider/MapTileProvider.tsx @@ -212,6 +212,15 @@ const currentOverlayHighlightedKey = () => export const currentOverlayHighlightedDefinition = () => currentCategory()[currentOverlayHighlightedKey()]; +export const getAllPoiTypes = () => { + let result = new Set(); + Object.keys(overlayDefinitions).forEach((tagName) => { + const tag = overlayDefinitions[tagName]; + result = new Set([...result, ...Object.keys(tag)]); + }); + return [...result]; +}; + export const highlightedTags = () => { let result = {}; Object.keys(overlayDefinitions).forEach((tagName) => {