/** @jsxImportSource @emotion/react */
import PropTypes from 'prop-types';
import { Box } from '@mui/material';
import Link from '@mui/material/Link';
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
export default function Feedback({
  infos = []
}) {
  const {
    t
  } = useLocaleContext();
  const feedbackUrl = new URL('https://community.arcblock.io/discussions/add');
  infos.forEach(x => {
    feedbackUrl.searchParams.set(x.label, x.value);
  });
  const infoStr = infos.map(x => `* ${x.label}: ${x.value}`).join('\n');
  feedbackUrl.searchParams.set('report', 'server');
  feedbackUrl.searchParams.set('context', `[Enter feedback here]



<!--
[Server Info]
${infoStr}
* Page: ${window.location.href}
-->
`);
  return _jsx(Box, {
    sx: {
      mx: {
        xs: 0,
        md: 2
      }
    },
    children: _jsx(Link, {
      sx: {
        color: 'text.primary'
      },
      target: "_blank",
      href: feedbackUrl.href,
      rel: "noreferrer",
      style: {
        textDecoration: 'underline'
      },
      children: t('common.reportIssue')
    })
  });
}
Feedback.propTypes = {
  infos: PropTypes.arrayOf(PropTypes.shape({
    label: PropTypes.string,
    value: PropTypes.string
  }))
};