+ item && typeof item === 'object' && 'id' in item && 'text' in item;
+
const getNavItem = (conversation: Conversation) => (
- })}
+ /* eslint-disable indent */
+ {...(conversation.menuItems
+ ? {
+ actions: (
+
+ )
+ }
+ : {})}
+ {...conversation.additionalProps}
>
- <>
- })}
- onClick={(event) => onSelectActiveItem?.(event, conversation.id)}
- >
- {conversation.text}
-
- {conversation.menuItems && (
-
- )}
- >
-
+ {conversation.text}
+
);
const buildConversations = () => {
if (Array.isArray(conversations)) {
return (
-
- {conversations.map((conversation) => (
- {getNavItem(conversation)}
- ))}
-
+
+ {conversations.map((conversation) => {
+ if (isConversation(conversation)) {
+ return {getNavItem(conversation)};
+ } else {
+ return conversation;
+ }
+ })}
+
);
} else {
return (
-
+ <>
{Object.keys(conversations).map((navGroup) => (
-
-
- {navGroup}
-
-
- {conversations[navGroup].map((conversation) => (
+
+
+ {conversations[navGroup].map((conversation: Conversation) => (
{getNavItem(conversation)}
))}
-
-
+
+
))}
-
+ >
);
}
};
@@ -264,7 +274,11 @@ export const ChatbotConversationHistoryNav: FunctionComponent;
}
- return <>{buildConversations()}>;
+ return (
+
+ );
};
const renderDrawerContent = () => (