import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { action, computed, observable, runInAction } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; import { ColorState, SketchPicker } from 'react-color'; import { Doc } from '../../fields/Doc'; import { Id } from '../../fields/FieldSymbols'; import { BoolCast, Cast, StrCast } from '../../fields/Types'; import { addStyleSheet, addStyleSheetRule, Utils } from '../../Utils'; import { GoogleAuthenticationManager } from '../apis/GoogleAuthenticationManager'; import { DocServer } from '../DocServer'; import { Networking } from '../Network'; import { MainViewModal } from '../views/MainViewModal'; import { FontIconBox } from '../views/nodes/button/FontIconBox'; import { DragManager } from './DragManager'; import { GroupManager } from './GroupManager'; import './SettingsManager.scss'; import { undoBatch } from './UndoManager'; import { Octokit } from "@octokit/core"; import { CheckBox } from '../views/search/CheckBox'; const higflyout = require('@hig/flyout'); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @observer export class ReportManager extends React.Component<{}> { public static Instance: ReportManager; @observable private isOpen = false; private octokit: Octokit; constructor(props: {}) { super(props); ReportManager.Instance = this; this.octokit = new Octokit({ auth: 'auth key' }); } public close = action(() => (this.isOpen = false)); public open = action(() => (this.isOpen = true)); private bugTitle = ''; private bugDescription = ''; private toGithub = false; private formatTitle = (title: string, userEmail: string) => `${title} - ${userEmail.replace('@brown.edu', '')}`; public async reportBug() { if (this.toGithub) { const req = await this.octokit.request('POST /repos/{owner}/{repo}/issues', { owner: 'brown-dash', repo: 'Dash-Web', title: this.formatTitle(this.bugTitle, Doc.CurrentUserEmail), body: this.bugDescription, labels: [ 'from-dash-app', ] }); // 201 status means success if (req.status !== 201) { alert('Error creating issue on github.'); // on error, don't close the modal return; } } else { // if not going to github issues, not sure what to do yet... } // if we're down here, then we're good to go. this.bugTitle = ''; this.bugDescription = ''; this.toGithub = false; this.close(); } private get reportInterface() { return (