From 99ee50c04075821594e2841239e3240866ccab65 Mon Sep 17 00:00:00 2001 From: SeanLebida Date: Thu, 1 Oct 2026 13:20:48 -0400 Subject: [PATCH] fix(ui): keep Wikipedia last on every Citations surface Sort Wikipedia/Wikimedia after all other kinds (shared Citations + Credits), retag route Wikipedia rows that were marked secondary-scholarly, and leave KJV/ASV credit links above Wikimedia when they only share a wikipedia.org URL. --- content/citations.extra.json | 12 ++++++------ src/components/CreditsView.tsx | 6 ++++-- src/content/citations.test.tsx | 23 +++++++++++++++++++++++ src/content/citations.tsx | 14 +++++++------- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/content/citations.extra.json b/content/citations.extra.json index 6375726..3b87aa8 100644 --- a/content/citations.extra.json +++ b/content/citations.extra.json @@ -765,7 +765,7 @@ "en": "Wikipedia, 'Via Egnatia'" }, "url": "https://en.wikipedia.org/wiki/Via_Egnatia", - "kind": "secondary-scholarly" + "kind": "tertiary-popular" }, { "id": "cit-route-via-appia", @@ -773,7 +773,7 @@ "en": "Wikipedia, 'Appian Way'" }, "url": "https://en.wikipedia.org/wiki/Appian_Way", - "kind": "secondary-scholarly" + "kind": "tertiary-popular" }, { "id": "cit-route-via-sebaste", @@ -781,7 +781,7 @@ "en": "Wikipedia, 'Via Sebaste'" }, "url": "https://en.wikipedia.org/wiki/Via_Sebaste", - "kind": "secondary-scholarly" + "kind": "tertiary-popular" }, { "id": "cit-route-cilician-gates", @@ -789,7 +789,7 @@ "en": "Wikipedia, 'Cilician Gates'" }, "url": "https://en.wikipedia.org/wiki/Cilician_Gates", - "kind": "secondary-scholarly" + "kind": "tertiary-popular" }, { "id": "cit-route-kings-highway", @@ -797,7 +797,7 @@ "en": "Wikipedia, 'King's Highway (ancient)'" }, "url": "https://en.wikipedia.org/wiki/King%27s_Highway_(ancient)", - "kind": "secondary-scholarly" + "kind": "tertiary-popular" }, { "id": "cit-route-acts-sea", @@ -805,7 +805,7 @@ "en": "Wikipedia, 'Acts 27' (the voyage and shipwreck sailing notices)" }, "url": "https://en.wikipedia.org/wiki/Acts_27", - "kind": "secondary-scholarly" + "kind": "tertiary-popular" }, { "id": "cit-route-itinere", diff --git a/src/components/CreditsView.tsx b/src/components/CreditsView.tsx index 211e10d..41a5f41 100644 --- a/src/components/CreditsView.tsx +++ b/src/components/CreditsView.tsx @@ -4,8 +4,10 @@ import { useBundle } from '../content/useBundle'; import { SourcingDisclosure } from './SourcingDisclosure'; function isWikiCredit(a: { name: string; url?: string }): boolean { - const blob = `${a.url ?? ''} ${a.name}`.toLowerCase(); - return blob.includes('wikipedia') || blob.includes('wikimedia'); + // Name only — KJV/ASV credit links point at Wikipedia articles but are not + // Wikipedia attributions; keep scripture/software credits above Wikimedia. + const name = a.name.toLowerCase(); + return name.includes('wikipedia') || name.includes('wikimedia'); } /** Scholarly / primary data credits above Wikipedia/Wikimedia in the list. */ diff --git a/src/content/citations.test.tsx b/src/content/citations.test.tsx index 2ac50eb..c166573 100644 --- a/src/content/citations.test.tsx +++ b/src/content/citations.test.tsx @@ -71,4 +71,27 @@ describe('sortCitationsForDisplay', () => { }); expect(sortCitationsForDisplay([wiki, britannica]).map((c) => c.id)).toEqual(['b', 'w']); }); + it('puts Wikipedia last even when mis-tagged as secondary-scholarly', () => { + const wiki = cite({ + id: 'w', + kind: 'secondary-scholarly', + source: { en: "Wikipedia, 'Via Egnatia'" }, + url: 'https://en.wikipedia.org/wiki/Via_Egnatia', + }); + const gazetteer = cite({ + id: 'g', + kind: 'gazetteer', + source: { en: 'Pleiades' }, + }); + const scholar = cite({ + id: 's', + kind: 'secondary-scholarly', + source: { en: 'Anchor Bible Dictionary' }, + }); + expect(sortCitationsForDisplay([wiki, gazetteer, scholar]).map((c) => c.id)).toEqual([ + 's', + 'g', + 'w', + ]); + }); }); diff --git a/src/content/citations.tsx b/src/content/citations.tsx index c5182ab..46d5efb 100644 --- a/src/content/citations.tsx +++ b/src/content/citations.tsx @@ -113,9 +113,9 @@ export function RouteGeometryNote({ } -/** Display order for reference lists: scripture and scholarly work above - * tertiary/popular (Wikipedia, Britannica, study-Bible maps). Authored id - * order often put Wikipedia first; QC requires scholarly sources above it. */ +/** Display order for reference lists: scripture / scholarly / gazetteer first; + * Wikipedia & Wikimedia always last (any kind). Authored id order often put + * Wikipedia first; every Citations surface uses this sort. */ const CITATION_KIND_RANK: Record = { 'primary-scripture': 0, 'primary-ancient': 1, @@ -130,15 +130,15 @@ function isWikipediaish(c: Pick): boolean { return blob.includes('wikipedia') || blob.includes('wikimedia'); } -/** Stable sort: kind rank, then Wikipedia-ish last within a kind, then source title. */ +/** Stable sort: Wikipedia/Wikimedia last globally, then kind rank, then title. */ export function sortCitationsForDisplay(citations: TCitation[]): TCitation[] { return [...citations].sort((a, b) => { - const ra = CITATION_KIND_RANK[a.kind] ?? 99; - const rb = CITATION_KIND_RANK[b.kind] ?? 99; - if (ra !== rb) return ra - rb; const wa = isWikipediaish(a) ? 1 : 0; const wb = isWikipediaish(b) ? 1 : 0; if (wa !== wb) return wa - wb; + const ra = CITATION_KIND_RANK[a.kind] ?? 99; + const rb = CITATION_KIND_RANK[b.kind] ?? 99; + if (ra !== rb) return ra - rb; return a.source.en.localeCompare(b.source.en); }); }