feat(workbench): integrate runtime data and map tooling
This commit is contained in:
@@ -2,7 +2,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { AnimatePresence, motion, type Variants } from "motion/react";
|
||||
import { cn } from "@/shared/ui/cn";
|
||||
import type {
|
||||
ScheduledConditionRecord
|
||||
ScheduledConditionRecord,
|
||||
WorkbenchRuntimeDataSource
|
||||
} from "../types";
|
||||
import {
|
||||
createVisibleTickerCards,
|
||||
@@ -11,6 +12,7 @@ import {
|
||||
|
||||
type AgentTaskTickerProps = {
|
||||
conditions: ScheduledConditionRecord[];
|
||||
dataSource?: WorkbenchRuntimeDataSource;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
@@ -86,6 +88,7 @@ const tickerIndicatorVariants: Variants = {
|
||||
|
||||
export function AgentTaskTicker({
|
||||
conditions,
|
||||
dataSource = "mock",
|
||||
className
|
||||
}: AgentTaskTickerProps) {
|
||||
const sectionRef = useRef<HTMLElement | null>(null);
|
||||
@@ -105,8 +108,8 @@ export function AgentTaskTicker({
|
||||
const [visibilityRevision, setVisibilityRevision] = useState(0);
|
||||
const runningConditions = conditions;
|
||||
const visibleTickerCards = useMemo(
|
||||
() => createVisibleTickerCards(runningConditions, rotationIndex, nowMs),
|
||||
[runningConditions, rotationIndex, nowMs]
|
||||
() => createVisibleTickerCards(runningConditions, rotationIndex, nowMs, dataSource),
|
||||
[dataSource, runningConditions, rotationIndex, nowMs]
|
||||
);
|
||||
const hasMultipleRunningTasks = runningConditions.length > 1;
|
||||
const activeIndicatorIndex = runningConditions.length > 0 ? rotationIndex % runningConditions.length : 0;
|
||||
@@ -391,7 +394,9 @@ function TickerTaskCardContent({ view }: { view: TickerStackCard["view"] }) {
|
||||
<span className="block truncate text-[13px] font-semibold leading-5 text-slate-500">
|
||||
{view.title}
|
||||
</span>
|
||||
<TickerProgressBar progressLabel={view.progressLabel} muted />
|
||||
{view.progressValue !== undefined ? (
|
||||
<TickerProgressBar progressValue={view.progressValue} muted />
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -417,17 +422,19 @@ function TickerTaskCardContent({ view }: { view: TickerStackCard["view"] }) {
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<TickerProgressBar progressLabel={view.progressLabel} />
|
||||
{view.progressValue !== undefined ? (
|
||||
<TickerProgressBar progressValue={view.progressValue} />
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function TickerProgressBar({
|
||||
progressLabel,
|
||||
progressValue,
|
||||
muted = false
|
||||
}: {
|
||||
progressLabel: string;
|
||||
progressValue: number;
|
||||
muted?: boolean;
|
||||
}) {
|
||||
return (
|
||||
@@ -443,7 +450,7 @@ function TickerProgressBar({
|
||||
"status-tone-info block h-full rounded-full",
|
||||
muted ? "bg-[var(--status-border)]" : "bg-[var(--status-mark)]"
|
||||
)}
|
||||
animate={{ width: progressLabel }}
|
||||
animate={{ width: `${Math.min(100, Math.max(0, progressValue))}%` }}
|
||||
initial={false}
|
||||
transition={{ duration: 0.34, ease: tickerEase }}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user