All files / apps/developer-portal/layers/decisions/app/components DecisionsFacts.vue

100% Statements 7/7
100% Branches 2/2
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  8x                           8x   8x   8x   24x              
<template>
    <PageFacts :provenance="$t('decisionsFacts.provenance')" :facts />
</template>
 
<script setup lang="ts">
import { countByStatus, type DecisionReport } from "#layers/decisions/shared/decisionReports.ts";
import { DECISION_STATUSES } from "#layers/snapshot/shared/decisions.ts";
import type { PageFact } from "~/types/PageFact";
 
interface Props {
    reports: DecisionReport[];
}
 
const { reports } = defineProps<Props>();
 
const { t } = useI18n();
 
const counts = computed(() => countByStatus(reports));
 
const facts = computed((): PageFact[] => [
    { label: t("decisionsFacts.reports"), value: String(reports.length) },
    ...DECISION_STATUSES.map((status) => ({
        label: t(`decisions.status.${status}`),
        value: String(counts.value[status]),
        class: counts.value[status] ? toneClass(decisionStatusTone(status)) : "",
    })),
]);
</script>