aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/reportManager
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/reportManager')
-rw-r--r--src/client/util/reportManager/ReportManager.scss12
-rw-r--r--src/client/util/reportManager/ReportManager.tsx6
-rw-r--r--src/client/util/reportManager/ReportManagerComponents.tsx11
-rw-r--r--src/client/util/reportManager/reportManagerSchema.ts40
-rw-r--r--src/client/util/reportManager/reportManagerUtils.ts16
5 files changed, 43 insertions, 42 deletions
diff --git a/src/client/util/reportManager/ReportManager.scss b/src/client/util/reportManager/ReportManager.scss
index d82d7fdeb..fd343ac8e 100644
--- a/src/client/util/reportManager/ReportManager.scss
+++ b/src/client/util/reportManager/ReportManager.scss
@@ -96,12 +96,12 @@
transition: all 0.2s ease;
background: transparent;
- &:hover {
- // border-bottom-color: $text-gray;
- }
- &:focus {
- // border-bottom-color: #4476f7;
- }
+ // &:hover {
+ // // border-bottom-color: $text-gray;
+ // }
+ // &:focus {
+ // // border-bottom-color: #4476f7;
+ // }
}
// View issues
diff --git a/src/client/util/reportManager/ReportManager.tsx b/src/client/util/reportManager/ReportManager.tsx
index 2224e642d..c969f9036 100644
--- a/src/client/util/reportManager/ReportManager.tsx
+++ b/src/client/util/reportManager/ReportManager.tsx
@@ -1,5 +1,3 @@
-/* eslint-disable jsx-a11y/label-has-associated-control */
-/* eslint-disable jsx-a11y/media-has-caption */
/* eslint-disable react/no-unused-class-component-methods */
import { Octokit } from '@octokit/core';
import { Button, Dropdown, DropdownType, IconButton, Type } from 'browndash-components';
@@ -27,7 +25,7 @@ import { BugType, FileData, Priority, ReportForm, ViewState, bugDropdownItems, d
* Class for reporting and viewing Github issues within the app.
*/
@observer
-export class ReportManager extends React.Component<{}> {
+export class ReportManager extends React.Component<object> {
// eslint-disable-next-line no-use-before-define
public static Instance: ReportManager;
@observable private isOpen = false;
@@ -109,7 +107,7 @@ export class ReportManager extends React.Component<{}> {
this.setFetchingIssues(false);
});
- constructor(props: {}) {
+ constructor(props: object) {
super(props);
makeObservable(this);
ReportManager.Instance = this;
diff --git a/src/client/util/reportManager/ReportManagerComponents.tsx b/src/client/util/reportManager/ReportManagerComponents.tsx
index cecebc648..92f877859 100644
--- a/src/client/util/reportManager/ReportManagerComponents.tsx
+++ b/src/client/util/reportManager/ReportManagerComponents.tsx
@@ -1,8 +1,5 @@
/* eslint-disable react/require-default-props */
/* eslint-disable prefer-destructuring */
-/* eslint-disable jsx-a11y/label-has-associated-control */
-/* eslint-disable jsx-a11y/no-static-element-interactions */
-/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable no-use-before-define */
import * as React from 'react';
import ReactMarkdown from 'react-markdown';
@@ -98,7 +95,7 @@ export function IssueCard({ issue, onSelect }: IssueCardProps) {
<label className="issue-label">#{issue.number}</label>
<div className="issue-tags">
{issue.labels.map(label => {
- const labelString = typeof label === 'string' ? label : label.name ?? '';
+ const labelString = typeof label === 'string' ? label : (label.name ?? '');
const colors = getLabelColors(labelString);
return <Tag key={labelString} text={labelString} backgroundColor={colors[0]} color={colors[1]} />;
})}
@@ -295,14 +292,16 @@ export function IssueView({ issue }: IssueViewProps) {
<div>
<div className="issue-tags">
{issue.labels.map(label => {
- const labelString = typeof label === 'string' ? label : label.name ?? '';
+ const labelString = typeof label === 'string' ? label : (label.name ?? '');
const colors = getLabelColors(labelString);
return <Tag key={labelString} text={labelString} backgroundColor={colors[0]} color={colors[1]} fontSize="12px" />;
})}
</div>
</div>
)}
- <ReactMarkdown children={issueBody} className="issue-content" remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]} />
+ <ReactMarkdown className="issue-content" remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
+ {issueBody}
+ </ReactMarkdown>
</div>
);
}
diff --git a/src/client/util/reportManager/reportManagerSchema.ts b/src/client/util/reportManager/reportManagerSchema.ts
index 171c24393..7162371e3 100644
--- a/src/client/util/reportManager/reportManagerSchema.ts
+++ b/src/client/util/reportManager/reportManagerSchema.ts
@@ -66,7 +66,7 @@ export interface Issue {
*/
url: string;
user: null | TentacledSimpleUser;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -94,7 +94,7 @@ export interface PurpleSimpleUser {
subscriptions_url: string;
type: string;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -122,7 +122,7 @@ export interface AssigneeElement {
subscriptions_url: string;
type: string;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -164,7 +164,7 @@ export interface FluffySimpleUser {
subscriptions_url: string;
type: string;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
export interface LabelObject {
@@ -175,7 +175,7 @@ export interface LabelObject {
name?: string;
node_id?: string;
url?: string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -207,7 +207,7 @@ export interface Milestone {
title: string;
updated_at: Date;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -235,7 +235,7 @@ export interface MilestoneSimpleUser {
subscriptions_url: string;
type: string;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -288,7 +288,7 @@ export interface GitHubApp {
slug?: string;
updated_at: Date;
webhook_secret?: null | string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -316,7 +316,7 @@ export interface GitHubAppSimpleUser {
subscriptions_url: string;
type: string;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -336,7 +336,7 @@ export interface PullRequest {
merged_at?: Date | null;
patch_url: null | string;
url: null | string;
- [property: string]: any;
+ [property: string]: unknown;
}
export interface ReactionRollup {
@@ -350,7 +350,7 @@ export interface ReactionRollup {
rocket: number;
total_count: number;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -562,7 +562,7 @@ export interface Repository {
* Whether to require contributors to sign off on web-based commits
*/
web_commit_signoff_required?: boolean;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -575,7 +575,7 @@ export interface LicenseSimple {
node_id: string;
spdx_id: null | string;
url: null | string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -628,7 +628,7 @@ export interface RepositorySimpleUser {
subscriptions_url: string;
type: string;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -656,7 +656,7 @@ export interface OwnerObject {
subscriptions_url: string;
type: string;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
export interface RepositoryPermissions {
@@ -665,7 +665,7 @@ export interface RepositoryPermissions {
pull: boolean;
push: boolean;
triage?: boolean;
- [property: string]: any;
+ [property: string]: unknown;
}
/**
@@ -809,7 +809,7 @@ export interface TemplateRepository {
use_squash_pr_title_as_default?: boolean;
visibility?: string;
watchers_count?: number;
- [property: string]: any;
+ [property: string]: unknown;
}
export interface Owner {
@@ -831,7 +831,7 @@ export interface Owner {
subscriptions_url?: string;
type?: string;
url?: string;
- [property: string]: any;
+ [property: string]: unknown;
}
export interface TemplateRepositoryPermissions {
@@ -840,7 +840,7 @@ export interface TemplateRepositoryPermissions {
pull?: boolean;
push?: boolean;
triage?: boolean;
- [property: string]: any;
+ [property: string]: unknown;
}
export enum StateReason {
@@ -874,5 +874,5 @@ export interface TentacledSimpleUser {
subscriptions_url: string;
type: string;
url: string;
- [property: string]: any;
+ [property: string]: unknown;
}
diff --git a/src/client/util/reportManager/reportManagerUtils.ts b/src/client/util/reportManager/reportManagerUtils.ts
index f14967e0a..d51418cbe 100644
--- a/src/client/util/reportManager/reportManagerUtils.ts
+++ b/src/client/util/reportManager/reportManagerUtils.ts
@@ -3,6 +3,7 @@
import { Octokit } from '@octokit/core';
import { Networking } from '../../Network';
import { Issue } from './reportManagerSchema';
+import { Upload } from '../../../server/SharedMediaTypes';
// enums and interfaces
@@ -53,7 +54,7 @@ export const emptyReportForm = {
* Fetches issues from Github.
* @returns array of all issues
*/
-export const getAllIssues = async (octokit: Octokit): Promise<any[]> => {
+export const getAllIssues = async (octokit: Octokit): Promise<unknown[]> => {
const res = await octokit.request('GET /repos/{owner}/{repo}/issues', {
owner: 'brown-dash',
repo: 'Dash-Web',
@@ -103,7 +104,10 @@ export const fileLinktoServerLink = (fileLink: string): string => {
* @param link response from file upload
* @returns server file path
*/
-export const getServerPath = (link: any): string => link.result.accessPaths.agnostic.server as string;
+export const getServerPath = (link: Upload.FileResponse<Upload.FileInformation>): string => {
+ if (link.result instanceof Error) return '';
+ return link.result.accessPaths.agnostic.server;
+};
/**
* Uploads media files to the server.
@@ -114,11 +118,11 @@ export const uploadFilesToServer = async (mediaFiles: FileData[]): Promise<strin
// need to always upload to browndash
const links = await Networking.UploadFilesToServer(mediaFiles.map(file => ({ file: file.file })));
return (links ?? []).map(getServerPath).map(fileLinktoServerLink);
- } catch (err) {
- if (err instanceof Error) {
- alert(err.message);
+ } catch (result) {
+ if (result instanceof Error) {
+ alert(result.message);
} else {
- alert(err);
+ alert(result);
}
}
return undefined;