import React from 'react'; import { View } from 'react-native'; import { Icon, Label } from '@widergy/mobile-ui'; import Colors from '../Colors'; import { useBluetoothContext } from '../../bluetooth/useBluetoothContext'; import { BluetoothState } from '../../bluetooth/constants'; import styles from './styles'; interface InfoBoxTranslations { labelBluetoothPoweredOff: string; labelDeviceDisconnected: string; } interface Props { translations: InfoBoxTranslations; } const BluetoothReminder = ({ translations }: Props) => { const bluetoothContext = useBluetoothContext(); const alertType = { [BluetoothState.UNAVAILABLE]: () => ({ icon: 'bluetooth', label: translations.labelBluetoothPoweredOff, }), [BluetoothState.IDLE]: () => { if (bluetoothContext.targetDevice) return { icon: 'access-point-off', label: translations.labelDeviceDisconnected }; else return null; }, }; const alert = alertType[bluetoothContext.bluetoothState]?.(); if (alert) { return ( ); } return; }; export default BluetoothReminder;