diff --git a/app/components/card/CaseStudy.vue b/app/components/card/CaseStudy.vue index 0e9272d..ba1ceb2 100644 --- a/app/components/card/CaseStudy.vue +++ b/app/components/card/CaseStudy.vue @@ -37,29 +37,6 @@ interface CaseStudy { const props = defineProps<{ study: CaseStudy }>() -const outcomeVariant: Record = { - success: 'success', - partial: 'default', - failed: 'error', - inconclusive: 'default', - ongoing: 'warning', -} -const outcomeLabel: Record = { - success: 'Success', - partial: 'Partial', - failed: 'Failed', - inconclusive: 'Inconclusive', - ongoing: 'Ongoing', -} - -const scaleLabel: Record = { - neighborhood: 'Neighborhood', - city: 'City', - region: 'Region', - national: 'National', - global: 'Global', -} - function yearOf(s?: string | null): string | null { if (!s) return null const m = /^(\d{4})/.exec(s) @@ -130,8 +107,8 @@ const sourceCount = computed(() => props.study.sources?.length ?? 0) title="Verified" /> - - {{ outcomeLabel[study.outcome] }} + + {{ outcomeBadgeLabel(study.outcome) }} @@ -157,7 +134,7 @@ const sourceCount = computed(() => props.study.sources?.length ?? 0) - {{ scaleLabel[study.scale] ?? study.scale }} + {{ scaleBadgeLabel(study.scale) }} +import { safeUrl } from '~/utils/safeUrl' +// A labeled card listing external links ({ url, title }) — the Sources and +// Links sections of a case study render identically apart from icon + label, so +// they share this. Renders nothing when there are no items. +defineProps<{ + icon: string + label: string + items: { url: string; title?: string | null }[] +}>() + + + diff --git a/app/components/issue/TreeNode.vue b/app/components/issue/TreeNode.vue index 8c7ba96..3fe4adf 100644 --- a/app/components/issue/TreeNode.vue +++ b/app/components/issue/TreeNode.vue @@ -44,21 +44,6 @@ const nodeIconClass = computed(() => { if (isSolution.value) return 'text-primary-600' return 'text-gray-400' }) - -const outcomeVariant: Record = { - success: 'success', - partial: 'default', - failed: 'error', - inconclusive: 'default', - ongoing: 'warning', -} -const outcomeLabel: Record = { - success: 'Success', - partial: 'Partial', - failed: 'Failed', - inconclusive: 'Inconclusive', - ongoing: 'Ongoing', -}