aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/reportManager/ReportManager.tsx
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2023-07-11 13:30:51 -0400
committerSophie Zhang <sophie_zhang@brown.edu>2023-07-11 13:30:51 -0400
commitc1df53a7616ccbb9afad2deaf3026e70f3e974b4 (patch)
treeff3ed78bf5de39a31eeaad73d9a44d373aae0185 /src/client/util/reportManager/ReportManager.tsx
parentb1f189ffc7dfe558d5895c8f0cb103ab3e5c17d7 (diff)
starting connecting to new upload endpoint and standardized displaying media
Diffstat (limited to 'src/client/util/reportManager/ReportManager.tsx')
-rw-r--r--src/client/util/reportManager/ReportManager.tsx75
1 files changed, 41 insertions, 34 deletions
diff --git a/src/client/util/reportManager/ReportManager.tsx b/src/client/util/reportManager/ReportManager.tsx
index ff17a5097..d091e2a34 100644
--- a/src/client/util/reportManager/ReportManager.tsx
+++ b/src/client/util/reportManager/ReportManager.tsx
@@ -164,11 +164,11 @@ export class ReportManager extends React.Component<{}> {
this.setSubmitting(true);
const links = await this.uploadFilesToServer();
+ console.log(links);
if (!links) {
// error uploading files to the server
return;
}
- console.log(links);
const formattedLinks = (links ?? []).map(this.fileLinktoServerLink);
// const req = await this.octokit.request('POST /repos/{owner}/{repo}/issues', {
@@ -252,6 +252,7 @@ export class ReportManager extends React.Component<{}> {
/**
* Handles file upload.
+ *
* @param files uploaded files
*/
private onDrop = (files: File[]) => {
@@ -259,6 +260,36 @@ export class ReportManager extends React.Component<{}> {
};
/**
+ * Returns when the issue passes the current filters.
+ *
+ * @param issue issue to check
+ * @returns boolean indicating whether the issue passes the current filters
+ */
+ private passesTagFilter = (issue: Issue) => {
+ let passesPriority = true;
+ let passesBug = true;
+ if (this.priorityFilter) {
+ passesPriority = issue.labels.some(label => {
+ if (typeof label === 'string') {
+ return label === this.priorityFilter;
+ } else {
+ return label.name === this.priorityFilter;
+ }
+ });
+ }
+ if (this.bugFilter) {
+ passesBug = issue.labels.some(label => {
+ if (typeof label === 'string') {
+ return label === this.bugFilter;
+ } else {
+ return label.name === this.bugFilter;
+ }
+ });
+ }
+ return passesPriority && passesBug;
+ };
+
+ /**
* Gets a JSX element to render a media preview
* @param fileData file data
* @returns JSX element of a piece of media (image, video, audio)
@@ -306,30 +337,6 @@ export class ReportManager extends React.Component<{}> {
return <></>;
};
- private passesTagFilter = (issue: Issue) => {
- let passesPriority = true;
- let passesBug = true;
- if (this.priorityFilter) {
- passesPriority = issue.labels.some(label => {
- if (typeof label === 'string') {
- return label === this.priorityFilter;
- } else {
- return label.name === this.priorityFilter;
- }
- });
- }
- if (this.bugFilter) {
- passesBug = issue.labels.some(label => {
- if (typeof label === 'string') {
- return label === this.bugFilter;
- } else {
- return label.name === this.bugFilter;
- }
- });
- }
- return passesPriority && passesBug;
- };
-
/**
* @returns the component that dispays all issues
*/
@@ -487,26 +494,26 @@ export class ReportManager extends React.Component<{}> {
<option value="" disabled selected>
Type
</option>
- <option className="report-opt" value="bug">
+ <option className="report-opt" value={BugType.BUG}>
Bug
</option>
- <option className="report-opt" value="cosmetic">
+ <option className="report-opt" value={BugType.COSMETIC}>
Poor Design or Cosmetic
</option>
- <option className="report-opt" value="documentation">
+ <option className="report-opt" value={BugType.DOCUMENTATION}>
Poor Documentation
</option>
- <option className="report-opt" value="enhancement">
+ <option className="report-opt" value={BugType.ENHANCEMENT}>
New feature or request
</option>
</select>
- <select className="report-select" name="bigPriority" onChange={e => (this.bugPriority = e.target.value)}>
+ <select className="report-select" name="priority" onChange={e => (this.bugPriority = e.target.value)}>
<option className="report-opt" value="" disabled selected>
Priority
</option>
- <option value="priority-low">Low</option>
- <option value="priority-medium">Medium</option>
- <option value="priority-high">High</option>
+ <option value={Priority.LOW}>Low</option>
+ <option value={Priority.MEDIUM}>Medium</option>
+ <option value={Priority.HIGH}>High</option>
</select>
</div>
<Dropzone
@@ -536,7 +543,7 @@ export class ReportManager extends React.Component<{}> {
this.reportIssue();
}}>
Submit
- {this.submitting && <ReactLoading type="spin" color={theme.palette.primary.main} width={20} height={20} />}
+ {this.submitting && <ReactLoading type="spin" color={'#ffffff'} width={20} height={20} />}
</Button>
<IconButton onClick={this.close} sx={{ position: 'absolute', top: '4px', right: '4px' }}>
<CgClose size={'16px'} />