import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' import FirstEmptyActionCard from '@/app/components/apps/first-empty-state/action-card' import { STEP_BY_STEP_TOUR_TARGETS } from '@/app/components/step-by-step-tour/target-registry' const EMPTY_PLACEHOLDER_CARD_IDS = Array.from( { length: 16 }, (_, index) => `dataset-placeholder-card-${index}`, ) type EmptyCreateAction = { badge?: string href: string icon: ReactNode id: string title: string description: string target: string } type DatasetFirstEmptyStateProps = { canConnectExternalDataset: boolean canCreateDataset: boolean } function DatasetFirstEmptyState({ canConnectExternalDataset, canCreateDataset, }: DatasetFirstEmptyStateProps) { const { t } = useTranslation() const createActions: EmptyCreateAction[] = canCreateDataset ? [ { badge: t(($) => $['firstEmpty.recommended'], { ns: 'dataset' }), href: '/datasets/create', icon: , id: 'create', title: t(($) => $['firstEmpty.createTitle'], { ns: 'dataset' }), description: t(($) => $['firstEmpty.createDescription'], { ns: 'dataset' }), target: STEP_BY_STEP_TOUR_TARGETS.knowledgeEmptyCreate, }, { href: '/datasets/create-from-pipeline', icon: , id: 'pipeline', title: t(($) => $['firstEmpty.pipelineTitle'], { ns: 'dataset' }), description: t(($) => $['firstEmpty.pipelineDescription'], { ns: 'dataset' }), target: STEP_BY_STEP_TOUR_TARGETS.knowledgeEmptyPipeline, }, ] : [] const connectAction: EmptyCreateAction | undefined = canConnectExternalDataset ? { href: '/datasets/connect', icon: ( ), id: 'connect', title: t(($) => $.connectDataset, { ns: 'dataset' }), description: t(($) => $['firstEmpty.connectDescription'], { ns: 'dataset' }), target: STEP_BY_STEP_TOUR_TARGETS.knowledgeEmptyConnect, } : undefined const hasActions = createActions.length > 0 || !!connectAction return (