ChemPal Documentation - v1.7.0
    Preparing search index...
    • The bug-report review dialog. Shows the prefilled diagnostics and offers the two credential-free submission paths (GitHub and Google) plus copy-to-clipboard. Presentational only — URL building and diagnostics collection happen upstream.

      Parameters

      Returns Element

      <ReportDialog open fullText={text} githubUrl={gh} onClose={handleClose} />
      
      export function ReportDialog({ open, fullText, githubUrl, googleUrl, onClose }: ReportDialogProps) {
      const [copied, setCopied] = useState(false);

      const handleCopy = () => {
      void navigator.clipboard?.writeText(fullText);
      setCopied(true);
      };

      const handleGithub = () => {
      openTab(githubUrl);
      onClose('github');
      };

      const handleGoogle = () => {
      if (!googleUrl) return;
      // Long stacks are truncated in the URL, so also hand over the full text.
      void navigator.clipboard?.writeText(fullText);
      openTab(googleUrl);
      onClose('google');
      };

      return (
      <Dialog
      open={open}
      onClose={() => onClose('dismissed')}
      aria-labelledby="report-dialog-title"
      maxWidth="sm"
      fullWidth
      >
      <DialogTitle id="report-dialog-title">{i18n('report_dialog_title')}</DialogTitle>
      <DialogContent>
      <DialogContentText sx={{ mb: 1.5 }}>{i18n('report_dialog_desc')}</DialogContentText>
      <DiagnosticsBlock>{fullText}</DiagnosticsBlock>
      </DialogContent>
      <DialogActions>
      <Button variant="contained" onClick={handleGithub}>
      {i18n('report_via_github')}
      </Button>
      {googleUrl ? <Button onClick={handleGoogle}>{i18n('report_via_google')}</Button> : null}
      <Button onClick={handleCopy}>{copied ? i18n('report_copied') : i18n('report_copy')}</Button>
      <Button onClick={() => onClose('dismissed')}>{i18n('report_close')}</Button>
      </DialogActions>
      </Dialog>
      );
      }