import { ChevronRight, Settings2, Sparkles } from 'lucide-react'; import React from 'react'; import { useTranslation } from '../../../i18n'; import { StatusPill } from '../../Settings/settingsKit'; import { fs } from '../../shared/DialogShell'; import AddonSubRow from '../AddonSubRow'; import AddonTile from '../AddonTile'; import { type Addon, getAddonLabel } from './addonModel'; import { AI_ADDON_ICONS, type AiAddonId } from './aiAddons'; import AiSettingsDialog from './AiAdminConfig'; import { useAiAddonTile } from './useAiAddonTile'; /** * The AI addons as one tile at the head of the integration column: the * assistant, AI parsing and MCP as switches in its shelf, and one button to * the dialog that holds their settings, so a page with all three on stays as * short as one with none. */ export default function AiAddonTile({ addons, onToggle, }: { addons: Addon[]; onToggle: (addon: Addon) => void; }): React.ReactElement { const { t } = useTranslation(); const tile = useAiAddonTile(addons); const anyOn = tile.enabledCount > 0; return ( <> } name={t('admin.addons.ai.name')} description={t('admin.addons.ai.description')} enabled={anyOn} trailing={ {tile.enabledCount}/{addons.length} } > {addons.map((addon) => { const Icon = AI_ADDON_ICONS[addon.id as AiAddonId]; const label = getAddonLabel(t, addon); return ( } title={label.name} description={label.description} badge={addon.id === 'ai_assistant' ? : undefined} enabled={addon.enabled} onToggle={() => onToggle(addon)} /> ); })} {tile.canSetUp && (
  • )}
    {tile.dialogOpen && } ); } /** The assistant is still young; its switch says so with a small accent pill. */ function BetaBadge({ label }: { label: string }): React.ReactElement { return ( {label} ); }