All files / apps/developer-portal/layers/projects/app/components ProjectsFeatured.vue

100% Statements 24/24
100% Branches 4/4
100% Functions 7/7
100% Lines 23/23

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 62 63 64 65 66 67 68 69 70 71  32x 32x   32x 32x                       32x 7x           32x 32x 32x 32x       32x     7x   32x 32x               7x             32x   6x 6x   6x   6x 6x 11x   7x              
<template>
    <section class="flex flex-col gap-3">
        <div class="flex items-center justify-between gap-3">
            <div>
                <h2 class="text-xl font-semibold">{{ $t("projectsFeatured.title") }}</h2>
                <p class="mt-1 text-sm text-muted">{{ $t("projectsFeatured.lead") }}</p>
            </div>
            <UButton
                to="/projects"
                :label="$t('projectsFeatured.all')"
                size="xs"
                variant="ghost"
                color="neutral"
                trailing-icon="i-lucide-arrow-right"
            />
        </div>
 
        <div class="grid gap-4 @4xl:grid-cols-2">
            <UCard
                v-for="project in featured"
                :key="project.root"
                :ui="{ root: 'h-full flex flex-col', header: 'flex-1', body: 'mt-auto' }"
            >
                <template #header>
                    <div class="flex items-start justify-between gap-3">
                        <div class="min-w-0">
                            <h3 class="font-semibold">{{ project.title }}</h3>
                            <p class="mt-1 line-clamp-3 text-sm text-muted">
                                {{ project.description }}
                            </p>
                        </div>
                        <span class="shrink-0 font-mono text-xs text-muted">
                            {{ $t("projectsFeatured.kind") }}
                        </span>
                    </div>
                </template>
                <div class="flex items-center justify-between gap-3">
                    <span class="truncate font-mono text-xs text-dimmed">{{ project.root }}</span>
                    <UButton
                        :to="`/wiki/${project.root}/readme`"
                        :label="$t('projectsFeatured.readMore')"
                        icon="i-lucide-book-open"
                        size="xs"
                        variant="soft"
                    />
                </div>
            </UCard>
        </div>
    </section>
</template>
 
<script setup lang="ts">
const FEATURED = 2;
 
const { t } = useI18n();
const { projects, readmeFor, ready } = useCatalog();
 
await ready;
 
const featured = computed(() =>
    projects
        .filter((project) => project.root.startsWith("apps/"))
        .slice(0, FEATURED)
        .map((project) => ({
            root: project.root,
            title: readmeFor(project)?.title ?? project.name,
            description: readmeFor(project)?.description ?? t("projectsFeatured.noDescription"),
        })),
);
</script>