AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { isObject } from '@activepieces/core-utils';
import { t } from 'i18next';
import { ChevronDown, ChevronRight } from 'lucide-react';
import { useState } from 'react';
import { VirtualizedList } from '@/components/ui/virtualized-list';
import { truncateValue, ValueRow } from './shared-value-rendering';
function ArrayItemRow({ item, index }: { item: unknown; index: number }) {
const [expanded, setExpanded] = useState(false);
if (!isObject(item)) {
return (
<div className="flex items-center gap-3 py-2 px-4 hover:bg-gray-4/50 border-b border-gray-6">
<span className="text-sm font-medium text-gray-11 shrink-0">
{t('Item')} {index + 1}
</span>
<span className="text-sm text-gray-12/70 truncate flex-1">
{truncateValue(item)}
</span>
</div>
);
}
const entries = Object.entries(item);
const previewValues = entries
.slice(0, 3)
.map(([, v]) => truncateValue(v))
.filter(Boolean)
.join(' · ');
return (
<div className="border-b border-gray-6 last:border-b-0">
<button
type="button"
onClick={() => setExpanded(!expanded)}
className="flex items-center gap-3 py-2 px-4 hover:bg-gray-4/50 cursor-pointer w-full text-left"
>
<div className="shrink-0 w-4 h-4 flex items-center justify-center text-gray-11">
{expanded ? (
<ChevronDown className="h-3.5 w-3.5" />
) : (
<ChevronRight className="h-3.5 w-3.5" />
)}
</div>
<span className="text-sm font-medium text-gray-11 shrink-0">
{t('Item')} {index + 1}
</span>
{!expanded && (
<span
className="text-sm text-gray-11 truncate flex-1 min-w-0"
title={previewValues}
>
{previewValues}
</span>
)}
</button>
{expanded && (
<div className="pb-1">
{entries.map(([key, value]) => (
<ValueRow key={key} label={key} value={value} depth={0} />
))}
</div>
)}
</div>
);
}
type OutputArrayListProps = {
items: unknown[];
};
function OutputArrayList({ items }: OutputArrayListProps) {
if (items.length === 0) {
return <div className="p-4 text-sm text-gray-11 italic">{t('empty')}</div>;
}
return (
<VirtualizedList
items={items}
estimateSize={37}
renderItem={(item, idx) => <ArrayItemRow item={item} index={idx} />}
/>
);
}
export { OutputArrayList };