import { Copy, FileUp, Inbox, Loader2, Mail, RefreshCw } from 'lucide-react'; import { useRef, type ReactElement } from 'react'; import { useTranslation } from '../../i18n'; import { openMailInbox } from '../MailIngest/mailInboxOpener'; import { useMailImportSettings } from '../MailIngest/useMailImportSettings'; import { Tooltip } from '../shared/Tooltip'; import Section from './Section'; import ToggleSwitch from './ToggleSwitch'; import { SETTINGS_BUTTON, SETTINGS_ICON_BUTTON, SettingRow, SettingRows, SettingsHint, StatusPill, } from './settingsKit'; /** * Settings → Integrations → Booking mail import: the person's forwarding * address to copy, how to forward automatically, the switches (import on, * AI reading, add on its own) and an .eml upload for a mail already on disk. * Nothing where the import is not available on this server or plan. */ export default function MailImportSection(): ReactElement | null { const { t } = useTranslation(); const s = useMailImportSettings(); const file = useRef(null); if (!s.settings) return null; const { address, prefs, ai_available: aiAvailable, pending } = s.settings; return (
} > {prefs.enabled ? t('mailInbox.settings.on') : t('mailInbox.settings.off')} } > {address && prefs.enabled && (
{t('mailInbox.settings.yourAddress')}
{address.address}
{t('mailInbox.settings.addressHint')}
{t('mailInbox.settings.howTo')}
  • {t('mailInbox.settings.howToGmail')}
  • {t('mailInbox.settings.howToOutlook')}
  • {t('mailInbox.settings.howToManual')}
)} void s.toggle('enabled')} label={t('mailInbox.settings.enabled')} /> } /> void s.toggle('ai_enabled')} label={t('mailInbox.settings.ai')} /> } /> void s.toggle('auto_add')} label={t('mailInbox.settings.autoAdd')} /> } /> {prefs.enabled && (
{ const picked = e.target.files?.[0]; e.target.value = ''; if (picked) void s.upload(picked); }} />
)} {t('mailInbox.settings.privacy')}
); }