From 3a809cb4d05bf3bfe208a848678147b6bdfa738b Mon Sep 17 00:00:00 2001 From: HarelM Date: Wed, 13 Mar 2024 22:37:34 +0200 Subject: [PATCH] Simplify code --- src/components/MapMaplibreGlFeaturePropertyPopup.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/MapMaplibreGlFeaturePropertyPopup.tsx b/src/components/MapMaplibreGlFeaturePropertyPopup.tsx index e77d9d07..477a77f1 100644 --- a/src/components/MapMaplibreGlFeaturePropertyPopup.tsx +++ b/src/components/MapMaplibreGlFeaturePropertyPopup.tsx @@ -15,8 +15,8 @@ function displayValue(value: string | number | Date | object | undefined) { return value; } -function renderKeyValueTableRow(key: string, value: string | undefined, idx: number) { - return +function renderKeyValueTableRow(key: string, value: string | undefined) { + return {key} {value} @@ -24,14 +24,14 @@ function renderKeyValueTableRow(key: string, value: string | undefined, idx: num function renderFeature(feature: InspectFeature, idx: number) { return - + {feature.layer['source']}: {feature.layer['source-layer']}{feature.inspectModeCounter && × {feature.inspectModeCounter}} - {renderKeyValueTableRow("$type", feature.geometry.type, idx)} - {renderKeyValueTableRow("Feature ID", displayValue(feature.id), idx)} + {renderKeyValueTableRow("$type", feature.geometry.type)} + {renderKeyValueTableRow("Feature ID", displayValue(feature.id))} {Object.keys(feature.properties).map(propertyName => { const property = feature.properties[propertyName]; - return renderKeyValueTableRow(propertyName, displayValue(property), idx) + return renderKeyValueTableRow(propertyName, displayValue(property)) })} }