import React from "react"; import { api } from "@/src/utils/api"; import { JobConfigState, type AutomationDomain } from "@langfuse/shared"; import { cn } from "@/src/utils/tailwind"; import { StatusBadge } from "@/src/components/layouts/status-badge"; interface AutomationSidebarProps { projectId: string; selectedAutomation?: { automationId: string }; onAutomationSelect: (automation: AutomationDomain) => void; } export const AutomationSidebar: React.FC = ({ projectId, selectedAutomation, onAutomationSelect, }) => { const { data: automations, isLoading } = api.automations.getAutomations.useQuery({ projectId, }); const sidebarWidth = "w-40 sm:w-64"; if (isLoading) { return (
Loading automations...
); } if (!automations || automations.length === 0) { return (
No automations configured. Create your first automation to streamline workflows.
); } return (
{automations.map((automation) => { const isSelected = selectedAutomation?.automationId === automation.id; return (
onAutomationSelect(automation)} >
{/* Top row: Name and Active badge */}

{automation.name}

{automation.trigger.status === JobConfigState.ACTIVE ? ( ) : ( )}
{/* Bottom row: eventSource -> automation type */}

{automation.trigger.eventSource} {" → "} {automation.action.type === "WEBHOOK" ? "Webhook" : automation.action.type === "SLACK" ? "Slack" : "Annotation Queue"}

); })}
); };