import { Input, InputNumber, Switch, Tabs } from 'antd'; import { IdcardOutlined, InfoCircleOutlined, SafetyCertificateOutlined, SettingOutlined, } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; import type { AllSetting } from '@/models/setting'; import { onNumber } from '@/utils/onNumber'; import { DefaultSettingTag, SettingListItem } from '@/components/ui'; import { RemarkTemplateField } from '@/components/form'; import { useMediaQuery } from '@/hooks/useMediaQuery'; import { catTabLabel } from './catTabLabel'; import { sanitizePath, normalizePath } from './uriPath'; interface SubscriptionGeneralTabProps { allSetting: AllSetting; updateSetting: (patch: Partial) => void; } export default function SubscriptionGeneralTab({ allSetting, updateSetting, }: SubscriptionGeneralTabProps) { const { t } = useTranslation(); const { isMobile } = useMediaQuery(); return ( , t('pages.settings.panelSettings'), isMobile), children: ( <> updateSetting({ subEnable: v })} /> updateSetting({ subListen: e.target.value })} /> updateSetting({ subDomain: e.target.value })} /> } description={t('pages.settings.subPortDesc')} > updateSetting({ subPort: v }), { onClear: 0 })} /> updateSetting({ subPath: sanitizePath(e.target.value) })} onBlur={() => updateSetting({ subPath: normalizePath(allSetting.subPath) })} /> updateSetting({ subURI: e.target.value })} /> ), }, { key: '2', label: catTabLabel(, t('pages.settings.information'), isMobile), children: ( <> updateSetting({ subEncrypt: v })} /> updateSetting({ remarkTemplate: v })} maxLength={256} /> updateSetting({ subShowIdentityOnAllLinks: v })} /> } description={t('pages.settings.subUpdatesDesc')} > updateSetting({ subUpdates: v }))} /> updateSetting({ subHideSettings: v })} /> ), }, { key: '3', label: catTabLabel(, t('pages.settings.profile'), isMobile), children: ( <> updateSetting({ subTitle: v })} metadataOnly /> updateSetting({ subSupportUrl: v })} metadataOnly /> updateSetting({ subProfileUrl: v })} metadataOnly /> updateSetting({ subAnnounce: v })} multiline rows={3} metadataOnly /> ), }, { key: '4', label: catTabLabel(, t('pages.settings.certs'), isMobile), children: ( <> updateSetting({ subCertFile: e.target.value })} /> updateSetting({ subKeyFile: e.target.value })} /> ), }, ]} /> ); }