/* eslint-disable react/require-default-props */
import { Box, Button } from '@mui/material';
import PropTypes from 'prop-types';
import ReplayIcon from '@mui/icons-material/Replay';
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
import StatusDot from './status-dot';
import { getStatusPreview } from './utils';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
SendStatus.propTypes = {
  status: PropTypes.number.isRequired,
  updatedAt: PropTypes.string.isRequired,
  reason: PropTypes.string,
  channel: PropTypes.string,
  onResend: PropTypes.func
};
export default function SendStatus({
  status,
  updatedAt,
  reason = '',
  channel = 'wallet',
  onResend
}) {
  const {
    t,
    locale
  } = useLocaleContext();
  const result = getStatusPreview(t, locale, {
    status,
    updatedAt,
    reason,
    channel
  });
  return /*#__PURE__*/_jsxs(Box, {
    sx: {
      display: 'flex',
      alignItems: 'center',
      gap: 1
    },
    children: [/*#__PURE__*/_jsx(StatusDot, {
      config: result,
      showTitle: true
    }), result.status !== 'success' && /*#__PURE__*/_jsx(Button, {
      className: "resend-btn",
      size: "small",
      startIcon: /*#__PURE__*/_jsx(ReplayIcon, {}),
      sx: {
        fontSize: 12,
        color: 'rgba(0, 0, 0, 0.87)',
        fontWeight: 400,
        '.MuiButton-startIcon': {
          mr: '2px'
        }
      },
      onClick: onResend,
      children: t('notification.resend')
    })]
  });
}