import React from 'react';
import {
ChevronDown,
Plus,
Search,
Globe,
Sparkles,
Microscope,
Telescope,
File,
Link,
Webhook,
} from 'lucide-react';
import { IconBrandNotion, IconBrandSlack, IconBrandYoutube } from "@tabler/icons-react";
import { Button } from '@/components/ui/button';
import { Connector, ResearchMode } from './types';
// Helper function to get connector icon
export const getConnectorIcon = (connectorType: string) => {
const iconProps = { className: "h-4 w-4" };
switch(connectorType) {
case 'YOUTUBE_VIDEO':
return ;
case 'CRAWLED_URL':
return ;
case 'FILE':
return ;
case 'EXTENSION':
return ;
case 'SERPER_API':
case 'TAVILY_API':
return ;
case 'SLACK_CONNECTOR':
return ;
case 'NOTION_CONNECTOR':
return ;
case 'DEEP':
return ;
case 'DEEPER':
return ;
case 'DEEPEST':
return ;
default:
return ;
}
};
export const researcherOptions: { value: ResearchMode; label: string; icon: React.ReactNode }[] = [
{
value: 'GENERAL',
label: 'General',
icon: getConnectorIcon('GENERAL')
},
{
value: 'DEEP',
label: 'Deep',
icon: getConnectorIcon('DEEP')
},
{
value: 'DEEPER',
label: 'Deeper',
icon: getConnectorIcon('DEEPER')
},
]
/**
* Displays a small icon for a connector type
*/
export const ConnectorIcon = ({ type, index = 0 }: { type: string; index?: number }) => (
{getConnectorIcon(type)}
);
/**
* Displays a count indicator for additional connectors
*/
export const ConnectorCountBadge = ({ count }: { count: number }) => (
+{count}
);
type ConnectorButtonProps = {
selectedConnectors: string[];
onClick: () => void;
connectorSources: Connector[];
};
/**
* Button that displays selected connectors and opens connector selection dialog
*/
export const ConnectorButton = ({ selectedConnectors, onClick, connectorSources }: ConnectorButtonProps) => {
const totalConnectors = connectorSources.length;
const selectedCount = selectedConnectors.length;
const progressPercentage = (selectedCount / totalConnectors) * 100;
// Get the name of a single selected connector
const getSingleConnectorName = () => {
const connector = connectorSources.find(c => c.type === selectedConnectors[0]);
return connector?.name || '';
};
// Get display text based on selection count
const getDisplayText = () => {
if (selectedCount === totalConnectors) return "All Connectors";
if (selectedCount === 1) return getSingleConnectorName();
return `${selectedCount} Connectors`;
};
// Render the empty state (no connectors selected)
const renderEmptyState = () => (
<>
Select Connectors
>
);
// Render the selected connectors preview
const renderSelectedConnectors = () => (
<>
{/* Show up to 3 connector icons */}
{selectedConnectors.slice(0, 3).map((type, index) => (
))}
{/* Show count indicator if more than 3 connectors are selected */}
{selectedCount > 3 && }