44 lines
1.5 KiB
Vue
44 lines
1.5 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from "vue";
|
|
|
|
import { StatusDot } from "@/components/ui/status-dot";
|
|
import { Timestamp } from "@/components/ui/timestamp";
|
|
|
|
import { describeTimelineEvent } from "./timeline-event";
|
|
import type { TaskEvent } from "./task-run";
|
|
|
|
/**
|
|
* One entry in a task's event timeline: what happened, any detail the event
|
|
* carries, and when.
|
|
*
|
|
* It renders an `<li>`, so its host supplies the list. The words come from
|
|
* describeTimelineEvent, which the stage rail's agent reports read too, so a
|
|
* timeline and a rail can never describe the same event differently.
|
|
*/
|
|
const props = defineProps<{ event: TaskEvent }>();
|
|
|
|
const line = computed(() => describeTimelineEvent(props.event));
|
|
</script>
|
|
|
|
<template>
|
|
<li class="flex items-start gap-3">
|
|
<StatusDot :tone="line.tone === 'warn' ? 'warn' : 'info'" class="mt-2" />
|
|
<div>
|
|
<div class="text-sm font-medium">{{ line.title }}</div>
|
|
<div v-if="line.detail" class="mt-0.5 text-xs text-fg-muted">
|
|
{{ line.detail }}
|
|
</div>
|
|
<div v-if="line.links?.length" class="mt-0.5 flex gap-3 text-xs">
|
|
<RouterLink
|
|
v-for="link in line.links"
|
|
:key="link.to"
|
|
:to="link.to"
|
|
class="text-fg-muted underline-offset-2 hover:text-foreground hover:underline"
|
|
>{{ link.label }}</RouterLink
|
|
>
|
|
</div>
|
|
<div class="mt-0.5 text-xs text-fg-subtle"><Timestamp :at="event.at" /></div>
|
|
</div>
|
|
</li>
|
|
</template>
|