"use client";

import {
  Alert,
  Snackbar,
} from "@mui/material";

type Props = {
  message: string;
  appFontFamily: string;
  onClose: () => void;
};

export default function TranslationManagementToast({
  message,
  appFontFamily,
  onClose,
}: Props) {
  return (
    <Snackbar
      open={Boolean(message)}
      autoHideDuration={3200}
      onClose={(_, reason) => {
        if (reason === "clickaway") {
          return;
        }

        onClose();
      }}
      anchorOrigin={{
        vertical: "bottom",
        horizontal: "right",
      }}
    >
      <Alert
        severity="success"
        variant="filled"
        onClose={onClose}
        sx={{
          minWidth: 320,
          fontFamily:
            appFontFamily,
        }}
      >
        {message}
      </Alert>
    </Snackbar>
  );
}
