import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material";
import {useTranslations} from "next-intl";
import ReplyIcon from '@mui/icons-material/Reply';
import {useState} from "react";
import ReviseContent from "./ReviseContent";

const Revise = ({rowId, mutate}) => {
    const t = useTranslations();
    const [openReviseDialog, setOpenReviseDialog] = useState(false);
    return (
        <>
            <Tooltip title={t("ReviseDialog.revise")}>
                <IconButton
                    color="primary"
                    onClick={() => {
                        setOpenReviseDialog(true)
                    }}
                >
                    <ReplyIcon/>
                </IconButton>
            </Tooltip>
            <Dialog fullWidth open={openReviseDialog}
                    PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
                <DialogTitle>{t("ReviseDialog.revise")}</DialogTitle>
                <ReviseContent mutate={mutate} rowId={rowId} setOpenReviseDialog={setOpenReviseDialog}/>
            </Dialog>
        </>
    )

}
export default Revise;