Files
beaver-gateway/ui/src/lib/panel/activity-feed.svelte
T

53 lines
1.3 KiB
Svelte

<script lang="ts">
import { onMount } from "svelte";
import type { ApiClient } from "$lib/api/client";
import EmptyState from "$lib/components/empty-state.svelte";
import type { ActivityModel } from "./activity.svelte";
import QuestionCard from "./question-card.svelte";
import TurnCard from "./turn-card.svelte";
let {
model,
client,
conversationId,
connected,
}: {
model: ActivityModel;
client: ApiClient;
conversationId: string;
connected: boolean;
} = $props();
let now = $state(Date.now());
const TICK_MS = 1000;
onMount(() => {
const timer = setInterval(() => {
if (model.running) {
now = Date.now();
}
}, TICK_MS);
return () => clearInterval(timer);
});
</script>
<div class="flex flex-col gap-3">
{#if model.question}
<QuestionCard {client} {conversationId} question={model.question} />
{/if}
{#if model.turns.length === 0}
<EmptyState
hint={connected
? "Live turns, tool calls and subagents land here the moment the agent moves; earlier turns are under History."
: "Connecting to the event stream…"}
title="Nothing live right now"
/>
{:else}
<div class="flex flex-col">
{#each model.turns as turn (turn.id)}
<TurnCard {now} {turn} />
{/each}
</div>
{/if}
</div>