62 lines
1.7 KiB
Vue
62 lines
1.7 KiB
Vue
<script setup lang="ts">
|
|
import PageHeader from "@/base/PageHeader.vue";
|
|
import { ArrowLeft } from "@lucide/vue";
|
|
import { computed } from "vue";
|
|
import { RouterLink } from "vue-router";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import { Card, CardContent } from "@/components/ui/card";
|
|
import {
|
|
Empty,
|
|
EmptyDescription,
|
|
EmptyHeader,
|
|
EmptyTitle,
|
|
} from "@/components/ui/empty";
|
|
|
|
/**
|
|
* A run page that cannot be opened, said plainly. There are two ways in: the
|
|
* id in the path is not a task id at all, or archied answers that no such task
|
|
* exists. Both are one page head and one card, so they are one component and
|
|
* only the words differ.
|
|
*/
|
|
const props = defineProps<{
|
|
kind: "invalid" | "missing";
|
|
/** The id as it arrived in the path. */
|
|
raw?: string;
|
|
}>();
|
|
|
|
const copy = computed(() =>
|
|
props.kind === "invalid"
|
|
? {
|
|
title: "Not a task id",
|
|
empty: `“${props.raw ?? ""}” is not a task id`,
|
|
detail: "Task ids are positive whole numbers.",
|
|
}
|
|
: {
|
|
title: "Task not found",
|
|
empty: `Nothing is recorded for task ${props.raw ?? ""}`,
|
|
detail: "",
|
|
},
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<PageHeader :title="copy.title">
|
|
<Button variant="outline" as-child>
|
|
<RouterLink to="/tasks"><ArrowLeft data-icon="inline-start" />Back to tasks</RouterLink>
|
|
</Button>
|
|
</PageHeader>
|
|
<Card>
|
|
<CardContent>
|
|
<Empty>
|
|
<EmptyHeader>
|
|
<EmptyTitle>{{ copy.empty }}</EmptyTitle>
|
|
<EmptyDescription v-if="copy.detail">{{ copy.detail }}</EmptyDescription>
|
|
</EmptyHeader>
|
|
</Empty>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</template>
|