import {FormattedMessage} from 'react-intl'; import PropTypes from 'prop-types'; import React from 'react'; import classNames from 'classnames'; import BalancedFormattedMessage from '../../containers/balanced-formatted-message.jsx'; import Box from '../box/box.jsx'; import PeripheralTile from './peripheral-tile.jsx'; import Dots from './dots.jsx'; import enterUpdateIcon from './icons/enter-update.svg'; import radarIcon from './icons/searching.png'; import refreshIcon from './icons/refresh.svg'; import warningIcon from './icons/warning.svg'; import styles from './connection-modal.css'; const ScanningStep = props => { const showUpdate = !!(props.onUpdatePeripheral && !props.scanning); return ( {props.scanning ? ( props.peripheralList.length === 0 ? (
) : (
{props.peripheralList.map(peripheral => () )}
) ) : ( )}
{(props.scanning || props.peripheralList.length > 0) && ( // Show this message if we're still scanning OR if we've found devices )} {showUpdate && ( // Show this message if we're done scanning AND we can update // Note that it's possible the list includes devices but does not include the desired device, // so don't limit this message to the (props.peripheralList.length === 0) case )} {showUpdate && ( )}
); }; ScanningStep.propTypes = { connectionSmallIconURL: PropTypes.string, onConnecting: PropTypes.func, onRefresh: PropTypes.func, onUpdatePeripheral: PropTypes.func, peripheralList: PropTypes.arrayOf(PropTypes.shape({ name: PropTypes.string, rssi: PropTypes.number, peripheralId: PropTypes.string })), scanning: PropTypes.bool.isRequired }; ScanningStep.defaultProps = { peripheralList: [], scanning: true }; export default ScanningStep;