-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6be063
commit 39623ce
Showing
132 changed files
with
16,020 additions
and
10,844 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,103 @@ | ||
{ | ||
"extends": [ "next/core-web-vitals", "prettier" ], | ||
|
||
"rules": { | ||
"semi": "warn" | ||
} | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"next/core-web-vitals", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/strict", | ||
"plugin:sonarjs/recommended", | ||
"plugin:eslint-comments/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:cypress/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"ecmaFeatures": { | ||
"jsx": true, | ||
"modules": true | ||
}, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint", "sonarjs", "jsx-a11y", "github", "cypress", "import"], | ||
"rules": { | ||
"@next/next/no-img-element": "off", | ||
"@typescript-eslint/ban-ts-comment": "warn", | ||
"curly": "error", | ||
"no-console": [ | ||
"warn", | ||
{ | ||
"allow": ["warn", "error"] | ||
} | ||
], | ||
"quotes": [ | ||
"warn", | ||
"single", | ||
{ | ||
"avoidEscape": true | ||
} | ||
], | ||
"prefer-template": "warn", | ||
"react/jsx-curly-brace-presence": [ | ||
"warn", | ||
{ | ||
"props": "never" | ||
} | ||
], | ||
"react/jsx-boolean-value": ["error", "never"], | ||
"react/jsx-no-useless-fragment": "warn", | ||
"react/jsx-fragments": "warn", | ||
"eqeqeq": ["warn", "smart"], | ||
"no-lonely-if": "warn", | ||
"no-multi-assign": "warn", | ||
"@typescript-eslint/no-shadow": "warn", | ||
"no-useless-return": "warn", | ||
"no-useless-rename": "warn", | ||
"one-var-declaration-per-line": "warn", | ||
"prefer-object-spread": "warn", | ||
"no-unreachable-loop": "warn", | ||
"no-template-curly-in-string": "warn", | ||
"default-case-last": "warn", | ||
"no-array-constructor": "warn", | ||
"no-else-return": "warn", | ||
// disabled: too generic to really provide helpful warnings | ||
//'no-negated-condition': 'warn', | ||
"array-callback-return": "warn", | ||
"@typescript-eslint/consistent-type-definitions": ["warn", "type"], | ||
|
||
// check if useful | ||
//"no-secrets/no-secrets": "warn", | ||
|
||
// based on https://github.com/github/eslint-plugin-github/blob/main/lib/configs/react.js | ||
"github/a11y-no-generic-link-text": "error", | ||
|
||
// TODO: why is this one not working? | ||
//"github/role-supports-aria-props": "error", | ||
// disabled for the one above | ||
//"jsx-a11y/role-supports-aria-props": "off" | ||
|
||
// maybe consider https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y | ||
|
||
"import/first": "error", | ||
"import/no-absolute-path": "error", | ||
// disabled: slow linting | ||
/*"import/no-cycle": "error",*/ | ||
"import/no-duplicates": "error", | ||
|
||
"@typescript-eslint/consistent-type-imports": [ | ||
"error", | ||
{ | ||
"prefer": "type-imports", | ||
"fixStyle": "inline-type-imports" | ||
} | ||
], | ||
|
||
"sonarjs/cognitive-complexity": "off", | ||
// typically only triggered on more complex switch cases where introducing a variable only worsens readability | ||
"sonarjs/no-duplicate-string": "off" | ||
}, | ||
"ignorePatterns": [".eslintrc.js"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,7 @@ yarn-error.log* | |
/.idea/ | ||
.npmrc | ||
|
||
utils/generatedGitInfo.json | ||
lib/generatedGitInfo.json | ||
|
||
.yarn/ | ||
!.yarn/releases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-3.6.3.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { type FC } from 'react'; | ||
import Link from 'next/link'; | ||
import generatedGitInfo from 'lib/generatedGitInfo.json'; | ||
|
||
/** | ||
* Static footer component rendered at the bottom of every page | ||
*/ | ||
const Footer: FC = () => ( | ||
<footer className="footer mt-auto py-3 bg-light"> | ||
<div className="text-center"> | ||
<ul className="list-unstyled list-inline my-0"> | ||
<li className="list-inline-item mx-5"> | ||
<Link href="/terms-of-service" passHref> | ||
<a className="text-muted">Terms of service</a> | ||
</Link> | ||
</li> | ||
<li className="list-inline-item mx-5"> | ||
<Link href="/privacy-policy" passHref> | ||
<a className="text-muted">Privacy policy</a> | ||
</Link> | ||
</li> | ||
<li className="list-inline-item mx-5"> | ||
<a href="mailto:[email protected]" className="text-muted"> | ||
Email Support | ||
</a> | ||
</li> | ||
</ul> | ||
<ul className="list-unstyled list-inline my-0"> | ||
<li className="list-inline-item mx-5 text-muted"> | ||
<small>{generatedGitInfo.gitTag}</small> | ||
</li> | ||
</ul> | ||
</div> | ||
</footer> | ||
); | ||
|
||
export default Footer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type Identifiable = { | ||
readonly id: string; | ||
}; | ||
|
||
export default Identifiable; |
3 changes: 1 addition & 2 deletions
3
components/inlineCloseButton.test.tsx → components/InlineCloseButton.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { type FC } from 'react'; | ||
import { X } from 'react-bootstrap-icons'; | ||
import actionable from 'styles/actionable.module.css'; | ||
import clsx from 'clsx'; | ||
|
||
type InlineCloseButtonProps = { onClose: () => void }; | ||
|
||
// TODO: use unstyled button instead of div | ||
|
||
/** | ||
* Small X button representing a close action that is rendered inline | ||
* | ||
* @param props | ||
* @param props.onClose callback to call when button is pressed | ||
*/ | ||
const InlineCloseButton: FC<InlineCloseButtonProps> = ({ onClose }) => ( | ||
<div | ||
onClick={() => onClose()} | ||
className={clsx('d-inline-block', actionable['actionable'])} | ||
role="button" | ||
> | ||
<X /> | ||
</div> | ||
); | ||
|
||
export default InlineCloseButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { type FC, type PropsWithChildren, useEffect } from 'react'; | ||
|
||
import prism from 'prismjs'; | ||
import 'prismjs/components/prism-json'; | ||
|
||
/** | ||
* Display JSON text with syntax highlighting | ||
* | ||
* @param props | ||
* @param props.children | ||
*/ | ||
const JsonHighlight: FC<PropsWithChildren> = ({ children }) => { | ||
useEffect(() => { | ||
prism.highlightAll(); | ||
}, []); | ||
|
||
return ( | ||
<pre> | ||
<code className="language-json">{children}</code> | ||
</pre> | ||
); | ||
}; | ||
|
||
export default JsonHighlight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { type FC } from 'react'; | ||
import { Button, Modal } from 'react-bootstrap'; | ||
import JsonHighlight from 'components/JsonHighlight'; | ||
import { type Result } from '@eosc-perf/eosc-perf-client'; | ||
|
||
type JsonPreviewModalProps = { | ||
result: Result | null; | ||
show: boolean; | ||
closeModal: () => void; | ||
}; | ||
|
||
/** | ||
* Modal to view the JSON data of a result | ||
* | ||
* @param props | ||
* @param props.result | ||
* @param props.show | ||
* @param props.closeModal | ||
*/ | ||
const JsonPreviewModal: FC<JsonPreviewModalProps> = ({ result, show, closeModal }) => { | ||
return ( | ||
<Modal show={show} scrollable size="lg" onHide={closeModal}> | ||
<Modal.Header> | ||
<Modal.Title>JSON Data</Modal.Title> | ||
</Modal.Header> | ||
<Modal.Body> | ||
{result !== null && ( | ||
<JsonHighlight>{JSON.stringify(result.json, null, 4)}</JsonHighlight> | ||
)} | ||
{result == null && <div className="text-muted">Loading...</div>} | ||
</Modal.Body> | ||
<Modal.Footer> | ||
<Button variant="secondary" onClick={closeModal}> | ||
Close | ||
</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default JsonPreviewModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.