All files / apps/portfolio/app/pages/work [app].vue

100% Statements 30/30
88.23% Branches 15/17
100% Functions 15/15
100% Lines 24/24

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 72 73 74 75 76 77 78 79 80 81 82  5x               3x                         3x             1x   3x 1x 1x           1x     3x           1x   2x   2x               5x 5x   15x   5x 5x 3x         5x   5x 5x 5x 5x 5x      
<template>
    <template v-if="work && entry">
        <PageHero
            :carry="`work-title-${work.slug}`"
            :kicker="$t('workApp.kicker', { kind: work.kind })"
            :title="work.title"
            :mark="work.mark"
            :lead="work.line"
        >
            <p class="font-mono text-sm text-muted">{{ facts }}</p>
            <aside
                v-if="work.inProgress"
                class="flex max-w-2xl items-center gap-2 border-l-2 border-primary bg-muted px-4 py-3 font-mono text-xs text-primary uppercase"
            >
                <span class="size-2 animate-pulse rounded-full bg-primary" aria-hidden="true" />
                {{ $t("workApp.inProgress", { stage: work.stage }) }}
            </aside>
        </PageHero>
 
        <WorkFigure :work />
 
        <UContainer as="section" class="grid gap-10 pb-16 md:grid-cols-12">
            <p class="font-display text-heading text-highlighted md:col-span-7">{{ work.why }}</p>
            <ContentRenderer
                :value="entry"
                class="flex flex-col gap-4 text-base text-muted md:col-span-4 md:col-start-9"
            />
        </UContainer>
 
        <section class="bg-muted">
            <UContainer as="dl" class="grid gap-8 py-14 md:grid-cols-3">
                <div v-for="row in work.design" :key="row.label" class="flex flex-col gap-2">
                    <dt class="font-mono text-xs text-muted uppercase">{{ row.label }}</dt>
                    <dd class="font-display text-2xl text-highlighted">{{ row.value }}</dd>
                </div>
            </UContainer>
        </section>
 
        <UContainer as="section" class="pt-16">
            <h2 class="pb-8 font-display text-section text-highlighted">
                {{ $t("workApp.decisions.title") }}
                <mark>{{ $t("workApp.decisions.titleMark") }}</mark>
            </h2>
            <DecisionQuestions :items="work.decisions" split />
        </UContainer>
    </template>
 
    <UContainer v-else as="section" class="flex flex-col gap-6 pt-10 pb-16">
        <h1 class="font-display text-section text-highlighted">
            {{ $t("workApp.missing.title") }}
        </h1>
        <ULink to="/" class="text-primary underline underline-offset-4">
            {{ $t("workApp.missing.back") }}
        </ULink>
    </UContainer>
</template>
 
<script setup lang="ts">
import { toWorkCase } from "~/utils/work";
 
const { t } = useI18n();
const route = useRoute();
 
const { data: entry } = await useWorkEntry(() => String(route.params.app ?? ""));
 
const work = computed(() => toWorkCase(entry.value));
const facts = computed(() =>
    work.value
        ? t("workApp.facts", { facts: work.value.facts.join(" ยท "), date: work.value.countedOn })
        : "",
);
 
if (!work.value) setResponseStatus(404);
 
useSeoMeta({
    title: () => work.value?.name ?? t("workApp.missing.title"),
    description: () => work.value?.line,
    ogImage: () => work.value && workShareImage(work.value),
    ogImageAlt: () => work.value?.screenshot.alt,
});
</script>