import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Theme, Typography } from "@mui/material"; import { makeStyles } from "@mui/styles"; import { useGroupAPI, useSnackbar } from "hooks"; import { Group } from "models"; const useStyles = makeStyles((theme: Theme) => { return ({ contentPadding: { paddingTop: theme.spacing(2), paddingBottom: theme.spacing(2) } }) }); interface Props { group: Group; isDialogOpen: boolean; closeDialogCallback: Function; removeCallback?: Function; } export default function RemoveGroup(props: Props) { const classes = useStyles(); // const navigate = useNavigate(); const groupAPI = useGroupAPI(); const { success, error, warning } = useSnackbar(); const { group, isDialogOpen, closeDialogCallback, removeCallback } = props; let groupName = group.name(); const closeDialog = () => { closeDialogCallback(); }; const submit = () => { groupAPI .removeGroup(group.id()) .then((_response: any) => { success(groupName + " was successfully removed"); if (removeCallback) removeCallback() }) .catch((err: any) => { err ? warning(err) : error("Error occured while removing " + groupName); closeDialog(); }).finally(() => { closeDialogCallback() }); }; return ( Delete {groupName}? WARNING: Clicking 'Accept' will delete {groupName} for you and all other users. Devices will NOT be deleted in this process. ); }