From bc8db1010198b38c86363baa9e9e955d17dbad18 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 29 Apr 2026 19:02:55 +0000 Subject: [PATCH] Use local wiki_url in LINKS section when available When wiki_url is present from the API (has_kiwix_wiki enabled with local coverage), use it instead of building a wikipedia.org link. Shows article name with (local) indicator consistent with the Read More link. Also adds wikivoyage_url link when available. Co-Authored-By: Claude Opus 4.5 --- src/components/PlaceCard.jsx | 24 +++++++++++++++++++++--- src/components/PlaceDetail.jsx | 31 ++++++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/components/PlaceCard.jsx b/src/components/PlaceCard.jsx index 3447608..72f00e1 100644 --- a/src/components/PlaceCard.jsx +++ b/src/components/PlaceCard.jsx @@ -224,13 +224,13 @@ function EnrichmentSkeleton() { function EnrichmentSections({ details }) { if (!details) return null - const { category, extratags } = details + const { category, extratags, wiki_url, wikivoyage_url } = details const et = extratags || {} const hasAbout = category const hasHours = et.opening_hours const hasContact = et.phone || et.website || et.email const hasDetails = et.cuisine || et.operator || et.fee || et.wheelchair || et.takeaway - const hasLinks = et.wikipedia || et.wikidata + const hasLinks = et.wikipedia || et.wikidata || wiki_url || wikivoyage_url if (!hasAbout && !hasHours && !hasContact && !hasDetails && !hasLinks) return null let idx = 0 return ( @@ -264,7 +264,25 @@ function EnrichmentSections({ details }) { {hasLinks && (
- {et.wikipedia && wikiUrl(et.wikipedia) && {wikiLabel(et.wikipedia)}} + {et.wikipedia && (wiki_url ? ( + + + {wikiLabel(et.wikipedia)} + (local) + + ) : wikiUrl(et.wikipedia) && ( + + + {wikiLabel(et.wikipedia)} + + ))} + {wikivoyage_url && ( + + + Travel guide + (local) + + )} {et.wikidata && View on Wikidata}
diff --git a/src/components/PlaceDetail.jsx b/src/components/PlaceDetail.jsx index 5ecc915..be24c26 100644 --- a/src/components/PlaceDetail.jsx +++ b/src/components/PlaceDetail.jsx @@ -253,14 +253,14 @@ function CopyPopover({ address, selectedPlace, onClose }) { function EnrichmentSections({ details }) { if (!details) return null - const { category, extratags } = details + const { category, extratags, wiki_url, wikivoyage_url } = details const et = extratags || {} const hasAbout = category const hasHours = et.opening_hours const hasContact = et.phone || et.website || et.email const hasDetails = et.cuisine || et.operator || et.fee || et.wheelchair || et.takeaway - const hasLinks = et.wikipedia || et.wikidata + const hasLinks = et.wikipedia || et.wikidata || wiki_url || wikivoyage_url if (!hasAbout && !hasHours && !hasContact && !hasDetails && !hasLinks) return null @@ -322,7 +322,19 @@ function EnrichmentSections({ details }) { {hasLinks && (
- {et.wikipedia && wikiUrl(et.wikipedia) && ( + {et.wikipedia && (wiki_url ? ( + + + {wikiLabel(et.wikipedia)} + (local) + + ) : wikiUrl(et.wikipedia) && ( {wikiLabel(et.wikipedia)} + ))} + {wikivoyage_url && ( + + + Travel guide + (local) + )} {et.wikidata && (