All files / apps/developer-portal/layers/workflows/app/components WorkflowEstimateReceipt.vue

100% Statements 12/12
85.71% Branches 6/7
100% Functions 4/4
100% Lines 11/11

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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58  19x 2x 2x 43x                 2x           2x     2x                                 14x   14x 43x               1x              
<template>
    <section :aria-label="$t('workflowEstimateReceipt.label')" class="flex flex-col gap-2">
        <p class="text-xs font-medium text-muted">{{ $t("workflowEstimateReceipt.title") }}</p>
        <ul class="flex flex-col gap-1.5 text-sm">
            <li
                v-for="(row, index) in rows"
                :key="row.id"
                class="flex items-baseline justify-between gap-3"
            >
                <span class="min-w-0 truncate" :class="row.nested ? 'pl-4 text-muted' : ''">
                    <span v-if="index > 0" class="text-dimmed">+ </span>{{ row.name
                    }}<span v-if="row.detail" class="text-xs text-muted"> ยท {{ row.detail }}</span>
                </span>
                <span class="shrink-0 text-muted tabular-nums">
                    {{ $t("workflowEstimateReceipt.points", { points: row.points }) }}
                </span>
            </li>
        </ul>
        <p
            class="flex justify-between border-t border-dashed border-default pt-2 text-sm font-semibold"
        >
            <span>{{ $t("workflowEstimateReceipt.total") }}</span>
            <span class="tabular-nums">
                {{ $t("workflowEstimateReceipt.points", { points: total }) }}
            </span>
        </p>
    </section>
</template>
 
<script setup lang="ts">
import type { ReceiptRow } from "#layers/workflows/shared/workflows.ts";
 
interface Props {
    rows: ReceiptRow[];
    total: number;
}
 
const { rows: receipt, total } = defineProps<Props>();
 
const { t } = useI18n();
 
const rows = computed(() =>
    receipt.map((row) => ({
        ...row,
        name:
            row.id === "core"
                ? t("workflowEstimateReceipt.core")
                : row.label || t("workflowEstimateReceipt.unnamed"),
        detail: [
            row.type,
            ...row.setup.map((block) => t("workflowEstimateReceipt.with", { block })),
        ]
            .filter(Boolean)
            .join(", "),
    })),
);
</script>