Skip to content

Commit

Permalink
manyCombo
Browse files Browse the repository at this point in the history
  • Loading branch information
zbycz committed Oct 27, 2023
1 parent 31819b5 commit 166efa4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/components/FeaturePanel/Properties/IdSchemeFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ const render = (
));
}

if (field?.type === 'manyCombo') {
return tagsForField.map(({ key, value: value2 }) => (
<div key={key}>
{fieldTranslation.options[key]}:{' '}
{renderValue(key, fieldTranslation.options[value2]?.title ?? value2)}
</div>
));
}

if (tagsForField?.length >= 2) {
return (
<>
Expand Down
8 changes: 7 additions & 1 deletion src/components/FeaturePanel/Properties/renderValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ const getHumanValue = (k, v, featured: boolean) => {
if (featured && k === 'wikidata') {
return `Wikipedia (wikidata)`; // TODO fetch label from wikidata
}
if (v === 'yes') {
return '✓';
}
if (v === 'no') {
return '✗';
}

return humanValue;
};
Expand All @@ -40,5 +46,5 @@ export const renderValue = (k, v, featured = false) => {
const url = getUrlForTag(k, v);
const humanValue = getHumanValue(k, v, featured);

return url ? <a href={url}>{slashToOptionalBr(humanValue)}</a> : v;
return url ? <a href={url}>{slashToOptionalBr(humanValue)}</a> : humanValue;
};

0 comments on commit 166efa4

Please sign in to comment.