import React , { FunctionComponent } from 'react' ; import IconLine from '../IconLine' ; import Switch from '../Switch' ; import i18n from './i18n' ; import { ClickToDialProps } from './SettingsPanel.interface' ; export const ClickToDial = ( { currentLocale , showClickToDial , outboundSMS , clickToDialPermissions , clickToDialEnabled , onClickToDialChange , clickToDialTitle , } ) => { let clickToDialText ; if ( outboundSMS && clickToDialPermissions ) { clickToDialText = i18n . getString ( 'clickToDialSMS' , currentLocale ) ; } else if ( ! outboundSMS && clickToDialPermissions ) { clickToDialText = i18n . getString ( 'clickToDial' , currentLocale ) ; } else if ( outboundSMS && ! clickToDialPermissions ) { clickToDialText = i18n . getString ( 'clickToSMS' , currentLocale ) ; } else { clickToDialText = '' ; } if ( showClickToDial && ( outboundSMS || clickToDialPermissions ) ) { return ( < IconLine icon = { < Switch checked = { clickToDialEnabled } onChange = { onClickToDialChange } / > } title = { clickToDialTitle } > { clickToDialText } < /IconLine>); } return null ; } ;