import React from 'react'; import { useDispatch } from 'react-redux'; import { useTranslation } from 'react-i18next'; import { Dialog, DialogContent, Grid, Box, Theme, makeStyles, DialogActions, Button, useTheme } from '@material-ui/core'; import { ErrorOutline } from '@material-ui/icons'; import { showNotification, NotificationTypeEnum } from '@energyweb/origin-ui-core'; import { removeSupply } from '../../features/supply'; import { IDeviceWithSupply } from '../../types'; interface IOwnProps { device: IDeviceWithSupply; close: () => void; } export const RemoveSupplyConfirmation = (props: IOwnProps) => { const { device, close } = props; const { t } = useTranslation(); const useIconStyles = makeStyles((theme: Theme) => ({ large: { fontSize: theme.spacing(10) } })); const iconStyles = useIconStyles(); const dispatch = useDispatch(); const { spacing } = useTheme(); const handleSupplyRemoval = () => { const { supplyId } = device; if (supplyId) { dispatch(removeSupply({ supplyId })); close(); } else { showNotification( t('exchange.supply.supplySettingsMissing'), NotificationTypeEnum.Error ); close(); } }; return ( {t('exchange.supply.removeSupplyConfirmation')} ); };