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

100% Statements 21/21
100% Branches 4/4
100% Functions 8/8
100% Lines 19/19

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 59 60 61  3x   3x 3x 3x 3x           3x 5x 3x 3x 3x 7x                     3x                         3x   3x 3x 3x               3x 5x   13x        
<template>
    <UCard>
        <template #header>
            <p class="font-semibold">{{ template.title }}</p>
            <p class="text-xs text-muted">{{ template.summary }}</p>
            <p class="mt-1 text-xs text-dimmed tabular-nums">{{ estimate }}</p>
            <p class="mt-1 flex items-center gap-1 text-xs text-dimmed">
                <UIcon name="i-lucide-toggle-left" class="size-3.5" />
                {{ $t("workflowTemplateCard.optional") }}
            </p>
        </template>
 
        <ol class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
            <li v-for="(stage, index) in stages" :key="stage.id">
                <p class="text-sm font-medium">{{ index + 1 }}. {{ stage.title }}</p>
                <p class="text-xs text-muted">{{ stage.goal }}</p>
                <ul class="mt-1 flex flex-wrap gap-1">
                    <li v-for="capability in stage.capabilities" :key="capability.id">
                        <UBadge
                            :label="capability.title"
                            :icon="capability.optional ? 'i-lucide-toggle-left' : undefined"
                            :variant="capability.optional ? 'outline' : 'subtle'"
                            color="neutral"
                            size="sm"
                        />
                    </li>
                </ul>
            </li>
        </ol>
    </UCard>
</template>
 
<script setup lang="ts">
import { templateEstimate, type Template } from "#layers/workflows/shared/workflows.ts";
 
interface Props {
    template: Template;
}
 
const { template } = defineProps<Props>();
 
const { t } = useI18n();
 
const estimate = computed(() => {
    const { blocks, tickets, points } = templateEstimate(template);
    return t("workflowTemplateCard.estimate", {
        blocks,
        points,
        block: tickets.block,
        fast: tickets.fast,
    });
});
 
const stages = computed(() =>
    template.stages.map((stage) => ({
        ...stage,
        capabilities: template.capabilities.filter((capability) => capability.stage === stage.id),
    })),
);
</script>