import { Loader2, Plug, Save, Unplug } from 'lucide-react'; import React from 'react'; import { useTranslation } from '../../i18n'; import { EditorField, GRID_2, INPUT } from '../shared/dialogParts'; import { fs } from '../shared/DialogShell'; import WandererMark from '../Tours/wanderer/WandererMark'; import Section from './Section'; import { SETTINGS_BUTTON, SETTINGS_BUTTON_DANGER, SETTINGS_BUTTON_PRIMARY, SettingRow, SettingRows, SettingsHint, StatusPill, } from './settingsKit'; import ToggleSwitch from './ToggleSwitch'; import { useWandererConnection } from './useWandererConnection'; import WandererWatchRow from './WandererWatchRow'; /** * Settings → Integrations → wanderer: the reader's own trail database, from * which the Tours workspace imports trails. Laid out like the Dawarich and * AirTrail cards beside it; the behaviour is in `useWandererConnection`. * Under the form, the optional background check of the imported trails * (WAN-02), which switches on its own and needs no save. */ export default function WandererConnectionSection(): React.ReactElement { const { t } = useTranslation(); const S = useWandererConnection(); return (
} > {S.connected ? t('wanderer.connected') : t('wanderer.notConnected')} } > {t('wanderer.intro')}
S.setUrl(event.target.value)} placeholder="https://wanderer.example.com" className={INPUT} /> S.setToken(event.target.value)} autoComplete="off" aria-invalid={S.tokenInvalid || undefined} placeholder={S.connected && !S.token ? '••••••••' : 'wanderer_key_…'} className={INPUT} /> {S.tokenInvalid && (

{t('wanderer.tokenInvalid')}

)}
} />
{S.connected && ( )}
{(S.probe || S.lastCheck) && (
{S.probe ? (

{S.probe.message}

) : (

{S.lastCheck}

)}
)}
); }