import {Alert, Container, Modal, Stack} from "@mantine/core";
import React from "react";
import {useTranslation} from "react-i18next";

interface ModalSuccessProps {
  show: boolean
  onClose: () => void
  taskUrl?: string
}


export default function ModalSuccess({
  show,
  onClose,
  taskUrl
}: ModalSuccessProps) {

  const { t } = useTranslation('feedbackSupport', { useSuspense: false })

  return (
    <Modal
      opened={show}
      onClose={onClose}
      className={'screenshot-hide'}
      fullScreen={true}
      zIndex={10000}
    >
      <Container>

          <Alert color={'primary'} title={t('ModalSuccess.title')}>
            <Stack>
              <div>
                {t('ModalSuccess.text')}
              </div>
              {taskUrl !== undefined && <div>
              {t('ModalSuccess.taskUrlText')}: <a href={taskUrl} target="_blank" rel="noreferrer">{taskUrl}</a></div>
            }
            </Stack>
          </Alert>

      </Container>
    </Modal>
  )
}
