40 lines
1.3 KiB
Vue
40 lines
1.3 KiB
Vue
<script setup lang="ts">
|
|
import { TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
|
|
import { computed } from "vue";
|
|
|
|
import { RUN_TABS } from "./task-run";
|
|
import { useTaskRun } from "./use-task-run";
|
|
|
|
/**
|
|
* The run page's tab bar. It owns no state and renders no panel: the open tab
|
|
* is the page's, carried in the query string, and this renders the list that
|
|
* switches it. It must sit inside a `Tabs`, which supplies the roving focus
|
|
* and the selection model -- a `TabsTrigger` outside a `TabsList` is not a tab.
|
|
*
|
|
* Keyboard behaviour is the WAI-ARIA tabs pattern with automatic activation,
|
|
* which `Tabs` provides: the list is one stop in the page's tab order,
|
|
* Left/Right move between tabs and select as they go, Home/End jump to the
|
|
* ends. Automatic activation is right here because every panel is a local
|
|
* render, not a fetch: there is no cost to switching.
|
|
*/
|
|
const run = useTaskRun();
|
|
// The sandbox follows a live container; a finished attempt has none to show.
|
|
const tabs = computed(() =>
|
|
RUN_TABS.filter((tab) => tab.id !== "sandbox" || run.task?.status === "running"),
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<TabsList variant="line" class="w-full justify-start">
|
|
<TabsTrigger
|
|
v-for="tab in tabs"
|
|
:key="tab.id"
|
|
:value="tab.id"
|
|
class="flex-none px-2"
|
|
>{{
|
|
tab.label
|
|
}}</TabsTrigger>
|
|
</TabsList>
|
|
</template>
|