import { memo, type ReactNode } from "react";
import type { UiLanguage } from "../../../contexts/settings/domain/agentSettings";
import type { AgentGUINodeViewModel } from "../model/agentGuiNodeTypes";
import type {
AgentGUIConversationActivityPriorityReason,
AgentGUIConversationActivityProjection
} from "../model/agentGuiConversationActivityView";
import styles from "../AgentGUINode.styles";
import type { AgentGUIConversationRailLabels } from "./agentGUIConversationRailLabels";
import { AgentGUIConversationRailItem } from "./AgentGUIConversationRailItem";
interface AgentGUIConversationActivityViewProps {
activeConversationId: string | null;
conversationsById: ReadonlyMap<
string,
AgentGUINodeViewModel["rail"]["conversations"][number]
>;
isDeletingConversation: boolean;
isRailInteractionLocked: () => boolean;
labels: AgentGUIConversationRailLabels;
pendingDeleteConversationId: string | null;
projection: AgentGUIConversationActivityProjection;
uiLanguage: UiLanguage;
workspaceId: string;
registerItemElement: (itemId: string, element: HTMLDivElement | null) => void;
onCancelDeleteConversation: () => void;
onConfirmDeleteConversation: () => void;
onMarkConversationUnread: (agentSessionId: string) => void;
onOpenConversationWindow?: (agentSessionId: string) => void;
onRequestDeleteConversation: (agentSessionId: string) => void;
onRequestRenameConversation: (
conversation: AgentGUINodeViewModel["rail"]["conversations"][number]
) => void;
onSelectConversation: (agentSessionId: string) => void;
onToggleConversationPinned: (agentSessionId: string, pinned: boolean) => void;
}
export const AgentGUIConversationActivityView = memo(
function AgentGUIConversationActivityView({
activeConversationId,
conversationsById,
isDeletingConversation,
isRailInteractionLocked,
labels,
pendingDeleteConversationId,
projection,
uiLanguage,
workspaceId,
registerItemElement,
onCancelDeleteConversation,
onConfirmDeleteConversation,
onMarkConversationUnread,
onOpenConversationWindow,
onRequestDeleteConversation,
onRequestRenameConversation,
onSelectConversation,
onToggleConversationPinned
}: AgentGUIConversationActivityViewProps): React.JSX.Element {
"use memo";
const itemProps = {
activeConversationId,
isDeletingConversation,
isRailInteractionLocked,
labels,
pendingDeleteConversationId,
registerItemElement,
uiLanguage,
workspaceId,
onCancelDeleteConversation,
onConfirmDeleteConversation,
onMarkConversationUnread,
onOpenConversationWindow,
onRequestDeleteConversation,
onRequestRenameConversation,
onSelectConversation,
onToggleConversationPinned
};
const children: ReactNode[] = [