import type { ReactNode } from 'react' import { cn } from '@langgenius/dify-ui/cn' import CornerLabel from '@/app/components/base/corner-label' import Link from '@/next/link' type VisualStyle = 'default' | 'compact' | 'list' type BaseProps = { badge?: string badgeVariant?: 'basic' | 'advanced' description: string icon: ReactNode title: string visualStyle?: VisualStyle } type ButtonActionCardProps = BaseProps & { href?: never onClick: () => void } type LinkActionCardProps = BaseProps & { href: string onClick?: never } type FirstEmptyActionCardProps = ButtonActionCardProps | LinkActionCardProps const baseCardClassName = 'relative flex rounded-xl bg-components-button-secondary-bg text-left shadow-xs transition-colors hover:bg-components-panel-on-panel-item-bg-hover focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden' const compactBadgeClassName = { basic: { corner: 'text-util-colors-orange-orange-50', label: 'bg-util-colors-orange-orange-50', text: 'text-util-colors-orange-orange-600', }, advanced: { corner: 'text-components-dropzone-bg-accent', label: 'bg-components-dropzone-bg-accent', text: 'text-components-premium-badge-blue-bg-stop-100', }, } function CompactBadge({ badge, badgeVariant, }: { badge: string badgeVariant: 'basic' | 'advanced' }) { return ( ) } function ActionCardContent({ badge, badgeVariant = 'basic', description, icon, title, visualStyle = 'default', }: BaseProps) { if (visualStyle === 'list') { return ( <> {badge && ( )} {icon} {title} {description} ) } const isCompact = visualStyle === 'compact' const badgeNode = badge ? isCompact ? : ( {badge} ) : null return ( <> {badgeNode} {icon} {title} {description} ) } function FirstEmptyActionCard(props: FirstEmptyActionCardProps) { const className = cn( baseCardClassName, props.visualStyle === 'list' ? 'w-full items-center gap-3 overflow-hidden px-3 py-2.5 backdrop-blur-md' : 'flex-col border border-components-panel-border bg-components-panel-on-panel-item-bg hover:shadow-sm', props.visualStyle === 'compact' ? 'min-h-[156px] overflow-hidden px-4 pt-6 pb-3' : props.visualStyle === 'list' ? undefined : 'min-h-[204px] p-6', ) if (props.href) { return ( ) } return ( ) } export default FirstEmptyActionCard