import {FormattedMessage} from 'react-intl'; import PropTypes from 'prop-types'; import React from 'react'; import keyMirror from 'keymirror'; import classNames from 'classnames'; import BalancedFormattedMessage from '../../containers/balanced-formatted-message.jsx'; import Box from '../box/box.jsx'; import Dots from './dots.jsx'; import closeIcon from '../close-button/icon--close.svg'; import backIcon from './icons/back.svg'; import bluetoothIcon from './icons/bluetooth-white.svg'; import enterUpdateIcon from './icons/enter-update.svg'; import radarIcon from './icons/searching.png'; import warningIcon from './icons/warning.svg'; import styles from './connection-modal.css'; const PHASES = keyMirror({ prescan: null, pressbutton: null, notfound: null }); const AutoScanningStep = props => { // Offer to update both during scan and after a failed scan, as long there's an update function. // It's possible the scan will find "some" device but not the desired device, // so don't limit the update offer to just the PHASES.notfound case. const showUpdate = !!(props.onUpdatePeripheral && (props.phase === PHASES.pressbutton || props.phase === PHASES.notfound)); return (
{props.phase === PHASES.prescan && ( )} {props.phase === PHASES.pressbutton && ( )} {props.phase === PHASES.notfound && ( )}
{props.phase === PHASES.prescan && ( )} {props.phase === PHASES.pressbutton && ( )} {showUpdate && ( )} {props.phase === PHASES.prescan && ( )} {props.phase === PHASES.pressbutton && (
)} {props.phase === PHASES.notfound && ( )} {showUpdate && ( )}
); }; AutoScanningStep.propTypes = { connectionTipIconURL: PropTypes.string, onRefresh: PropTypes.func, onStartScan: PropTypes.func, onUpdatePeripheral: PropTypes.func, phase: PropTypes.oneOf(Object.keys(PHASES)) }; AutoScanningStep.defaultProps = { phase: PHASES.prescan }; export { AutoScanningStep as default, PHASES };