From c31712464b652eeb61f27895e5f3de7bf56ec552 Mon Sep 17 00:00:00 2001 From: Carter Date: Fri, 6 Dec 2024 12:26:26 -0600 Subject: [PATCH] added CancelSubmit common element --- src/chat/ChatInput.tsx | 4 +--- src/chat/ChatMessage.tsx | 13 ++++++------ src/common/CancelSubmit.tsx | 41 +++++++++++++++++++++++++++++++++++++ src/teams/TeamActions.tsx | 5 ----- src/teams/TeamSettings.tsx | 34 +++++++----------------------- 5 files changed, 55 insertions(+), 42 deletions(-) create mode 100644 src/common/CancelSubmit.tsx diff --git a/src/chat/ChatInput.tsx b/src/chat/ChatInput.tsx index b903724..7f1e83c 100644 --- a/src/chat/ChatInput.tsx +++ b/src/chat/ChatInput.tsx @@ -58,8 +58,6 @@ export default function ChatInput(props: Props) { const { openSnack } = useSnackbar(); const [shift, setShift] = useState(false); const theme = useTheme(); - //const [attachmentDialogOpen, setAttachmentDialogOpen] = useState(false); - //const [uploadingFile, setUploadingFile] = useState(false); const [uploadedFiles, setUploadedFiles] = useState>(new Map()); const clearEntry = () => { @@ -145,7 +143,7 @@ export default function ChatInput(props: Props) { Are you sure you wish to delete this message - - + ); diff --git a/src/common/CancelSubmit.tsx b/src/common/CancelSubmit.tsx new file mode 100644 index 0000000..8d7a636 --- /dev/null +++ b/src/common/CancelSubmit.tsx @@ -0,0 +1,41 @@ +import { Button, Theme, Typography } from "@mui/material"; +import { makeStyles } from "@mui/styles"; + +const useStyles = makeStyles((theme: Theme) => { + return ({ + submitButton: { + marginRight: theme.spacing(1) + } + }) +}) + +interface Props { + submitDisabled?: boolean; + onSubmit?: () => void; + onCancel?: () => void; + submitText?: string; +} + +export default function CancelSubmit(props: Props) { + const { submitDisabled, onSubmit, onCancel, submitText } = props; + const classes = useStyles(); + + return ( + <> + + + + ) +} \ No newline at end of file diff --git a/src/teams/TeamActions.tsx b/src/teams/TeamActions.tsx index ccf0844..63b335e 100644 --- a/src/teams/TeamActions.tsx +++ b/src/teams/TeamActions.tsx @@ -24,7 +24,6 @@ import { blue } from "@mui/material/colors"; import { makeStyles } from "@mui/styles"; import { useGlobalState, useUserAPI } from "providers"; import { Star, StarBorder } from "@mui/icons-material"; -import { cloneDeep } from "lodash"; const useStyles = makeStyles(() => ({ shareIcon: { @@ -90,7 +89,6 @@ export default function TeamActions(props: Props) { setOpenState({ ...openState, share: true }); setAnchorEl(null); }} - // button > @@ -105,7 +103,6 @@ export default function TeamActions(props: Props) { setOpenState({ ...openState, users: true }); setAnchorEl(null); }} - // button > @@ -119,7 +116,6 @@ export default function TeamActions(props: Props) { setOpenState({ ...openState, removeSelf: true }); setAnchorEl(null); }} - // button > @@ -164,7 +160,6 @@ export default function TeamActions(props: Props) { label={label} isDialogOpen={openState.removeSelf} closeDialogCallback={(removeSelf: boolean) => { - // console.log(removeSelf) if (removeSelf) refreshCallback() setOpenState({ ...openState, removeSelf: false }) }} diff --git a/src/teams/TeamSettings.tsx b/src/teams/TeamSettings.tsx index 8f79391..8e99e7e 100644 --- a/src/teams/TeamSettings.tsx +++ b/src/teams/TeamSettings.tsx @@ -19,6 +19,7 @@ import React, { useEffect, useState } from "react"; import DeleteButton from "common/DeleteButton"; import { userRoleFromPermissions } from "pbHelpers/User"; import { IconPicker } from "common/IconPicker"; +import CancelSubmit from "common/CancelSubmit"; interface Props { teamDialogOpen: boolean; @@ -57,20 +58,6 @@ export default function TeamSettings(props: Props) { } }, [team]); - // const ColorButton = withStyles((theme: Theme) => ({ - // root: { - // color: theme.palette.getContrastText(theme.palette.primary.main), - // backgroundColor: theme.palette.primary.main, - // "&:hover": { - // backgroundColor: theme.palette.primary.light - // }, - // "&:disabled": { - // backgroundColor: "rgba(0,0,0,0)", - // color: theme.palette.getContrastText(theme.palette.primary.main) - // } - // } - // }))(Button); - const removeTeam = () => { if (team?.key()) teamAPI @@ -246,19 +233,12 @@ export default function TeamSettings(props: Props) { Delete )} - - + {deleteConfirmation()}