import { Badge, Button, EmptyState } from '@rozenite/ui';
import { Play, Square } from 'lucide-react';
import { formatPayloadForCommandInput } from '../utils.js';
import type { DevHostFlowEntry, DevHostFlowRunState } from '../types.js';
type FlowListProps = {
flows: DevHostFlowEntry[];
flowRuns: DevHostFlowRunState[];
hasRunningFlow: (flowName: string) => boolean;
onRunFlow: (flow: DevHostFlowEntry) => void;
onStopFlow: (runId: string) => void;
};
const getStatusLabel = (status: DevHostFlowRunState['status']) => {
switch (status) {
case 'running':
return 'Running';
case 'succeeded':
return 'Completed';
case 'failed':
return 'Failed';
case 'aborted':
return 'Stopped';
}
};
export const FlowList = ({
flows,
flowRuns,
hasRunningFlow,
onRunFlow,
onStopFlow,
}: FlowListProps) => {
if (flows.length === 0) {
return (
{formatPayloadForCommandInput(flowRun.result)}
) : null}