import React from 'react'; import { Card, CardBody, CardHeader, FormGroup, Input } from 'reactstrap'; import classNames from 'classnames'; import ToggleSwitch from '../utils/ToggleSwitch'; import { Settings } from './reducers/settings'; interface RealTimeUpdatesProps { settings: Settings; toggleRealTimeUpdates: (enabled: boolean) => void; setRealTimeUpdatesInterval: (interval: number) => void; } const intervalValue = (interval?: number) => !interval ? '' : `${interval}`; const RealTimeUpdates = ( { settings: { realTimeUpdates }, toggleRealTimeUpdates, setRealTimeUpdatesInterval }: RealTimeUpdatesProps, ) => ( Real-time updates Enable or disable real-time updates, when using Shlink v2.2.0 or newer. setRealTimeUpdatesInterval(Number(e.target.value))} /> {realTimeUpdates.enabled && ( {realTimeUpdates.interval !== undefined && realTimeUpdates.interval > 0 && ( Updates will be reflected in the UI every {realTimeUpdates.interval} minute{realTimeUpdates.interval > 1 && 's'}. )} {!realTimeUpdates.interval && 'Updates will be reflected in the UI as soon as they happen.'} )} ); export default RealTimeUpdates;