import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { Collapse, Input, InputNumber, Select, Switch } from 'antd'; import { LanguageManager } from '@/utils'; import type { AllSetting } from '@/models/setting'; import SettingListItem from '@/components/SettingListItem'; interface TelegramTabProps { allSetting: AllSetting; updateSetting: (patch: Partial) => void; } export default function TelegramTab({ allSetting, updateSetting }: TelegramTabProps) { const { t } = useTranslation(); const langOptions = useMemo( () => LanguageManager.supportedLanguages.map((l: { value: string; name: string; icon: string }) => ({ value: l.value, label: ( <> {l.icon}   {l.name} ), })), [], ); return ( updateSetting({ tgBotEnable: v })} /> updateSetting({ tgBotToken: e.target.value })} /> updateSetting({ tgBotChatId: e.target.value })} /> updateSetting({ tgBotAPIServer: e.target.value })} /> ), }, { key: '2', label: t('pages.settings.notifications'), children: ( <> updateSetting({ tgRunTime: e.target.value })} /> updateSetting({ tgBotBackup: v })} /> updateSetting({ tgBotLoginNotify: v })} /> updateSetting({ tgCpu: Number(v) || 0 })} /> ), }, ]} /> ); }