From 934f78eb90dd4aa16929e1b89c7c05f4f24b5c07 Mon Sep 17 00:00:00 2001 From: Michael Foiani Date: Thu, 11 Aug 2022 11:37:39 -0400 Subject: add basic way to view issues. videos still won't play/show controls. --- src/client/util/ReportManager.scss | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/client/util/ReportManager.scss (limited to 'src/client/util/ReportManager.scss') diff --git a/src/client/util/ReportManager.scss b/src/client/util/ReportManager.scss new file mode 100644 index 000000000..1f008a426 --- /dev/null +++ b/src/client/util/ReportManager.scss @@ -0,0 +1,55 @@ +@import '../views/global/globalCssVariables'; + +.issue-list-wrapper { + position: relative; + min-width: 250px; + background-color: $light-blue; + overflow-y: scroll; +} + +.issue-list { + display: flex; + align-items: center; + justify-content: space-between; + padding: 5px; + margin: 5px; + border-radius: 5px; + border: 1px solid grey; + background-color: lightgoldenrodyellow; +} + +// issue should pop up when the user hover over the issue +.issue-list:hover { + box-shadow: 2px; + cursor: pointer; + border: 3px solid #252b33; +} + +.issue-content { + background-color: white; + padding: 10px; + flex: 1 1 auto; + overflow-y: scroll; +} + +.issue-title { + font-size: 20px; + font-weight: 600; + color: black; +} + +.issue-body { + padding: 0 10px; + width: 100%; + text-align: left; +} + +.issue-body > * { + margin-top: 5px; +} + +.issue-body img, +.issue-body video { + display: block; + max-width: 100%; +} -- cgit v1.2.3-70-g09d2 From a41d3546cbf34313b1d0a2caa7050fd04e7eee0f Mon Sep 17 00:00:00 2001 From: Michael Foiani Date: Thu, 18 Aug 2022 00:47:30 +0200 Subject: add button to create an issue - also can upload files. --- src/client/util/ReportManager.scss | 14 ++++++ src/client/util/ReportManager.tsx | 95 +++++++++++++++++++++++++++++--------- 2 files changed, 86 insertions(+), 23 deletions(-) (limited to 'src/client/util/ReportManager.scss') diff --git a/src/client/util/ReportManager.scss b/src/client/util/ReportManager.scss index 1f008a426..4bcbdc566 100644 --- a/src/client/util/ReportManager.scss +++ b/src/client/util/ReportManager.scss @@ -53,3 +53,17 @@ display: block; max-width: 100%; } + +.report-issue-fab { + position: fixed; + bottom: 20px; + right: 20px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; +} + +.loading-center { + margin: auto 0; +} diff --git a/src/client/util/ReportManager.tsx b/src/client/util/ReportManager.tsx index fa9a0513b..75102ec8e 100644 --- a/src/client/util/ReportManager.tsx +++ b/src/client/util/ReportManager.tsx @@ -37,9 +37,11 @@ export class ReportManager extends React.Component<{}> { @observable public issues: any[] = []; @action setIssues = action((issues: any[]) => { this.issues = issues; }); - @observable public selectedIssue: any = null; + // undefined is the default - null is if the user is making an issue + @observable public selectedIssue: any = undefined; @action setSelectedIssue = action((issue: any) => { this.selectedIssue = issue; }); + // only get the open issues @observable public shownIssues = this.issues.filter(issue => issue.state === 'open'); public updateIssueSearch = action((query: string = '') => { @@ -98,11 +100,12 @@ export class ReportManager extends React.Component<{}> { public async reportIssue() { 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, + body: `${this.bugDescription} \n\nfileLinks:\n${(this.fileLinks ?? []).join('\n')}`, labels: [ 'from-dash-app', ] @@ -123,31 +126,85 @@ export class ReportManager extends React.Component<{}> { this.bugTitle = ''; this.bugDescription = ''; this.toGithub = false; + this.setFileLinks([]) this.close(); } + @observable public fileLinks: any = []; + @action setFileLinks = action((links: any) => { this.fileLinks = links; }); + + private getServerPath = (link: any) => { return link.result.accessPaths.agnostic.server } + + private uploadFiles = (input: any) => { + this.setFileLinks(null); + // upload the files to the server + if (input.files && input.files.length !== 0) { + const fileArray: File[] = Array.from(input.files); + Networking.UploadFilesToServer(fileArray).then(links => { + console.log('finshed uploading', links.map(this.getServerPath)); + this.setFileLinks(links.map(this.getServerPath)); + }) + } + + } + + private renderIssue = (issue: any) => { - const { title, body, number, html_url } = issue; - return ( + const isReportingIssue = issue === null; + + return isReportingIssue ? + // report issue + (
+

Report an Issue

+
+ this.bugTitle = e.target.value} required/> +
+ +