import React from 'react' import { Loader2, Plane, Save } from 'lucide-react' import { useTranslation } from '../../i18n' import { useAirTrailSettings } from './useAirTrailSettings' import AirTrailIcon from '../shared/AirTrailIcon' import Section from './Section' import ToggleSwitch from './ToggleSwitch' import { SETTINGS_BUTTON, SETTINGS_BUTTON_PRIMARY, SettingRow, SettingRows, SettingsHint, StatusPill } from './settingsKit' import { EditorField, GRID_2, INPUT } from '../shared/dialogParts' import { fs } from '../shared/DialogShell' /** * Settings → Integrations → AirTrail. Per-user connection to a self-hosted * AirTrail instance (URL + Bearer API key). Mirrors the photo-provider (Immich) * connection layout: the two fields side by side, the switches as rows, then * Save / Test-connection, with the connection state as a pill in the card's band. The key is stored encrypted and never prefilled. */ export default function AirTrailConnectionSection(): React.ReactElement { const { t } = useTranslation() const { url, setUrl, apiKey, setApiKey, allowInsecureTls, toggleInsecureTls, writeEnabled, toggleWriteEnabled, connected, loading, saving, testing, canSave, handleSave, handleTest, } = useAirTrailSettings() const fieldId = (name: string) => `airtrail-${name}` return (
}> {connected ? t('settings.airtrail.connected') : t('settings.airtrail.notConnected')} } >
setUrl(e.target.value)} placeholder="https://airtrail.example.com" className={INPUT} /> setApiKey(e.target.value)} autoComplete="off" placeholder={connected && !apiKey ? '••••••••' : t('settings.airtrail.apiKeyPlaceholder')} className={INPUT} />
} /> } />
{t('settings.airtrail.hint')}
) }