diff --git a/.vscode/settings.json b/.vscode/settings.json index faf88f1c1..c06b9d441 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,23 +1,18 @@ { - // required to indicate that eslint project is not in the root + // ESLint "eslint.workingDirectories": [ "./frontend", ], - // FORMAT ON SAVE for VSC - // based on this acticle https://www.aleksandrhovhannisyan.com/blog/format-code-on-save-vs-code-eslint/ - // define files to validate, can have more options - // but in this project we use typescript and react - "eslint.validate": [ - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - ], - // it tells VScode to use eslint plugin - // Note! you might also need to disable Prettier or VSCode defaults + // Formating with ESLint: + "eslint.format.enable": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true, }, + "[javascript][javascriptreact][typescript][typescriptreact]": { + "editor.tabSize": 2, + "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "editor.formatOnSave": true, + }, // Tailwind plugin integration "css.validate": false, "editor.quickSuggestions": { @@ -26,26 +21,10 @@ "tailwindCSS.includeLanguages": { "plaintext": "html" }, + // Backend "[java]": { "editor.suggest.snippetsPreventQuickSuggestions": false, "editor.useTabStops": true, "editor.insertSpaces": false, }, - "java.configuration.updateBuildConfiguration": "automatic", - "java.test.config": { - "envFile": "${workspaceFolder}/.env", - }, - "[typescript]": { - "editor.tabSize": 2, - "editor.insertSpaces": true, - "editor.detectIndentation": false - }, - "[typescriptreact]": { - "editor.formatOnSave": true, - "editor.defaultFormatter": "dbaeumer.vscode-eslint" - }, - "[javascript]": { - "editor.formatOnSave": true, - "editor.defaultFormatter": "dbaeumer.vscode-eslint" - }, } \ No newline at end of file diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json index 3765b53b4..0d85e2c01 100644 --- a/frontend/.eslintrc.json +++ b/frontend/.eslintrc.json @@ -1,8 +1,22 @@ { "extends": "next/core-web-vitals", "rules": { - "no-debugger":"warn", + // --- Linting --- + "no-debugger": "warn", "no-console": "warn", + // use direct imports on material-ui to improve + // performance in unit tests with jest + // see https://blog.bitsrc.io/why-is-my-jest-suite-so-slow-2a4859bb9ac0 + "no-restricted-imports": [ + "warn", + { + "name": "@mui/material", + "message": "Please use \"import foo from '@mui/material/foo'\" instead." + } + ], + // do not warn for use of img element + "@next/next/no-img-element": "off", + // --- Formating --- "eol-last": [ "warn", "always" @@ -15,35 +29,25 @@ "warn", "never" ], - "object-curly-spacing": [ - "warn", - "never" - ], - "array-bracket-spacing": [ + "indent": [ "warn", - "never" + 2, + { + "SwitchCase": 1 + } ], - // we use 2 spaces to indent our code - // causes eslint error TypeError: Cannot read property 'loc' of undefined - // see https://github.com/typescript-eslint/typescript-eslint/issues/792 - // "indent": ["warn", 2], - // we want to avoid extraneous spaces "no-trailing-spaces": "warn", "no-multi-spaces": [ "warn" ], "no-multiple-empty-lines": "warn", - // use direct imports on material-ui to improve - // performance in unit tests with jest - // see https://blog.bitsrc.io/why-is-my-jest-suite-so-slow-2a4859bb9ac0 - "no-restricted-imports": [ + "object-curly-spacing": [ "warn", - { - "name": "@mui/material", - "message": "Please use \"import foo from '@mui/material/foo'\" instead." - } + "never" ], - // do not warn for use of img element - "@next/next/no-img-element":"off" + "array-bracket-spacing": [ + "warn", + "never" + ] } } \ No newline at end of file diff --git a/frontend/components/GlobalSearchAutocomplete/index.tsx b/frontend/components/GlobalSearchAutocomplete/index.tsx index d38b4f37f..3c31da12f 100644 --- a/frontend/components/GlobalSearchAutocomplete/index.tsx +++ b/frontend/components/GlobalSearchAutocomplete/index.tsx @@ -188,7 +188,7 @@ export default function GlobalSearchAutocomplete(props: Props) {
{item?.source}{item?.is_published === false && unpublished} + className="flex-nowrap border px-1 py-[2px] rounded bg-warning ml-3 text-xs text-warning-content">unpublished}
diff --git a/frontend/components/admin/keywords/KeywordTable.tsx b/frontend/components/admin/keywords/KeywordTable.tsx index de8a0fdf7..214a65302 100644 --- a/frontend/components/admin/keywords/KeywordTable.tsx +++ b/frontend/components/admin/keywords/KeywordTable.tsx @@ -54,49 +54,49 @@ export default function KeywordTable({loading, keywords, searchFor, deleteKeywor - { - keywords.map(item => { - return ( - - - - - - - - {item.software_cnt ?? 0} - - - - { + return ( + + - {item.projects_cnt ?? 0} - - - - 0 || item.software_cnt > 0} - onClick={() => - deleteKeyword(item.id) - }> - - - - - ) - }) - } + + + + + + {item.software_cnt ?? 0} + + + + + {item.projects_cnt ?? 0} + + + + 0 || item.software_cnt > 0} + onClick={() => + deleteKeyword(item.id) + }> + + + + + ) + }) + } diff --git a/frontend/components/admin/organisations/AddOrganisation.test.tsx b/frontend/components/admin/organisations/AddOrganisation.test.tsx index 25df8210a..26aa55d79 100644 --- a/frontend/components/admin/organisations/AddOrganisation.test.tsx +++ b/frontend/components/admin/organisations/AddOrganisation.test.tsx @@ -65,7 +65,7 @@ it('calls findROR api on search', async () => { await waitFor(() => { expect(mockFindInROR).toBeCalledTimes(1) expect(mockFindInROR).toBeCalledWith({ - 'searchFor': searchFor + 'searchFor': searchFor }) }) }) @@ -90,7 +90,7 @@ it('offers to add organisation when not found in ROR', async () => { await waitFor(() => { expect(mockFindInROR).toBeCalledTimes(1) expect(mockFindInROR).toBeCalledWith({ - 'searchFor': searchFor + 'searchFor': searchFor }) }) @@ -122,7 +122,7 @@ it('shows option found in ROR', async () => { await waitFor(() => { expect(mockFindInROR).toBeCalledTimes(1) expect(mockFindInROR).toBeCalledWith({ - 'searchFor': searchFor + 'searchFor': searchFor }) }) diff --git a/frontend/components/admin/pages/edit/PageEditIndex.test.tsx b/frontend/components/admin/pages/edit/PageEditIndex.test.tsx index a8a875a48..4e327de97 100644 --- a/frontend/components/admin/pages/edit/PageEditIndex.test.tsx +++ b/frontend/components/admin/pages/edit/PageEditIndex.test.tsx @@ -164,15 +164,15 @@ describe('frontend/components/admin/pages/edit/index.tsx', () => { expect(mockUpdatePositions).toBeCalledTimes(1) expect(mockUpdatePositions).toBeCalledWith({ 'items':[ - { - 'id': 'test-id-2', - 'position': 1, - 'title': 'Test title 2', - 'slug': 'test-slug-2', - 'is_published': false - }, - ], - 'token': mockSession.token, + { + 'id': 'test-id-2', + 'position': 1, + 'title': 'Test title 2', + 'slug': 'test-slug-2', + 'is_published': false + }, + ], + 'token': mockSession.token, }) }) }) diff --git a/frontend/components/admin/pages/edit/PageEditorBody.tsx b/frontend/components/admin/pages/edit/PageEditorBody.tsx index 00cbeb1ff..9d8373f17 100644 --- a/frontend/components/admin/pages/edit/PageEditorBody.tsx +++ b/frontend/components/admin/pages/edit/PageEditorBody.tsx @@ -45,11 +45,11 @@ export default function PageEditorBody({links,selected,onSelect,onSorted,onDelet onSorted={onSorted} /> - + ) diff --git a/frontend/components/admin/pages/edit/SortableNav.tsx b/frontend/components/admin/pages/edit/SortableNav.tsx index bec0f93dc..e83ba5f9c 100644 --- a/frontend/components/admin/pages/edit/SortableNav.tsx +++ b/frontend/components/admin/pages/edit/SortableNav.tsx @@ -50,7 +50,7 @@ export default function SortableNav({selected, links, onSelect, onSorted}: Pages */ function renderListItem(item: RsdLink, index: number) { return ( - { 'slug': 'test-slug', 'title': 'Test title 1', }, - 'status': 200, + 'status': 200, }) }) diff --git a/frontend/components/admin/rsd-contributors/apiRsdContributors.ts b/frontend/components/admin/rsd-contributors/apiRsdContributors.ts index 24508a275..d9ff5a879 100644 --- a/frontend/components/admin/rsd-contributors/apiRsdContributors.ts +++ b/frontend/components/admin/rsd-contributors/apiRsdContributors.ts @@ -12,7 +12,7 @@ import {ApiParams, paginationUrlParams} from '~/utils/postgrestUrl' import {RsdContributor} from './useContributors' export async function getContributors({page, rows, token, searchFor, orderBy}: ApiParams) { - try { + try { let query = paginationUrlParams({rows, page}) if (searchFor) { query+=`&or=(given_names.ilike.*${searchFor}*,family_names.ilike.*${searchFor}*,email_address.ilike.*${searchFor}*,orcid.ilike.*${searchFor}*)` diff --git a/frontend/components/admin/software-highlights/SortableHighlightList.tsx b/frontend/components/admin/software-highlights/SortableHighlightList.tsx index a2a66bb7d..ac94d5d5c 100644 --- a/frontend/components/admin/software-highlights/SortableHighlightList.tsx +++ b/frontend/components/admin/software-highlights/SortableHighlightList.tsx @@ -78,36 +78,36 @@ export default function SortableHighlightsList({highlights, loading, onSorted, o return ( <> - - -

+ +

Are you sure you want to delete software {modal?.highlight?.brand_name} from hightlight? -

- - } - onCancel={() => { - setModal({ - open: false - }) - }} - onDelete={() => { - if (modal?.highlight?.id) { - onDelete(modal?.highlight?.id) - } - setModal({ - open: false - }) - }} - /> +

+ + } + onCancel={() => { + setModal({ + open: false + }) + }} + onDelete={() => { + if (modal?.highlight?.id) { + onDelete(modal?.highlight?.id) + } + setModal({ + open: false + }) + }} + /> ) } diff --git a/frontend/components/admin/software-highlights/SortableHightlightItem.tsx b/frontend/components/admin/software-highlights/SortableHightlightItem.tsx index 48cfda499..3d17dbf18 100644 --- a/frontend/components/admin/software-highlights/SortableHightlightItem.tsx +++ b/frontend/components/admin/software-highlights/SortableHightlightItem.tsx @@ -79,7 +79,7 @@ export default function SortableHighlightItem({pos, item, onEdit, onDelete}: Hig variant="square" > {brand_name.slice(0,3)} - + } { const url = `/api/v1/software_highlight?software=eq.${item.id}` diff --git a/frontend/components/cards/CardTitleSubtitle.tsx b/frontend/components/cards/CardTitleSubtitle.tsx index 70f012cf1..3dfcb987d 100644 --- a/frontend/components/cards/CardTitleSubtitle.tsx +++ b/frontend/components/cards/CardTitleSubtitle.tsx @@ -17,7 +17,7 @@ export default function CardTitleSubtitle({title,subtitle}:CardTitleSubtitleProp title={title} className="text-xl font-medium line-clamp-1 my-1" > - {title} + {title}

{subtitle} diff --git a/frontend/components/cards/StatusBanner.tsx b/frontend/components/cards/StatusBanner.tsx index 0bd86dc8f..47dc54bff 100644 --- a/frontend/components/cards/StatusBanner.tsx +++ b/frontend/components/cards/StatusBanner.tsx @@ -48,6 +48,6 @@ export default function StatusBanner({ Not published } - + ) } diff --git a/frontend/components/charts/d3LineChart/NoDataAvailableChart.tsx b/frontend/components/charts/d3LineChart/NoDataAvailableChart.tsx index 65b20395b..a27ade0eb 100644 --- a/frontend/components/charts/d3LineChart/NoDataAvailableChart.tsx +++ b/frontend/components/charts/d3LineChart/NoDataAvailableChart.tsx @@ -114,12 +114,12 @@ function drawLine(props: LineChartConfig) { lineGroup.selectAll('.line') .data([noCommitData]) .join('path') - .attr('class','line') - .attr('d',d=>generateScaledLine(d as any)) - .attr('fill','none') - .attr('stroke', strokeColor) - .attr('stroke-width', 2) - .attr('stroke-opacity', 0.7) + .attr('class','line') + .attr('d',d=>generateScaledLine(d as any)) + .attr('fill','none') + .attr('stroke', strokeColor) + .attr('stroke-width', 2) + .attr('stroke-opacity', 0.7) const sw = group.append('switch') sw.append('foreignObject') diff --git a/frontend/components/charts/d3LineChart/SingleLineChart.test.tsx b/frontend/components/charts/d3LineChart/SingleLineChart.test.tsx index 61113084f..0868699c5 100644 --- a/frontend/components/charts/d3LineChart/SingleLineChart.test.tsx +++ b/frontend/components/charts/d3LineChart/SingleLineChart.test.tsx @@ -24,10 +24,10 @@ it('renders chart with d3-line-chart svg group', async() => { // render chart with mocked line data const {container} = render(WrappedComponentWithProps( SingleLineChart, { - props: { - data: mockLineData - } - })) + props: { + data: mockLineData + } + })) // wait for root svg element const svg = await screen.findByTestId('d3-line-chart') diff --git a/frontend/components/charts/d3LineChart/drawLineChart.tsx b/frontend/components/charts/d3LineChart/drawLineChart.tsx index 6ff52efe1..a35bce646 100644 --- a/frontend/components/charts/d3LineChart/drawLineChart.tsx +++ b/frontend/components/charts/d3LineChart/drawLineChart.tsx @@ -125,12 +125,12 @@ export default function drawLineChart(props: LineChartConfig) { lineGroup.selectAll('.line') .data([data]) .join('path') - .attr('class','line') - .attr('d',d=>generateScaledLine(d as any)) - .attr('fill','none') - .attr('stroke', strokeColor) - .attr('stroke-width', 2) - .attr('stroke-opacity', 0.7) + .attr('class','line') + .attr('d',d=>generateScaledLine(d as any)) + .attr('fill','none') + .attr('stroke', strokeColor) + .attr('stroke-width', 2) + .attr('stroke-opacity', 0.7) return true } diff --git a/frontend/components/cookies/CookieConsentMatomo.tsx b/frontend/components/cookies/CookieConsentMatomo.tsx index 537eecdd5..77b78d1e8 100644 --- a/frontend/components/cookies/CookieConsentMatomo.tsx +++ b/frontend/components/cookies/CookieConsentMatomo.tsx @@ -62,17 +62,17 @@ export default function CookieConsentMatomo({matomo, route}: CookieConsentMatomo data-testid="cookie-consent-matomo" >

-
-
- -
- We use  - - +
+
+ +
+ We use  + + cookies - - with  + + with  matomo.org to provide a better user experience. diff --git a/frontend/components/feedback/FeedbackPanelButton.tsx b/frontend/components/feedback/FeedbackPanelButton.tsx index 57b6b872d..4802c07b0 100644 --- a/frontend/components/feedback/FeedbackPanelButton.tsx +++ b/frontend/components/feedback/FeedbackPanelButton.tsx @@ -94,7 +94,7 @@ User Agent: ${navigator.userAgent}` className="placeholder:text-base-500 outline-0 p-2 w-full h-28 text-sm bg-base-700 text-base-100 border border-base-600 rounded" placeholder="Ideas on how to improve this page or report an issue?" value={text} onChange={e => setText(e.target.value)}> - + {/* Location URL */}
diff --git a/frontend/components/form/ControlledSlugTextField.tsx b/frontend/components/form/ControlledSlugTextField.tsx index 68f1087c3..f68075638 100644 --- a/frontend/components/form/ControlledSlugTextField.tsx +++ b/frontend/components/form/ControlledSlugTextField.tsx @@ -75,7 +75,7 @@ export default function ControlledSlugTextField({
- : null + : null ) }} error={error ? true: false} diff --git a/frontend/components/form/MarkdownInputWithPreview.tsx b/frontend/components/form/MarkdownInputWithPreview.tsx index 5d81371c6..6407ba908 100644 --- a/frontend/components/form/MarkdownInputWithPreview.tsx +++ b/frontend/components/form/MarkdownInputWithPreview.tsx @@ -71,17 +71,17 @@ export default function MarkdownInputWithPreview({markdown, register, disabled = function getHelperTextMsg() { if (helperInfo) if (helperInfo?.length > helperInfo.maxLength) { - return ( -
- {helperInfo?.length || 0}/{helperInfo?.maxLength} -
- ) - } else { - return ( -
- {helperInfo?.length || 0}/{helperInfo.maxLength} -
- ) + return ( +
+ {helperInfo?.length || 0}/{helperInfo?.maxLength} +
+ ) + } else { + return ( +
+ {helperInfo?.length || 0}/{helperInfo.maxLength} +
+ ) } return null } diff --git a/frontend/components/form/SlugTextField.tsx b/frontend/components/form/SlugTextField.tsx index 96cd2f7ea..ab519001b 100644 --- a/frontend/components/form/SlugTextField.tsx +++ b/frontend/components/form/SlugTextField.tsx @@ -58,7 +58,7 @@ export default function SlugTextField({
- : null + : null ) }} {...options} diff --git a/frontend/components/home/helmholtz/index.tsx b/frontend/components/home/helmholtz/index.tsx index 7125fe819..051afc6c5 100644 --- a/frontend/components/home/helmholtz/index.tsx +++ b/frontend/components/home/helmholtz/index.tsx @@ -78,19 +78,19 @@ function LatestSpotlight({name, description, image, link}: {name:string, description:string, image:string, link: string}) { return( -
-
- {name} -
-
-
{name}
-

{description}

+
+
+ {name} +
+
+
{name}
+

{description}

+
-
- + ) } @@ -193,28 +193,28 @@ function clearBackgroundImage(event: React.MouseEvent) { function ParticipatingOrganisations({organisations}:{organisations:OrganisationForOverview[]}) { return (
-
- { - organisations.map(item => { - return( - - {item.name} - - ) - }) - } +
+ { + organisations.map(item => { + return( + + {item.name} + + ) + }) + }
+
- + - {/* Head and claim */} -
-
-
- -
Research for grand challenges.
- {/* + {/* Head and claim */} +
+
+ -
-

Promote and Discover
Research Software

-
Because software matters
-
+
+
+

Promote and Discover
Research Software

+
Because software matters
+
- {/* Software spotlights */} -
-

Software Spotlights

-
Outstanding software products of the Helmholtz community
-
- -
- -
+ {/* Software spotlights */} +
+

Software Spotlights

+
Outstanding software products of the Helmholtz community
+
+ +
+ +
Browse software -
- -
+
+
+
- {/* Software meta repository */} -
-
-

Discover by research topic

- {/*
Browse Software by Research Topic
*/} - -
+ {/* Software meta repository */} +
+
+

Discover by research topic

+ {/*
Browse Software by Research Topic
*/} +
+
- {/* Teaser */} -
-
-
-

Upcoming

-
This service is in active development. Upcoming features include:
-
-
Login with your Helmholtz Institution's account
-
Add your own software products
-
Add related projects, funding and institutions
-
Obtain a free license consultation from HIFIS
-
-
Do you have suggestions for improvements or new features?
-
Please let us know! Send us an e-mail, or open an issue in our GitHub repository.
+ {/* Teaser */} +
+
+
+

Upcoming

+
This service is in active development. Upcoming features include:
+
+
Login with your Helmholtz Institution's account
+
Add your own software products
+
Add related projects, funding and institutions
+
Obtain a free license consultation from HIFIS
-
+
Do you have suggestions for improvements or new features?
+
Please let us know! Send us an e-mail, or open an issue in our GitHub repository.
+
+
- {/* Participating organsiations */} -
-
-

Participating organisations

- -
+ {/* Participating organsiations */} +
+
+

Participating organisations

+
+
- {/* For RSEs and Researchers */} - {/*
+ {/* For RSEs and Researchers */} + {/*

For RSEs and Researchers

A place for Research Software that is being developed in the Helmholtz Association.
@@ -408,8 +408,8 @@ export default function HelmholtzHome() {
*/} - -
+ +
) } diff --git a/frontend/components/home/rsd/index.tsx b/frontend/components/home/rsd/index.tsx index 5d1901bd7..5eda8d584 100644 --- a/frontend/components/home/rsd/index.tsx +++ b/frontend/components/home/rsd/index.tsx @@ -46,7 +46,7 @@ function GlowingButton({text,url,target='_self',minWidth='9rem'}: {text: string, className="flex gap-4 cursor-pointer" target={target} passHref - > + >
@@ -86,16 +86,16 @@ export default function RsdHome({software_cnt, project_cnt, organisation_cnt, co
{/* Jumbo Text*/}

Show your research software to the world

The + className="text-transparent font-medium bg-clip-text bg-gradient-to-tr from-[#03A9F1] to-[#09FBD3] px-1"> Research Software Directory - + is designed to show the impact research software has on research and society. We stimulate the reuse of research software and encourage proper citation of research software to ensure researchers and RSEs get credit for their work. {/*Learn more.*/} @@ -151,12 +151,12 @@ export default function RsdHome({software_cnt, project_cnt, organisation_cnt, co id="get-started" className="px-5 md:px-10 py-5 ">

+ data-aos="fade" data-aos-duration="400" data-aos-easing="ease-in-out"> {/* eslint-disable-next-line react/no-unescaped-entities */} Let's get started!

+ data-aos-delay="100" data-aos-duration="400" data-aos-easing="ease-in-out"> Discover research software relevant to your research!
Get more information on how to add your own software or organization.

@@ -267,11 +267,11 @@ export default function RsdHome({software_cnt, project_cnt, organisation_cnt, co

+ data-aos="fade" data-aos-duration="400" data-aos-easing="ease-in-out"> Learn more

+ data-aos-delay="100" data-aos-duration="400" data-aos-easing="ease-in-out"> Try out our online demo, or get more detailed information in our documentation and FAQ.

@@ -279,7 +279,7 @@ export default function RsdHome({software_cnt, project_cnt, organisation_cnt, co
+ data-aos-easing="ease-in-out">
+ data-aos-delay="100" + data-aos-easing="ease-in-out">
+ data-aos-delay="200" + data-aos-easing="ease-in-out">

+ data-aos="fade" data-aos-duration="400" data-aos-easing="ease-in-out"> {/* eslint-disable-next-line react/no-unescaped-entities */} About us

+ data-aos-delay="100" data-aos-duration="400" data-aos-easing="ease-in-out"> The Research Software Directory is an open source project initiated by the Netherlands eScience Center and jointly developed with Helmholtz. Feel free to contact us or join our effort! @@ -331,7 +331,7 @@ export default function RsdHome({software_cnt, project_cnt, organisation_cnt, co

+ data-aos-duration="500" data-aos-easing="ease-in-out"> {host.email &&
+ data-aos-easing="ease-in-out"> }
+ data-aos-duration="500" data-aos-easing="ease-in-out"> + > + /> ) } diff --git a/frontend/components/icons/DownloadsIcon.tsx b/frontend/components/icons/DownloadsIcon.tsx index cb6a248ed..e52e1777e 100644 --- a/frontend/components/icons/DownloadsIcon.tsx +++ b/frontend/components/icons/DownloadsIcon.tsx @@ -13,15 +13,15 @@ export default function DownloadsIcon() { viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" - > + > + /> + /> ) } diff --git a/frontend/components/icons/MentionIcon.tsx b/frontend/components/icons/MentionIcon.tsx index 736e06e14..e056e6c61 100644 --- a/frontend/components/icons/MentionIcon.tsx +++ b/frontend/components/icons/MentionIcon.tsx @@ -13,11 +13,11 @@ export default function MentionIcon() { viewBox="0 0 14 10" fill="none" xmlns="http://www.w3.org/2000/svg" - > + > + /> ) } diff --git a/frontend/components/layout/ConfirmDeleteModal.tsx b/frontend/components/layout/ConfirmDeleteModal.tsx index 81c134b0e..746968700 100644 --- a/frontend/components/layout/ConfirmDeleteModal.tsx +++ b/frontend/components/layout/ConfirmDeleteModal.tsx @@ -57,39 +57,39 @@ export default function ConfirmDeleteModal({ /> {title} - -
- {body} -
-
- - - + - + + ) diff --git a/frontend/components/layout/FlexibleGridSection.tsx b/frontend/components/layout/FlexibleGridSection.tsx index d743cd01e..6effbf920 100644 --- a/frontend/components/layout/FlexibleGridSection.tsx +++ b/frontend/components/layout/FlexibleGridSection.tsx @@ -49,30 +49,30 @@ export const FlexibleGridSection = styled('section', { }) (({theme, minWidth, maxWidth, minHeight, maxHeight, height}) => { // basic definitions - const props: any = { - flex: 1, - display: 'grid', - width: '100%', - // gridGap: '1rem', - flexWrap: 'wrap', - // padding: '1rem 0rem 1rem 0rem', - alignItems: 'stretch', + const props: any = { + flex: 1, + display: 'grid', + width: '100%', + // gridGap: '1rem', + flexWrap: 'wrap', + // padding: '1rem 0rem 1rem 0rem', + alignItems: 'stretch', // borderBottom: `1px solid ${theme.palette.divider}`, // backgroundColor: theme.palette.background.paper, // overflow: 'auto' - } - if (height) { + } + if (height) { // dynamic grid-auto-rows - props['gridAutoRows'] = height - }else if (minHeight && maxHeight) { + props['gridAutoRows'] = height + }else if (minHeight && maxHeight) { // dynamic grid-auto-rows - props['gridTemplateRows'] = `repeat(auto-fit,minmax(${minHeight ?? '5rem'}, ${maxHeight ?? '7rem'}))` - } - // dynamic grid-template-columns - if (minWidth && maxWidth) { - props['gridTemplateColumns'] = `repeat(auto-fit, minmax(${minWidth}, ${maxWidth ?? '7rem'}))` - } - return props -}) + props['gridTemplateRows'] = `repeat(auto-fit,minmax(${minHeight ?? '5rem'}, ${maxHeight ?? '7rem'}))` + } + // dynamic grid-template-columns + if (minWidth && maxWidth) { + props['gridTemplateColumns'] = `repeat(auto-fit, minmax(${minWidth}, ${maxWidth ?? '7rem'}))` + } + return props + }) export default FlexibleGridSection diff --git a/frontend/components/layout/ImageAsBackground.tsx b/frontend/components/layout/ImageAsBackground.tsx index 8bb9183ab..31c6340be 100644 --- a/frontend/components/layout/ImageAsBackground.tsx +++ b/frontend/components/layout/ImageAsBackground.tsx @@ -19,7 +19,7 @@ type ImageAsBackgroundProps = { export default function ImageAsBackground( {src, alt, className, bgSize = 'cover', bgPosition = 'center center', - noImgMsg = 'no image avaliable'}: ImageAsBackgroundProps + noImgMsg = 'no image avaliable'}: ImageAsBackgroundProps ) { if (!src) { diff --git a/frontend/components/layout/SortableListItemActions.tsx b/frontend/components/layout/SortableListItemActions.tsx index 610c94013..cf918ecd6 100644 --- a/frontend/components/layout/SortableListItemActions.tsx +++ b/frontend/components/layout/SortableListItemActions.tsx @@ -43,16 +43,16 @@ export default function SortableListItemActions({pos,listeners,onEdit,onDelete}: if (typeof onDelete !== 'undefined') { return ( { - onDelete(pos) - }} - sx={{marginRight: '1rem'}} - > - - + title="Delete" + edge="end" + aria-label="delete" + onClick={() => { + onDelete(pos) + }} + sx={{marginRight: '1rem'}} + > + + ) } return null diff --git a/frontend/components/layout/TagChipFilter.tsx b/frontend/components/layout/TagChipFilter.tsx index 741fa65c0..2cc87e1c5 100644 --- a/frontend/components/layout/TagChipFilter.tsx +++ b/frontend/components/layout/TagChipFilter.tsx @@ -17,23 +17,23 @@ export default function TagChipFilter({url, label, title}: href={url} passHref > - } - clickable - sx={{ - maxWidth: '19rem', - borderRadius: '0.125rem', - textTransform: 'capitalize', - '& .MuiChip-icon': { - order: 1, - margin:'0rem 0.5rem 0rem 0rem', - height: '1.125rem', - width: '1.125rem' - } - }} - /> + } + clickable + sx={{ + maxWidth: '19rem', + borderRadius: '0.125rem', + textTransform: 'capitalize', + '& .MuiChip-icon': { + order: 1, + margin:'0rem 0.5rem 0rem 0rem', + height: '1.125rem', + width: '1.125rem' + } + }} + /> ) } diff --git a/frontend/components/mention/EditMentionModal.test.tsx b/frontend/components/mention/EditMentionModal.test.tsx index 3d5768d5f..d1e95d736 100644 --- a/frontend/components/mention/EditMentionModal.test.tsx +++ b/frontend/components/mention/EditMentionModal.test.tsx @@ -93,7 +93,7 @@ it('calls onSave when minimum info provided', async () => { }) fireEvent.change(title, {target: {value: expectedItem.title}}) - // select wrapper/group + // select wrapper/group const selectGroup = screen.getByTestId('controlled-select') expect(selectGroup).toBeInTheDocument() diff --git a/frontend/components/mention/EditMentionModal.tsx b/frontend/components/mention/EditMentionModal.tsx index 8b09d6194..0c5276213 100644 --- a/frontend/components/mention/EditMentionModal.tsx +++ b/frontend/components/mention/EditMentionModal.tsx @@ -96,7 +96,7 @@ export default function EditMentionModal({open, onCancel, onSubmit, item, pos, t } return ( - - {/* Import publications using DOI list */} + {/* Import publications using DOI list */} Import up to {config.doiInput.maxRows} publications providing a list of DOI's. All metadata will be imported automatically. { children } diff --git a/frontend/components/mention/ImportMentions/ImportReportBody.tsx b/frontend/components/mention/ImportMentions/ImportReportBody.tsx index 27b2ef7ca..ea818ac0e 100644 --- a/frontend/components/mention/ImportMentions/ImportReportBody.tsx +++ b/frontend/components/mention/ImportMentions/ImportReportBody.tsx @@ -130,7 +130,7 @@ export default function ImportReportBody({initialResults,onCancel,onImport}: Bul {result.mention.doi} - : {result.doi} + : {result.doi} } secondary={ result?.mention ? diff --git a/frontend/components/mention/ImportMentions/index.tsx b/frontend/components/mention/ImportMentions/index.tsx index 590f25bb9..1c558eb03 100644 --- a/frontend/components/mention/ImportMentions/index.tsx +++ b/frontend/components/mention/ImportMentions/index.tsx @@ -39,8 +39,8 @@ export default function ImportMentions({table, entityId, onSuccess}:ImportMentio const {token} = useSession() const {showErrorMessage,showSuccessMessage} = useSnackbar() const smallScreen = useMediaQuery('(max-width:768px)') - const [dialogOpen, setDialogOpen] = useState(false) - const [searchResults, setSearchResults] = useState(null) + const [dialogOpen, setDialogOpen] = useState(false) + const [searchResults, setSearchResults] = useState(null) function entityName(): string { switch (table) { @@ -109,7 +109,7 @@ export default function ImportMentions({table, entityId, onSuccess}:ImportMentio } } - return ( + return ( <> - + + ) diff --git a/frontend/components/organisation/metadata/OrganisationLogo.tsx b/frontend/components/organisation/metadata/OrganisationLogo.tsx index ee10768de..19f4cfa31 100644 --- a/frontend/components/organisation/metadata/OrganisationLogo.tsx +++ b/frontend/components/organisation/metadata/OrganisationLogo.tsx @@ -123,7 +123,7 @@ export default function OrganisationLogo({isMaintainer}:OrganisationLogoProps) { objectPosition: 'center' } }} - /> + /> {isMaintainer && { // validate patchProject fn is called with expected params expect(mockPatchProjectForOrganisation).toBeCalledTimes(1) expect(mockPatchProjectForOrganisation).toBeCalledWith({ - 'data': { - 'is_featured': true, - }, - 'organisation': mockProps.organisation.id, - 'project': mockProjects[0].id, - 'token': mockSession.token, + 'data': { + 'is_featured': true, + }, + 'organisation': mockProps.organisation.id, + 'project': mockProjects[0].id, + 'token': mockSession.token, }) }) @@ -181,12 +181,12 @@ describe('frontend/components/organisation/projects/index.tsx', () => { // validate patchProject fn is called with expected params expect(mockPatchProjectForOrganisation).toBeCalledTimes(1) expect(mockPatchProjectForOrganisation).toBeCalledWith({ - 'data': { - 'is_featured': false, - }, - 'organisation': mockProps.organisation.id, - 'project': mockProjects[0].id, - 'token': mockSession.token, + 'data': { + 'is_featured': false, + }, + 'organisation': mockProps.organisation.id, + 'project': mockProjects[0].id, + 'token': mockSession.token, }) }) @@ -223,12 +223,12 @@ describe('frontend/components/organisation/projects/index.tsx', () => { // validate patchProject fn is called with expected params expect(mockPatchProjectForOrganisation).toBeCalledTimes(1) expect(mockPatchProjectForOrganisation).toBeCalledWith({ - 'data': { - 'status': 'rejected_by_relation' - }, - 'organisation': mockProps.organisation.id, - 'project': mockProjects[1].id, - 'token': mockSession.token, + 'data': { + 'status': 'rejected_by_relation' + }, + 'organisation': mockProps.organisation.id, + 'project': mockProjects[1].id, + 'token': mockSession.token, }) }) @@ -266,12 +266,12 @@ describe('frontend/components/organisation/projects/index.tsx', () => { // validate patchProject fn is called with expected params expect(mockPatchProjectForOrganisation).toBeCalledTimes(1) expect(mockPatchProjectForOrganisation).toBeCalledWith({ - 'data': { - 'status': 'approved' - }, - 'organisation': mockProps.organisation.id, - 'project': mockProjects[1].id, - 'token': mockSession.token, + 'data': { + 'status': 'approved' + }, + 'organisation': mockProps.organisation.id, + 'project': mockProjects[1].id, + 'token': mockSession.token, }) }) diff --git a/frontend/components/organisation/releases/ReleaseItem.tsx b/frontend/components/organisation/releases/ReleaseItem.tsx index 81d82a4d0..a78223e82 100644 --- a/frontend/components/organisation/releases/ReleaseItem.tsx +++ b/frontend/components/organisation/releases/ReleaseItem.tsx @@ -20,24 +20,24 @@ function LinkToVersionDoi({tag,doi}:{tag: string | null,doi:string|null}) { target="_blank" passHref > - } - size="small" - clickable - sx={{ - maxWidth: '15rem', - borderRadius: '0rem 0.5rem', - // textTransform: 'capitalize', - '& .MuiChip-icon': { - order: 1, - margin:'0rem 0.25rem 0rem 0rem', - height: '1rem', - width: '1rem' - } - }} - /> + } + size="small" + clickable + sx={{ + maxWidth: '15rem', + borderRadius: '0rem 0.5rem', + // textTransform: 'capitalize', + '& .MuiChip-icon': { + order: 1, + margin:'0rem 0.25rem 0rem 0rem', + height: '1rem', + width: '1rem' + } + }} + /> ) } @@ -80,7 +80,7 @@ export default function ReleaseItem({release}: { release: SoftwareReleaseInfo }) month: 'short', year: 'numeric' }) - : 'Release date unknown' + : 'Release date unknown' }
diff --git a/frontend/components/organisation/settings/about-page/index.tsx b/frontend/components/organisation/settings/about-page/index.tsx index caf657923..85cd7a2f6 100644 --- a/frontend/components/organisation/settings/about-page/index.tsx +++ b/frontend/components/organisation/settings/about-page/index.tsx @@ -33,23 +33,23 @@ export default function AboutPageSettings() { type="section" > -
- {/* hidden inputs */} - - - - +
+ {/* hidden inputs */} + + + +
) diff --git a/frontend/components/organisation/settings/general/index.tsx b/frontend/components/organisation/settings/general/index.tsx index f5621f024..23d86f426 100644 --- a/frontend/components/organisation/settings/general/index.tsx +++ b/frontend/components/organisation/settings/general/index.tsx @@ -40,67 +40,67 @@ export default function OrganisationGeneralSettings() { type="section" > -
- {/* hidden inputs */} - - + + {/* hidden inputs */} + + -

General settings

+

General settings

- + -
- -
-
+
+
+
+ - -
-
- {/* RSD admin section */} - {user?.role === 'rsd_admin' ? - - : null - } - + +
+
+ {/* RSD admin section */} + {user?.role === 'rsd_admin' ? + + : null + } +
) diff --git a/frontend/components/organisation/settings/maintainers/OrganisationMaintainerLink.tsx b/frontend/components/organisation/settings/maintainers/OrganisationMaintainerLink.tsx index 63f1241bc..64f297103 100644 --- a/frontend/components/organisation/settings/maintainers/OrganisationMaintainerLink.tsx +++ b/frontend/components/organisation/settings/maintainers/OrganisationMaintainerLink.tsx @@ -80,11 +80,11 @@ export default function OrganisationMaintainerLink({organisation, name, account,
@@ -95,20 +95,20 @@ export default function OrganisationMaintainerLink({organisation, name, account, return ( <> - -
- {renderLinkOptions()} - fetchUnusedInvitations()}/> + +
+ {renderLinkOptions()} + fetchUnusedInvitations()}/> ) } diff --git a/frontend/components/organisation/settings/updateOrganisationSettings.tsx b/frontend/components/organisation/settings/updateOrganisationSettings.tsx index 19272df42..326fc3175 100644 --- a/frontend/components/organisation/settings/updateOrganisationSettings.tsx +++ b/frontend/components/organisation/settings/updateOrganisationSettings.tsx @@ -9,7 +9,7 @@ export async function patchOrganisationTable({id, data, token}: {id:string, data: any, token: string }) { try { // extract only required items - const url = `/api/v1/organisation?id=eq.${id}` + const url = `/api/v1/organisation?id=eq.${id}` const resp = await fetch(url, { method: 'PATCH', headers: { diff --git a/frontend/components/organisation/units/ResearchUnitItem.tsx b/frontend/components/organisation/units/ResearchUnitItem.tsx index 29e25bd2f..a6b6d4a78 100644 --- a/frontend/components/organisation/units/ResearchUnitItem.tsx +++ b/frontend/components/organisation/units/ResearchUnitItem.tsx @@ -122,7 +122,7 @@ export default function UnitItem({pos,slug,name,website,logo_id,isMaintainer,onE } secondary={getSecondaryLabel()} - /> - + /> + ) } diff --git a/frontend/components/organisation/units/ResearchUnitList.tsx b/frontend/components/organisation/units/ResearchUnitList.tsx index 6d73e144a..cf141e6a1 100644 --- a/frontend/components/organisation/units/ResearchUnitList.tsx +++ b/frontend/components/organisation/units/ResearchUnitList.tsx @@ -36,8 +36,8 @@ export default function ResearchUnitsList({loading, units, onEdit, isPrimaryMain The organisation has no research units { isPrimaryMaintainer ? - Add one using ADD button! - :null + Add one using ADD button! + :null } ) @@ -48,19 +48,19 @@ export default function ResearchUnitsList({loading, units, onEdit, isPrimaryMain width: '100%', }}> { units.map((item,pos) => { - return ( - - ) - }) + return ( + + ) + }) } ) diff --git a/frontend/components/organisation/units/ResearchUnitModal.tsx b/frontend/components/organisation/units/ResearchUnitModal.tsx index 372c4cd78..85db0198d 100644 --- a/frontend/components/organisation/units/ResearchUnitModal.tsx +++ b/frontend/components/organisation/units/ResearchUnitModal.tsx @@ -71,7 +71,7 @@ export default function ResearchUnitModal({ // console.groupEnd() useEffect(() => { - if (typeof location != 'undefined') { + if (typeof location != 'undefined') { const baseUrl = location.href.split('?') // baseUrl is current location without params setBaseUrl(`${baseUrl[0]}/`) @@ -156,7 +156,7 @@ export default function ResearchUnitModal({ } return ( -
-
+
+ ) } diff --git a/frontend/components/projects/edit/impact/EditProjectImpactIndex.test.tsx b/frontend/components/projects/edit/impact/EditProjectImpactIndex.test.tsx index 57511e1f2..86d108856 100644 --- a/frontend/components/projects/edit/impact/EditProjectImpactIndex.test.tsx +++ b/frontend/components/projects/edit/impact/EditProjectImpactIndex.test.tsx @@ -157,9 +157,9 @@ describe('frontend/components/project/edit/impact/index.tsx', () => { // call RSD api to find mention by DOI expect(mockFindPublicationByTitle).toBeCalledTimes(1) expect(mockFindPublicationByTitle).toBeCalledWith({ - 'project': projectState.project.id, - searchFor, - 'token': mockSession.token + 'project': projectState.project.id, + searchFor, + 'token': mockSession.token }) }) }) @@ -229,23 +229,23 @@ describe('frontend/components/project/edit/impact/index.tsx', () => { await waitFor(() => { expect(mockAddNewImpactToProject).toBeCalledTimes(1) expect(mockAddNewImpactToProject).toBeCalledWith({ - 'item': { - 'authors': null, - 'doi': null, - 'id': null, - 'image_url': null, - 'journal': null, - 'mention_type': 'book', - 'note': null, - 'page': null, - 'publication_year': null, - 'publisher': null, - 'source': 'RSD', - 'title': 'Test value', - 'url': 'https://google.com/link1', - }, - 'project': projectState.project.id, - 'token': mockSession.token, + 'item': { + 'authors': null, + 'doi': null, + 'id': null, + 'image_url': null, + 'journal': null, + 'mention_type': 'book', + 'note': null, + 'page': null, + 'publication_year': null, + 'publisher': null, + 'source': 'RSD', + 'title': 'Test value', + 'url': 'https://google.com/link1', + }, + 'project': projectState.project.id, + 'token': mockSession.token, }) }) }) diff --git a/frontend/components/projects/edit/impact/ImportProjectImpact.tsx b/frontend/components/projects/edit/impact/ImportProjectImpact.tsx index cc5c85b8b..42e363315 100644 --- a/frontend/components/projects/edit/impact/ImportProjectImpact.tsx +++ b/frontend/components/projects/edit/impact/ImportProjectImpact.tsx @@ -27,15 +27,15 @@ export default function ImportProjectImpact() { return ( <> -

{config.builkImport.title}

- -
- -
-
+

{config.builkImport.title}

+ +
+ +
+
) } diff --git a/frontend/components/projects/edit/information/AutosaveFundingOrganisations.test.tsx b/frontend/components/projects/edit/information/AutosaveFundingOrganisations.test.tsx index d0e1866c7..d76da8359 100644 --- a/frontend/components/projects/edit/information/AutosaveFundingOrganisations.test.tsx +++ b/frontend/components/projects/edit/information/AutosaveFundingOrganisations.test.tsx @@ -186,7 +186,7 @@ it('can add funding organisation from ROR', async() => { 'slug': 'vu-university-amsterdam', 'website': foundOrgs[1].data.website }, - 'token': 'TEST_TOKEN', + 'token': 'TEST_TOKEN', }) // add as funding organisations to project diff --git a/frontend/components/projects/edit/information/AutosaveFundingOrganisations.tsx b/frontend/components/projects/edit/information/AutosaveFundingOrganisations.tsx index b3ac2815f..78b6cdf75 100644 --- a/frontend/components/projects/edit/information/AutosaveFundingOrganisations.tsx +++ b/frontend/components/projects/edit/information/AutosaveFundingOrganisations.tsx @@ -108,21 +108,21 @@ export default function AutosaveFundingOrganisations({id,items}:FundingOrganisat <>

{config.funding_organisations.subtitle}

- {organisations.map((item, pos) => { - return( -
- onRemoveOgranisation(pos)} - /> -
- ) - })} + {organisations.map((item, pos) => { + return( +
+ onRemoveOgranisation(pos)} + /> +
+ ) + })}
{ expect(mockPatchProjectTable).toBeCalledWith({ 'data': { 'image_id': null, - }, + }, 'id': projectState.project.id, 'token': mockSession.token, }) diff --git a/frontend/components/projects/edit/information/AutosaveProjectImage.tsx b/frontend/components/projects/edit/information/AutosaveProjectImage.tsx index 9ccc5c61a..8c2a372b0 100644 --- a/frontend/components/projects/edit/information/AutosaveProjectImage.tsx +++ b/frontend/components/projects/edit/information/AutosaveProjectImage.tsx @@ -149,49 +149,49 @@ export default function AutosaveProjectImage() { return ( <>
- + }} + /> + +
+ + + +
+
-
- - - +
+
-
- -
- -
) } diff --git a/frontend/components/projects/edit/information/AutosaveProjectKeywords.test.tsx b/frontend/components/projects/edit/information/AutosaveProjectKeywords.test.tsx index e409bb0a3..6e708a7b6 100644 --- a/frontend/components/projects/edit/information/AutosaveProjectKeywords.test.tsx +++ b/frontend/components/projects/edit/information/AutosaveProjectKeywords.test.tsx @@ -107,13 +107,13 @@ it('can add keyword from option list', async() => { await waitFor(() => { expect(mockAddKeywordsToProject).toBeCalledTimes(1) expect(mockAddKeywordsToProject).toBeCalledWith({ - 'data': [ - { - 'keyword': keywords[0].id, - 'project': mockProps.project_id, - }, - ], - 'token': mockSession.token, + 'data': [ + { + 'keyword': keywords[0].id, + 'project': mockProps.project_id, + }, + ], + 'token': mockSession.token, }) }) // wait for keyword chip to be loaded diff --git a/frontend/components/projects/edit/information/AutosaveProjectKeywords.tsx b/frontend/components/projects/edit/information/AutosaveProjectKeywords.tsx index 5e740810f..b17ae7057 100644 --- a/frontend/components/projects/edit/information/AutosaveProjectKeywords.tsx +++ b/frontend/components/projects/edit/information/AutosaveProjectKeywords.tsx @@ -115,24 +115,24 @@ export default function AutosaveProjectKeywords({project_id,items}:ProjectKeywor return ( <>
- {keywords.map((field, pos) => { - return( -
- onRemove(pos)} - sx={{ - textTransform:'capitalize' - }} - /> -
- ) - })} + {keywords.map((field, pos) => { + return( +
+ onRemove(pos)} + sx={{ + textTransform:'capitalize' + }} + /> +
+ ) + })}
item.key === l1Selected.key) - // selected.filter(item => item.key === l1Selected.key) + // selected.filter(item => item.key === l1Selected.key) if (find.length === 0) { toAdd.push(l1Selected) } @@ -211,16 +211,16 @@ export default function AutosaveResearchDomains({project_id, research_domains}: {l1Domains .sort((a,b)=>sortOnStrProp(a,b,'name')) .map(item => { - return ( - - {item.name} - - ) - })} + return ( + + {item.name} + + ) + })}
@@ -252,21 +252,21 @@ export default function AutosaveResearchDomains({project_id, research_domains}: {l2Domains .sort((a,b)=>sortOnStrProp(a,b,'name')) .map(item => { - return ( - - {item.name} - - ) - })} + whiteSpace: 'break-spaces' + }} + > + {item.name} + + ) + })}
@@ -296,22 +296,22 @@ export default function AutosaveResearchDomains({project_id, research_domains}: {l3Domains .sort((a,b)=>sortOnStrProp(a,b,'name')) .map(item => { - return ( - - {item.name} - - ) - })} + whiteSpace: 'break-spaces' + }} + > + {item.name} + + ) + })}
diff --git a/frontend/components/projects/edit/information/ProjectInformationForm.tsx b/frontend/components/projects/edit/information/ProjectInformationForm.tsx index 840d8ab0f..cbf2add03 100644 --- a/frontend/components/projects/edit/information/ProjectInformationForm.tsx +++ b/frontend/components/projects/edit/information/ProjectInformationForm.tsx @@ -48,150 +48,150 @@ export default function ProjectInformationForm({editProject}: { editProject: Edi data-testid="project-information-form" className='flex-1' > - {/* hidden inputs */} - - - {/* middle panel */} -
- - {user?.role === 'rsd_admin' ? - <> -
-
+ {/* right panel */} +
+ + + +
+ - } -
- -
- -
- - - -
-
- {/* right panel */} -
- - - -
- -
- -
-
+ +
+ -
- -
- {/* Project links */} - - {/* */} -
- {/* Research Domain */} - - {/* Keywords */} - - -
-
- - + }} + /> +
+ +
+ {/* Project links */} + + {/* */} +
+ {/* Research Domain */} + + {/* Keywords */} + + +
+
+ + ) diff --git a/frontend/components/projects/edit/information/ProjectLinkModal.tsx b/frontend/components/projects/edit/information/ProjectLinkModal.tsx index 3234effbb..960d9fcbe 100644 --- a/frontend/components/projects/edit/information/ProjectLinkModal.tsx +++ b/frontend/components/projects/edit/information/ProjectLinkModal.tsx @@ -141,48 +141,48 @@ export default function ProjectLinkModal({open, url_for_project, onCancel, onSub width: ['100%', '37rem'], padding: '2rem 1.5rem 2.5rem' }}> - -
- - - +
+ + + - Publishing project page + severity="info" + sx={{ + marginTop:'1rem' + }} + > + Publishing project page Setting the page status to published will expose the project page to all visitors. Unpublished project can be found under - your profile - page. - + your profile + page. + ) } diff --git a/frontend/components/projects/edit/information/SortableProjectLinkItem.tsx b/frontend/components/projects/edit/information/SortableProjectLinkItem.tsx index b07b4da27..708630740 100644 --- a/frontend/components/projects/edit/information/SortableProjectLinkItem.tsx +++ b/frontend/components/projects/edit/information/SortableProjectLinkItem.tsx @@ -16,7 +16,7 @@ type SortableProjectLinkProps = { } export default function SortableProjectLinksItem({pos, item, onEdit, onDelete}: SortableProjectLinkProps) { - return ( + return ( - - - - + > + + + + ) } diff --git a/frontend/components/projects/edit/maintainers/ProjectMaintainerLink.tsx b/frontend/components/projects/edit/maintainers/ProjectMaintainerLink.tsx index 127d9eafc..abcee633a 100644 --- a/frontend/components/projects/edit/maintainers/ProjectMaintainerLink.tsx +++ b/frontend/components/projects/edit/maintainers/ProjectMaintainerLink.tsx @@ -78,11 +78,11 @@ export default function ProjectMaintainerLink({project,title,account,token}: {pr
@@ -93,20 +93,20 @@ export default function ProjectMaintainerLink({project,title,account,token}: {pr return ( <> - -
- {renderLinkOptions()} - fetchUnusedInvitations()}/> + +
+ {renderLinkOptions()} + fetchUnusedInvitations()}/> ) } diff --git a/frontend/components/projects/edit/organisations/EditProjectOrganisationsIndex.test.tsx b/frontend/components/projects/edit/organisations/EditProjectOrganisationsIndex.test.tsx index 42301261b..d7998f3ce 100644 --- a/frontend/components/projects/edit/organisations/EditProjectOrganisationsIndex.test.tsx +++ b/frontend/components/projects/edit/organisations/EditProjectOrganisationsIndex.test.tsx @@ -186,17 +186,17 @@ describe('frontend/components/projects/edit/organisations/index.tsx', () => { // call createOrganisation api expect(mockCreateOrganisation).toBeCalledTimes(1) expect(mockCreateOrganisation).toBeCalledWith({ - 'organisation': { - 'is_tenant': false, - 'logo_id': null, - 'name': searchFor, - 'parent': null, - 'primary_maintainer': null, - 'ror_id': null, - 'slug': expectSlug, - 'website': expectWebsite, - }, - 'token': mockSession.token, + 'organisation': { + 'is_tenant': false, + 'logo_id': null, + 'name': searchFor, + 'parent': null, + 'primary_maintainer': null, + 'ror_id': null, + 'slug': expectSlug, + 'website': expectWebsite, + }, + 'token': mockSession.token, }) }) diff --git a/frontend/components/projects/edit/output/AddOutput.tsx b/frontend/components/projects/edit/output/AddOutput.tsx index 31c4d307b..d220a1655 100644 --- a/frontend/components/projects/edit/output/AddOutput.tsx +++ b/frontend/components/projects/edit/output/AddOutput.tsx @@ -21,17 +21,17 @@ export default function AddOutput() { return ( <> -

{config.newItem.title}

- -
- -
-
+ +
+ ) } diff --git a/frontend/components/projects/edit/output/EditProjectOutputIndex.test.tsx b/frontend/components/projects/edit/output/EditProjectOutputIndex.test.tsx index 0acc3e1f9..0972b7270 100644 --- a/frontend/components/projects/edit/output/EditProjectOutputIndex.test.tsx +++ b/frontend/components/projects/edit/output/EditProjectOutputIndex.test.tsx @@ -157,14 +157,14 @@ describe('frontend/components/projects/edit/output/index.tsx', () => { // call RSD api to find mention by DOI expect(mockFindPublicationByTitle).toBeCalledTimes(1) expect(mockFindPublicationByTitle).toBeCalledWith({ - 'project': editProjectState.project.id, - searchFor, - 'token': mockSession.token + 'project': editProjectState.project.id, + searchFor, + 'token': mockSession.token }) }) }) - it('add custom mention', async() => { + it('add custom mention', async() => { // resolve existing mentions to [] mockGetOutputForProject.mockResolvedValueOnce([]) // resolve search with mockedItems @@ -229,23 +229,23 @@ describe('frontend/components/projects/edit/output/index.tsx', () => { await waitFor(() => { expect(mockAddNewOutputToProject).toBeCalledTimes(1) expect(mockAddNewOutputToProject).toBeCalledWith({ - 'item': { - 'authors': null, - 'doi': null, - 'id': null, - 'image_url': null, - 'journal': null, - 'mention_type': 'book', - 'note': null, - 'page': null, - 'publication_year': null, - 'publisher': null, - 'source': 'RSD', - 'title': 'Test value', - 'url': 'https://google.com/link1', - }, - 'project': editProjectState.project.id, - 'token': mockSession.token, + 'item': { + 'authors': null, + 'doi': null, + 'id': null, + 'image_url': null, + 'journal': null, + 'mention_type': 'book', + 'note': null, + 'page': null, + 'publication_year': null, + 'publisher': null, + 'source': 'RSD', + 'title': 'Test value', + 'url': 'https://google.com/link1', + }, + 'project': editProjectState.project.id, + 'token': mockSession.token, }) }) }) diff --git a/frontend/components/projects/edit/output/FindOutput.tsx b/frontend/components/projects/edit/output/FindOutput.tsx index b92f4f8dd..75e48afb4 100644 --- a/frontend/components/projects/edit/output/FindOutput.tsx +++ b/frontend/components/projects/edit/output/FindOutput.tsx @@ -57,29 +57,29 @@ export default function FindOutput() { return ( <> - -

Search

- -
- -
-
+ /> +

Search

+ +
+ +
+
) } diff --git a/frontend/components/projects/edit/output/ImportProjectOutput.tsx b/frontend/components/projects/edit/output/ImportProjectOutput.tsx index 718528c98..084fe6c45 100644 --- a/frontend/components/projects/edit/output/ImportProjectOutput.tsx +++ b/frontend/components/projects/edit/output/ImportProjectOutput.tsx @@ -28,15 +28,15 @@ export default function ImportProjectOutput() { return ( <> -

{config.builkImport.title}

- -
- -
-
+

{config.builkImport.title}

+ +
+ +
+
) } diff --git a/frontend/components/projects/edit/related/RelatedProjectList.tsx b/frontend/components/projects/edit/related/RelatedProjectList.tsx index 2b2939dda..c6c374fd7 100644 --- a/frontend/components/projects/edit/related/RelatedProjectList.tsx +++ b/frontend/components/projects/edit/related/RelatedProjectList.tsx @@ -100,15 +100,15 @@ export function RelatedProjectItem({project, onDelete}: ProjectItemProps) { data-testid="related-project-item" secondaryAction={ <> - - - - + + + + } sx={{ minHeight:itemHeight, diff --git a/frontend/components/projects/edit/team/AggregatedMemberModal.tsx b/frontend/components/projects/edit/team/AggregatedMemberModal.tsx index 2e8849c40..cbe98a144 100644 --- a/frontend/components/projects/edit/team/AggregatedMemberModal.tsx +++ b/frontend/components/projects/edit/team/AggregatedMemberModal.tsx @@ -120,7 +120,7 @@ export default function AggregatedMemberModal({open, onCancel, onSubmit, member} } return ( -
- + control={control} + options={{ + name: 'given_names', + label: config.given_names.label, + useNull: true, + defaultValue: formData?.given_names, + helperTextMessage: config.given_names.help, + helperTextCnt: `${formData?.given_names?.length || 0}/${config.given_names.validation.maxLength.value}`, + }} + rules={config.given_names.validation} + /> + { await waitFor(() => { expect(mockPostTeamMember).toBeCalledTimes(1) expect(mockPostTeamMember).toBeCalledWith({ - 'member': { - 'affiliation': newPerson.affiliation, - 'avatar_id': null, - 'email_address': newPerson.email, - 'family_names': newPerson.family_names, - 'given_names': newPerson.given_names, - 'id': memberId, - 'is_contact_person': true, - 'orcid': null, - 'position': 1, - 'project': editProjectState.project.id, - 'role': newPerson.role, - }, - 'token': mockSession.token, + 'member': { + 'affiliation': newPerson.affiliation, + 'avatar_id': null, + 'email_address': newPerson.email, + 'family_names': newPerson.family_names, + 'given_names': newPerson.given_names, + 'id': memberId, + 'is_contact_person': true, + 'orcid': null, + 'position': 1, + 'project': editProjectState.project.id, + 'role': newPerson.role, + }, + 'token': mockSession.token, }) }) @@ -282,10 +282,10 @@ describe('frontend/components/projects/edit/team/index.tsx', () => { // validate delete called expect(mockDeleteTeamMemberById).toBeCalledTimes(1) expect(mockDeleteTeamMemberById).toBeCalledWith({ - 'ids': [ - mockTeamMembers[0].id, - ], - 'token': mockSession.token, + 'ids': [ + mockTeamMembers[0].id, + ], + 'token': mockSession.token, }) // confirm member removed from list const remainedMembers = screen.getAllByTestId('team-member-item') diff --git a/frontend/components/projects/edit/team/EditTeamMemberModal.tsx b/frontend/components/projects/edit/team/EditTeamMemberModal.tsx index f8c484b92..c90857fc3 100644 --- a/frontend/components/projects/edit/team/EditTeamMemberModal.tsx +++ b/frontend/components/projects/edit/team/EditTeamMemberModal.tsx @@ -109,7 +109,7 @@ export default function TeamMemberModal({open, onCancel, onSubmit, member, pos}: setRemoveAvatar(formData.avatar_id) // update form setValue('avatar_id', null, {shouldDirty: true,shouldValidate:true}) - } else { + } else { // just remove uploaded image from form // because it is not saved yet to DB setValue('avatar_b64', null) @@ -179,7 +179,7 @@ export default function TeamMemberModal({open, onCancel, onSubmit, member, pos}: } return ( - + > No team members Add team member using the search form! - ) - } + ) + } function onEditMember(pos: number) { const member = members[pos] diff --git a/frontend/components/search/SearchContext.tsx b/frontend/components/search/SearchContext.tsx index d3de810c0..b31702c54 100644 --- a/frontend/components/search/SearchContext.tsx +++ b/frontend/components/search/SearchContext.tsx @@ -68,8 +68,8 @@ export function SearchProvider(props:any) { setDelay, setSearchInput }} - // we pass children etc... - {...props} + // we pass children etc... + {...props} /> } diff --git a/frontend/components/snackbar/MuiSnackbarProvider.tsx b/frontend/components/snackbar/MuiSnackbarProvider.tsx index f9a9320a0..81293f967 100644 --- a/frontend/components/snackbar/MuiSnackbarProvider.tsx +++ b/frontend/components/snackbar/MuiSnackbarProvider.tsx @@ -15,13 +15,13 @@ export default function MuiSnackbarProvider(props:any) { // console.groupEnd() return ( <> - + ) diff --git a/frontend/components/software/AboutLanguages.tsx b/frontend/components/software/AboutLanguages.tsx index 8cdece63e..dc4819995 100644 --- a/frontend/components/software/AboutLanguages.tsx +++ b/frontend/components/software/AboutLanguages.tsx @@ -93,16 +93,16 @@ export default function AboutLanguages({languages, platform}: return ( <> -
- - {label} -
-
    - {/* show only stat selection pct > 0 and exclude other category */} - {stats?.map((props) => { - return - })} -
+
+ + {label} +
+
    + {/* show only stat selection pct > 0 and exclude other category */} + {stats?.map((props) => { + return + })} +
) } diff --git a/frontend/components/software/AboutLicense.tsx b/frontend/components/software/AboutLicense.tsx index 70fa8d64e..5d81d1cb5 100644 --- a/frontend/components/software/AboutLicense.tsx +++ b/frontend/components/software/AboutLicense.tsx @@ -22,11 +22,11 @@ export default function AboutLicense({license}:{license:string[]}) { return ( <> -
+
- License -
- {renderLicenses()} + License +
+ {renderLicenses()} ) } diff --git a/frontend/components/software/AboutSourceCode.tsx b/frontend/components/software/AboutSourceCode.tsx index 7152897b1..3f134b4c6 100644 --- a/frontend/components/software/AboutSourceCode.tsx +++ b/frontend/components/software/AboutSourceCode.tsx @@ -48,13 +48,13 @@ export default function AboutSourceCode({repository,platform}: { repository: str return ( <> -
- {code} - Source code -
-
- {getIcon()} -
+
+ {code} + Source code +
+
+ {getIcon()} +
) } diff --git a/frontend/components/software/CitationDoi.tsx b/frontend/components/software/CitationDoi.tsx index 7d52d5154..ad229a38e 100644 --- a/frontend/components/software/CitationDoi.tsx +++ b/frontend/components/software/CitationDoi.tsx @@ -53,7 +53,7 @@ export default function CitationDoi({doi}:{doi:string}) { href={`https://doi.org/${doi}`} target="_blank" className="w-full" - > + >
-
-

+
+

Cite this software -

- { - versions?.length > 0 ? - - :null - } -
-
- - {/* NOTE! temporarly dissabled */} - -
+

+ { + versions?.length > 0 ? + + :null + } +
+
+ + {/* NOTE! temporarly dissabled */} + +
diff --git a/frontend/components/software/MentionsSection.test.tsx b/frontend/components/software/MentionsSection.test.tsx index f184675ec..d47e69290 100644 --- a/frontend/components/software/MentionsSection.test.tsx +++ b/frontend/components/software/MentionsSection.test.tsx @@ -19,7 +19,7 @@ it('should NOT render mentions section when no data provided',()=>{ it('should render mention section title when data provided',()=>{ render(WrappedComponentWithProps(MentionsSection, { props:{mentions: mentionsData} -})) + })) const title = screen.queryByTestId('software-mentions-section-title') expect(title).toBeInTheDocument() // screen.debug() diff --git a/frontend/components/software/MentionsSection.tsx b/frontend/components/software/MentionsSection.tsx index 5f4ff4358..55eab2055 100644 --- a/frontend/components/software/MentionsSection.tsx +++ b/frontend/components/software/MentionsSection.tsx @@ -28,39 +28,39 @@ export default function SoftwareMentionsSection({mentions}: { mentions: MentionF
-

+

Mentions -

-
- {featuredMentions - .sort((a,b)=>sortOnNumProp(a,b,'publication_year','desc')) - .map(item => { - return ( - - ) - })} - {/* render output by type */} - {mentionTypes.map((key) => { - const type = key as MentionTypeKeys - const items = mentionByType[type]?.sort((a, b) => { + +
+ {featuredMentions + .sort((a,b)=>sortOnNumProp(a,b,'publication_year','desc')) + .map(item => { + return ( + + ) + })} + {/* render output by type */} + {mentionTypes.map((key) => { + const type = key as MentionTypeKeys + const items = mentionByType[type]?.sort((a, b) => { // sort mentions on date, newest at the top - return sortOnNumProp(a,b,'publication_year','desc') - }) - const title = getMentionType(type,'plural') - return ( - - ) - })} + return sortOnNumProp(a,b,'publication_year','desc') + }) + const title = getMentionType(type,'plural') + return ( + + ) + })}
- - + +
) } diff --git a/frontend/components/software/SoftwareKeywords.tsx b/frontend/components/software/SoftwareKeywords.tsx index 4f6f43174..16d9fb563 100644 --- a/frontend/components/software/SoftwareKeywords.tsx +++ b/frontend/components/software/SoftwareKeywords.tsx @@ -28,11 +28,11 @@ export default function SoftwareKeywords({keywords = []}: { keywords: KeywordFor return ( <> -
- - Keywords -
- {renderTags()} +
+ + Keywords +
+ {renderTags()} ) } diff --git a/frontend/components/software/SoftwareLogo.tsx b/frontend/components/software/SoftwareLogo.tsx index 091ee88bb..b3adfd054 100644 --- a/frontend/components/software/SoftwareLogo.tsx +++ b/frontend/components/software/SoftwareLogo.tsx @@ -9,8 +9,8 @@ import {getImageUrl} from '~/utils/editImage' import ImageWithPlaceholder from '../layout/ImageWithPlaceholder' export default function SoftwareLogo( - {image_id, brand_name}: {image_id:string, brand_name:string} - ) { + {image_id, brand_name}: {image_id:string, brand_name:string} +) { const image_path = getImageUrl(image_id) if (image_path !== null ){ diff --git a/frontend/components/software/add/AddSoftwareCard.test.tsx b/frontend/components/software/add/AddSoftwareCard.test.tsx index 9994f3eb8..05d2ec290 100644 --- a/frontend/components/software/add/AddSoftwareCard.test.tsx +++ b/frontend/components/software/add/AddSoftwareCard.test.tsx @@ -15,7 +15,7 @@ import {getSlugFromString} from '../../../utils/getSlugFromString' const mockAddSoftware = jest.fn((props)=>Promise.resolve({status: 201, message: props})) const mockValidSoftwareItem = jest.fn((slug,token) => { // console.log('validProjectItem...props...',slug,token) - return new Promise((res, rej) => { + return new Promise((res, rej) => { setTimeout(() => { res(false) }, 10) diff --git a/frontend/components/software/edit/contributors/AggregatedContributorModal.tsx b/frontend/components/software/edit/contributors/AggregatedContributorModal.tsx index 4c0df6dbc..dee45a1b7 100644 --- a/frontend/components/software/edit/contributors/AggregatedContributorModal.tsx +++ b/frontend/components/software/edit/contributors/AggregatedContributorModal.tsx @@ -117,7 +117,7 @@ export default function AggregatedContributorModal({open, onCancel, onSubmit, co } return ( -
- + control={control} + options={{ + name: 'given_names', + label: config.given_names.label, + useNull: true, + defaultValue: formData?.given_names, + helperTextMessage: config.given_names.help, + helperTextCnt: `${formData?.given_names?.length || 0}/${config.given_names.validation.maxLength.value}`, + }} + rules={config.given_names.validation} + /> +
@@ -95,20 +95,20 @@ export default function SoftwareMaintainerLink({software,brand_name,account,toke return ( <> - -
- {renderLinkOptions()} - fetchUnusedInvitations()}/> + +
+ {renderLinkOptions()} + fetchUnusedInvitations()}/> ) } diff --git a/frontend/components/software/edit/mentions/AddMention.tsx b/frontend/components/software/edit/mentions/AddMention.tsx index 82249061e..7d2b4c93a 100644 --- a/frontend/components/software/edit/mentions/AddMention.tsx +++ b/frontend/components/software/edit/mentions/AddMention.tsx @@ -22,17 +22,17 @@ export default function AddMention() { return ( <> -

{config.newItem.title}

- -
- -
-
+ +
+ ) } diff --git a/frontend/components/software/edit/mentions/EditSoftwareMentionsIndex.test.tsx b/frontend/components/software/edit/mentions/EditSoftwareMentionsIndex.test.tsx index d885749de..6d2559d19 100644 --- a/frontend/components/software/edit/mentions/EditSoftwareMentionsIndex.test.tsx +++ b/frontend/components/software/edit/mentions/EditSoftwareMentionsIndex.test.tsx @@ -170,9 +170,9 @@ describe('frontend/components/software/edit/maintainers/index.tsx', () => { // call RSD api to find mention by DOI expect(mockFindPublicationByTitle).toBeCalledTimes(1) expect(mockFindPublicationByTitle).toBeCalledWith({ - 'software': softwareState.software.id, - searchFor, - 'token': mockSession.token + 'software': softwareState.software.id, + searchFor, + 'token': mockSession.token }) }) }) @@ -242,23 +242,23 @@ describe('frontend/components/software/edit/maintainers/index.tsx', () => { await waitFor(() => { expect(mockAddNewMentionToSoftware).toBeCalledTimes(1) expect(mockAddNewMentionToSoftware).toBeCalledWith({ - 'item': { - 'authors': null, - 'doi': null, - 'id': null, - 'image_url': null, - 'journal': null, - 'mention_type': 'book', - 'note': null, - 'page': null, - 'publication_year': null, - 'publisher': null, - 'source': 'RSD', - 'title': 'Test value', - 'url': 'https://google.com/link1', - }, - 'software': softwareState.software.id, - 'token': mockSession.token, + 'item': { + 'authors': null, + 'doi': null, + 'id': null, + 'image_url': null, + 'journal': null, + 'mention_type': 'book', + 'note': null, + 'page': null, + 'publication_year': null, + 'publisher': null, + 'source': 'RSD', + 'title': 'Test value', + 'url': 'https://google.com/link1', + }, + 'software': softwareState.software.id, + 'token': mockSession.token, }) }) }) diff --git a/frontend/components/software/edit/mentions/ImportSoftwareMentions.tsx b/frontend/components/software/edit/mentions/ImportSoftwareMentions.tsx index 5eadf7907..af1089116 100644 --- a/frontend/components/software/edit/mentions/ImportSoftwareMentions.tsx +++ b/frontend/components/software/edit/mentions/ImportSoftwareMentions.tsx @@ -27,15 +27,15 @@ export default function ImportSoftwareMentions() { return ( <> -

{config.builkImport.title}

- -
- -
-
+

{config.builkImport.title}

+ +
+ +
+
) } diff --git a/frontend/components/software/edit/organisations/EditOrganisationModal.tsx b/frontend/components/software/edit/organisations/EditOrganisationModal.tsx index 1c53256dc..726356936 100644 --- a/frontend/components/software/edit/organisations/EditOrganisationModal.tsx +++ b/frontend/components/software/edit/organisations/EditOrganisationModal.tsx @@ -133,7 +133,7 @@ export default function EditOrganisationModal({open, onCancel, onSubmit, organis } return ( -
-
+
- Do you have a logo? + severity="info" + > + Do you have a logo? You are the first to reference this organisation and can add a logo now. After clicking on "Save", logos can only by added by organisation maintainers. - + { const mockId = 'mocked-organisation-id' // resolve createOrganisation api call mockResolvedValueOnce({ - message: 'new-organisation-id' - },{ + message: 'new-organisation-id' + },{ status: 201, headers: { get: () => `a.${mockId}` diff --git a/frontend/components/software/edit/package-managers/PackageManagerInfo.tsx b/frontend/components/software/edit/package-managers/PackageManagerInfo.tsx index f3823c3bf..cc3fd3f32 100644 --- a/frontend/components/software/edit/package-managers/PackageManagerInfo.tsx +++ b/frontend/components/software/edit/package-managers/PackageManagerInfo.tsx @@ -36,21 +36,21 @@ export default function PackageManagerInfo({pm_key}: { pm_key: PackageManagerTyp Detected platform
- - {info.name.slice(0,3)} - -
{info.name}
-
+ + {info.name.slice(0,3)} + +
{info.name}
+
) } diff --git a/frontend/components/software/edit/package-managers/PackageManagerItem.tsx b/frontend/components/software/edit/package-managers/PackageManagerItem.tsx index ea44e1f24..6ab26896a 100644 --- a/frontend/components/software/edit/package-managers/PackageManagerItem.tsx +++ b/frontend/components/software/edit/package-managers/PackageManagerItem.tsx @@ -63,7 +63,7 @@ export default function PackageManagerItem({pos, item, onDelete, onEdit}: Packag { item.reverse_dependency_count_scraped_at ? Dependents: {item.reverse_dependency_count ?? 0} - : Dependents: no info + : Dependents: no info } } diff --git a/frontend/components/software/edit/package-managers/PackageManagersInfo.tsx b/frontend/components/software/edit/package-managers/PackageManagersInfo.tsx index 15abf16ab..00462462a 100644 --- a/frontend/components/software/edit/package-managers/PackageManagersInfo.tsx +++ b/frontend/components/software/edit/package-managers/PackageManagersInfo.tsx @@ -30,10 +30,10 @@ export default function PackageManagersInfo() { might take up to 1 day. { managers.length > 0 ? -

+

Supported package managers
{managers.join(', ')}. -

- :null +

+ :null } ) diff --git a/frontend/components/software/edit/package-managers/PackageManagersList.tsx b/frontend/components/software/edit/package-managers/PackageManagersList.tsx index 4906c592b..c47abcb86 100644 --- a/frontend/components/software/edit/package-managers/PackageManagersList.tsx +++ b/frontend/components/software/edit/package-managers/PackageManagersList.tsx @@ -40,7 +40,7 @@ export default function PackageManagersList({loading,managers,onSorted,onEdit,on marginTop: '0.5rem' }} > - No download locations + No download locations Please provide download locations of your software using Add button. ) @@ -78,18 +78,18 @@ export default function PackageManagersList({loading,managers,onSorted,onEdit,on /> {modal && Are you sure you want to remove installation location {modal.location ?? ''}?

- } - onCancel={() => { - setModal(undefined) - }} - onDelete={() => { - onDelete(modal.pos) - setModal(undefined) - }} + title="Remove package manager" + open={modal?.open ?? false} + body={ +

Are you sure you want to remove installation location {modal.location ?? ''}?

+ } + onCancel={() => { + setModal(undefined) + }} + onDelete={() => { + onDelete(modal.pos) + setModal(undefined) + }} /> } diff --git a/frontend/components/software/overview/SoftwareOverviewContent.tsx b/frontend/components/software/overview/SoftwareOverviewContent.tsx index 7b9349fe2..8449e6f96 100644 --- a/frontend/components/software/overview/SoftwareOverviewContent.tsx +++ b/frontend/components/software/overview/SoftwareOverviewContent.tsx @@ -34,10 +34,10 @@ export default function SoftwareOverviewContent({layout, software}: SoftwareOver return ( {software.map((item) => ( -
- -
- ))} +
+ +
+ ))}
) } diff --git a/frontend/components/software/overview/cards/ProgrammingLanguageList.tsx b/frontend/components/software/overview/cards/ProgrammingLanguageList.tsx index 80f836566..82b51d403 100644 --- a/frontend/components/software/overview/cards/ProgrammingLanguageList.tsx +++ b/frontend/components/software/overview/cards/ProgrammingLanguageList.tsx @@ -17,8 +17,8 @@ export default function ProgrammingLanguageList({
    {// limits the keywords to 'visibleNumberOfProgLang' per software. prog_lang?.slice(0, visibleNumberOfProgLang) - .map((lang:string, index: number) => ( -
  • {lang}
  • + .map((lang:string, index: number) => ( +
  • {lang}
  • ))} { // Show the number of keywords that are not visible. (prog_lang?.length > 0) diff --git a/frontend/components/software/overview/cards/SoftwareMasonryCard.tsx b/frontend/components/software/overview/cards/SoftwareMasonryCard.tsx index 7ab8e344c..088dadf54 100644 --- a/frontend/components/software/overview/cards/SoftwareMasonryCard.tsx +++ b/frontend/components/software/overview/cards/SoftwareMasonryCard.tsx @@ -55,7 +55,7 @@ export default function SoftwareMasonryCard({item}:SoftwareCardProps){ visibleNumberOfKeywords={visibleNumberOfKeywords} />
- } + }
{/* Languages */}
- + ) } diff --git a/frontend/components/software/overview/highlights/HighlightsCarousel.tsx b/frontend/components/software/overview/highlights/HighlightsCarousel.tsx index 5470d1d5e..cae93d09b 100644 --- a/frontend/components/software/overview/highlights/HighlightsCarousel.tsx +++ b/frontend/components/software/overview/highlights/HighlightsCarousel.tsx @@ -24,8 +24,8 @@ export const HighlightsCarousel = ({items=[]}: {items:SoftwareHighlight[]}) => { useEffect(() => { const calculateDistance = () => { - const rect = divRef.current?.getBoundingClientRect() - setDistance(Math.ceil(rect?.left ?? 0) + 16) + const rect = divRef.current?.getBoundingClientRect() + setDistance(Math.ceil(rect?.left ?? 0) + 16) } if (typeof window !== 'undefined') { calculateDistance() @@ -58,28 +58,28 @@ export const HighlightsCarousel = ({items=[]}: {items:SoftwareHighlight[]}) => {
{/* Reference Div to center align card */}
- {scrollPosition > 0 && } - + data-testid="highlights-carousel" + className="group relative w-full overflow-x-visible" > + {scrollPosition > 0 && } + - {/* Carousel */} -
- {/* render software card in the row direction */} - {items.map(highlight => ( -
- -
- )) - } + {/* Carousel */} +
+ {/* render software card in the row direction */} + {items.map(highlight => ( +
+ +
+ )) + } +
-
- + ) } diff --git a/frontend/components/table/TableBody.tsx b/frontend/components/table/TableBody.tsx index 1ce6982f7..25b46fd48 100644 --- a/frontend/components/table/TableBody.tsx +++ b/frontend/components/table/TableBody.tsx @@ -86,7 +86,7 @@ function TableRow({data export default function TableBody({ data, columns}: { data: T[], columns: Column[] }) { - return ( + return ( {data.map((item,i) => { return diff --git a/frontend/components/table/TableHeader.tsx b/frontend/components/table/TableHeader.tsx index 22a22f706..973fdd9a3 100644 --- a/frontend/components/table/TableHeader.tsx +++ b/frontend/components/table/TableHeader.tsx @@ -14,7 +14,7 @@ import {Column} from './EditableTable' export default function TableHeader({columns, onSort}: {columns: Column[], onSort:(column:K)=>void}) { - return ( + return ( {columns.map((col, i) => { @@ -26,13 +26,13 @@ export default function TableHeader({columns, onSort}: onClick={() => onSort(col.key)} sx={col?.sx} > - onSort(col.key)} - > - {col.label} - + onSort(col.key)} + > + {col.label} + ) })} diff --git a/frontend/components/user/UserNavItems.tsx b/frontend/components/user/UserNavItems.tsx index 9e754b81c..d7ae42f60 100644 --- a/frontend/components/user/UserNavItems.tsx +++ b/frontend/components/user/UserNavItems.tsx @@ -93,5 +93,5 @@ export const userMenu:UserMenuItems = { component: (props?) => , status: 'Your profile settings', showSearch: false - } + } } diff --git a/frontend/components/user/organisations/OrganisationCard.tsx b/frontend/components/user/organisations/OrganisationCard.tsx index fb803f7ac..14422dfe8 100644 --- a/frontend/components/user/organisations/OrganisationCard.tsx +++ b/frontend/components/user/organisations/OrganisationCard.tsx @@ -63,7 +63,7 @@ export default function OrganisationCard(organisation: OrganisationCardProps) { opacity: 0.4, color: 'primary.main' }} - /> + /> }
diff --git a/frontend/components/user/project-quality/SortableTable.tsx b/frontend/components/user/project-quality/SortableTable.tsx index 30de96795..9beb35a61 100644 --- a/frontend/components/user/project-quality/SortableTable.tsx +++ b/frontend/components/user/project-quality/SortableTable.tsx @@ -72,7 +72,7 @@ export default function SortableTable({metadata, initialData, initialOrder=''}: })} - + {data.map((item, pos) => { return ( diff --git a/frontend/components/user/project-quality/apiProjectQuality.tsx b/frontend/components/user/project-quality/apiProjectQuality.tsx index 91be75f0d..88ff043e4 100644 --- a/frontend/components/user/project-quality/apiProjectQuality.tsx +++ b/frontend/components/user/project-quality/apiProjectQuality.tsx @@ -35,24 +35,24 @@ export type ProjectQualityProps = { export type ProjectQualityKeys = keyof ProjectQualityProps const realLabels = new Map() - realLabels.set('title', {'label': 'Title', 'type': 'link', sx:{minWidth:'14rem'}}) - realLabels.set('score', {'label': 'Metadata score', 'type': 'pct'}) - realLabels.set('has_subtitle', {'label': 'Subtitle', 'type': 'boolean'}) - realLabels.set('is_published', {'label': 'Published', 'type': 'boolean'}) - realLabels.set('date_start', {'label': 'Start date', 'type': 'text', sx:{'whiteSpace': 'nowrap'}}) - realLabels.set('date_end', {'label': 'End date', 'type': 'text', sx:{'whiteSpace': 'nowrap'}}) - realLabels.set('grant_id', {'label': 'Grant ID', 'type': 'text'}) - realLabels.set('has_image', {'label': 'Image', 'type': 'boolean'}) - realLabels.set('has_contact_person', {'label': 'Contact person', 'type': 'boolean'}) - realLabels.set('team_member_cnt', {'label': 'Team members', 'type': 'number'}) - realLabels.set('participating_org_cnt', {'label': 'Participating organisations', 'type': 'number'}) - realLabels.set('funding_org_cnt', {'label': 'Funding organisations', 'type': 'number'}) - realLabels.set('software_cnt', {'label': 'Related software', 'type': 'number'}) - realLabels.set('project_cnt', {'label': 'Related projects', 'type': 'number'}) - realLabels.set('keyword_cnt', {'label': 'Keywords', 'type': 'number'}) - realLabels.set('research_domain_cnt', {'label': 'Research domains', 'type': 'number'}) - realLabels.set('impact_cnt', {'label': 'Impact', 'type': 'number'}) - realLabels.set('output_cnt', {'label': 'Output', 'type': 'number'}) +realLabels.set('title', {'label': 'Title', 'type': 'link', sx:{minWidth:'14rem'}}) +realLabels.set('score', {'label': 'Metadata score', 'type': 'pct'}) +realLabels.set('has_subtitle', {'label': 'Subtitle', 'type': 'boolean'}) +realLabels.set('is_published', {'label': 'Published', 'type': 'boolean'}) +realLabels.set('date_start', {'label': 'Start date', 'type': 'text', sx:{'whiteSpace': 'nowrap'}}) +realLabels.set('date_end', {'label': 'End date', 'type': 'text', sx:{'whiteSpace': 'nowrap'}}) +realLabels.set('grant_id', {'label': 'Grant ID', 'type': 'text'}) +realLabels.set('has_image', {'label': 'Image', 'type': 'boolean'}) +realLabels.set('has_contact_person', {'label': 'Contact person', 'type': 'boolean'}) +realLabels.set('team_member_cnt', {'label': 'Team members', 'type': 'number'}) +realLabels.set('participating_org_cnt', {'label': 'Participating organisations', 'type': 'number'}) +realLabels.set('funding_org_cnt', {'label': 'Funding organisations', 'type': 'number'}) +realLabels.set('software_cnt', {'label': 'Related software', 'type': 'number'}) +realLabels.set('project_cnt', {'label': 'Related projects', 'type': 'number'}) +realLabels.set('keyword_cnt', {'label': 'Keywords', 'type': 'number'}) +realLabels.set('research_domain_cnt', {'label': 'Research domains', 'type': 'number'}) +realLabels.set('impact_cnt', {'label': 'Impact', 'type': 'number'}) +realLabels.set('output_cnt', {'label': 'Output', 'type': 'number'}) async function fetchProjectQuality(showAll: boolean, token:string) { try { diff --git a/frontend/components/user/project-quality/index.tsx b/frontend/components/user/project-quality/index.tsx index eca6b5b45..0b4080db2 100644 --- a/frontend/components/user/project-quality/index.tsx +++ b/frontend/components/user/project-quality/index.tsx @@ -86,11 +86,11 @@ export default function ProjectQuality() { minHeight: '90vh', }} > - + ) diff --git a/frontend/components/user/project/ProjectCard.tsx b/frontend/components/user/project/ProjectCard.tsx index 3220e17b6..71a91e091 100644 --- a/frontend/components/user/project/ProjectCard.tsx +++ b/frontend/components/user/project/ProjectCard.tsx @@ -31,7 +31,7 @@ export type ProjectCardProps = { export default function ProjectCard( {slug, title, subtitle, image_id, updated_at, current_state, - is_featured, is_published, image_contain, menuSpace}: ProjectCardProps + is_featured, is_published, image_contain, menuSpace}: ProjectCardProps ) { // get current date const today = new Date() @@ -69,7 +69,7 @@ export default function ProjectCard(
+ > Removing your RSD account In order to be able to remove your account from RSD you first need to accept Terms of Service and Privacy Statement. After that remove account button will be enabled. If you do not wish to accept the terms of service but want your account to be removed from RSD please send an email to RSD support at - {host.email}. + {host.email}. ) } diff --git a/frontend/components/user/settings/UserAgreementModal.tsx b/frontend/components/user/settings/UserAgreementModal.tsx index f0dd51626..2682495fa 100644 --- a/frontend/components/user/settings/UserAgreementModal.tsx +++ b/frontend/components/user/settings/UserAgreementModal.tsx @@ -87,7 +87,7 @@ export default function UserAgrementModal() { {/* Render only if userInfo present in order to properly load defaultValues */} {userInfo && @@ -104,33 +104,33 @@ export default function UserAgrementModal() {

You may view or modify your agreement at any time in your profile settings.

- - - + - + + ) diff --git a/frontend/components/user/settings/useGetUserAgreementStatus.tsx b/frontend/components/user/settings/useGetUserAgreementStatus.tsx index 53a33ae20..8cf1e7776 100644 --- a/frontend/components/user/settings/useGetUserAgreementStatus.tsx +++ b/frontend/components/user/settings/useGetUserAgreementStatus.tsx @@ -25,11 +25,11 @@ export function useGetUserAgreementStatus(token: string, user:RsdUser|null, setA setOpen(true) } if ( - typeof(setAgreeTerms) === 'function' && typeof(setNoticePrivacy) === 'function' && + typeof(setAgreeTerms) === 'function' && typeof(setNoticePrivacy) === 'function' && typeof(respData.data.agree_terms) === 'boolean' && typeof(respData.data.notice_privacy_statement) === 'boolean' - ) { - setAgreeTerms(respData.data.agree_terms) - setNoticePrivacy(respData.data.notice_privacy_statement) + ) { + setAgreeTerms(respData.data.agree_terms) + setNoticePrivacy(respData.data.notice_privacy_statement) } } } diff --git a/frontend/components/user/software/SoftwareCard.tsx b/frontend/components/user/software/SoftwareCard.tsx index 841229c3d..65272ab00 100644 --- a/frontend/components/user/software/SoftwareCard.tsx +++ b/frontend/components/user/software/SoftwareCard.tsx @@ -66,7 +66,7 @@ export default function SoftwareCard({href, brand_name, short_statement, is_feat function renderPublished() { if (typeof is_published != 'undefined' && is_published === false) { return ( - + ) } if (is_featured){ @@ -105,20 +105,20 @@ export default function SoftwareCard({href, brand_name, short_statement, is_feat Updated {getTimeAgoSince(today, updated_at)}
- {mention_cnt && + {mention_cnt && {mention_cnt} - } - {contributor_cnt && + } + {contributor_cnt && {contributor_cnt} - } + }
diff --git a/frontend/config/userMenuItems.tsx b/frontend/config/userMenuItems.tsx index a676c323c..d808295c1 100644 --- a/frontend/config/userMenuItems.tsx +++ b/frontend/config/userMenuItems.tsx @@ -18,8 +18,8 @@ import Logout from '@mui/icons-material/Logout' import {MenuItemType} from './menuItems' export function getUserMenuItems( - role: 'rsd_admin' | 'rsd_user'='rsd_user' - ) { + role: 'rsd_admin' | 'rsd_user'='rsd_user' +) { const userMenuItems: MenuItemType[] = [ { diff --git a/frontend/pages/_document.tsx b/frontend/pages/_document.tsx index e952d6463..499052c29 100644 --- a/frontend/pages/_document.tsx +++ b/frontend/pages/_document.tsx @@ -68,7 +68,7 @@ export default class MyDocument extends Document{ strategy="lazyOnload" nonce={nonce} > - {` + {` var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(['requireConsent']); diff --git a/frontend/pages/admin/orcid-users.tsx b/frontend/pages/admin/orcid-users.tsx index 420602374..821f0e3f1 100644 --- a/frontend/pages/admin/orcid-users.tsx +++ b/frontend/pages/admin/orcid-users.tsx @@ -53,7 +53,7 @@ export default function OrcidWitelistPage() { fetchWhitelistedOrcids() } - return ( + return ( {pageTitle} diff --git a/frontend/pages/invite/organisation/[id].tsx b/frontend/pages/invite/organisation/[id].tsx index abfb26a7c..e475e6ee7 100644 --- a/frontend/pages/invite/organisation/[id].tsx +++ b/frontend/pages/invite/organisation/[id].tsx @@ -53,7 +53,7 @@ export default function InviteOrganisationMaintainer({organisationInfo, error}: } return ( - + Organisation Maintainer Invite | RSD diff --git a/frontend/pages/invite/project/[id].tsx b/frontend/pages/invite/project/[id].tsx index 212c3f330..aa74ed3a9 100644 --- a/frontend/pages/invite/project/[id].tsx +++ b/frontend/pages/invite/project/[id].tsx @@ -53,7 +53,7 @@ export default function InviteProjectMaintainer({projectInfo, error}: } return ( - + Project Maintainer Invite | RSD diff --git a/frontend/pages/invite/software/[id].tsx b/frontend/pages/invite/software/[id].tsx index 8f18c7846..d8aa17af3 100644 --- a/frontend/pages/invite/software/[id].tsx +++ b/frontend/pages/invite/software/[id].tsx @@ -51,7 +51,7 @@ export default function InviteSoftwareMaintainer({softwareInfo, error}: } return ( - + Software Maintainer Invite | RSD diff --git a/frontend/pages/organisations/[...slug].tsx b/frontend/pages/organisations/[...slug].tsx index 28990363d..3bff0225c 100644 --- a/frontend/pages/organisations/[...slug].tsx +++ b/frontend/pages/organisations/[...slug].tsx @@ -75,26 +75,26 @@ export default function OrganisationPage({ rsd_page_rows }} > - - {/* ORGANISATION HEADER */} - - - - {/* TABS */} - - - - {/* TAB CONTENT */} -
- -
-
+ {/* ORGANISATION HEADER */} + + + + {/* TABS */} + + + + {/* TAB CONTENT */} +
+ +
+ diff --git a/frontend/utils/getDataCite.ts b/frontend/utils/getDataCite.ts index b745e8a6b..c5b774c73 100644 --- a/frontend/utils/getDataCite.ts +++ b/frontend/utils/getDataCite.ts @@ -179,7 +179,7 @@ export function dataCiteGraphQLItemToMentionItem(item: WorkResponse) { image_url: null, mention_type: dataciteToRsdType(item), source: 'DataCite', - note: null + note: null, } return mention } @@ -195,15 +195,15 @@ export async function getDataciteItemByDoiGraphQL(doi: string) { body: JSON.stringify({ operationName: null, variables:{}, - query - }) + query, + }), }) if (resp.status === 200) { const json: DataciteWorkGraphQLResponse = await resp.json() return { status:200, - message:json.data.work + message:json.data.work, } } const error = await extractReturnMessage(resp) @@ -212,7 +212,7 @@ export async function getDataciteItemByDoiGraphQL(doi: string) { logger(`getDataciteItemsByDoiGraphQL: ${e?.message}`, 'error') return { status: 500, - message: e?.message + message: e?.message, } } } @@ -228,15 +228,15 @@ export async function getDataciteItemsByDoiGraphQL(dois: string[]) { body: JSON.stringify({ operationName: null, variables:{}, - query - }) + query, + }), }) if (resp.status === 200) { const json = await resp.json() return { status:200, - message:json.data.works.nodes + message:json.data.works.nodes, } } const error = await extractReturnMessage(resp) @@ -245,7 +245,7 @@ export async function getDataciteItemsByDoiGraphQL(dois: string[]) { logger(`getDataciteItemsByDoiGraphQL: ${e?.message}`, 'error') return { status: 500, - message: e?.message + message: e?.message, } } } @@ -261,8 +261,8 @@ export async function getDataciteItemsByTitleGraphQL(title: string) { body: JSON.stringify({ operationName: null, variables: {}, - query - }) + query, + }), }) if (resp.status === 200) { const json: DataciteWorksGraphQLResponse = await resp.json() @@ -289,8 +289,8 @@ export async function getSoftwareVersionInfoForDoi(doi: string) { body: JSON.stringify({ operationName: null, variables: {}, - query - }) + query, + }), }) const json = await extractRespFromGraphQL(resp) @@ -303,13 +303,13 @@ export async function getSoftwareVersionInfoForDoi(doi: string) { function dataciteToRsdType(item: WorkResponse): MentionTypeKeys { switch (item.type.trim().toLowerCase()) { - // additional validation using resourceType + // additional validation using resourceType case 'audiovisual': return rsdTypeFromResourceType(item.types.resourceType) case 'text': return rsdTypeFromResourceType(item.types.resourceType) default: - // by default using type value + // by default using type value return rsdTypeFromResourceType(item.type) } } diff --git a/frontend/utils/handleFileUpload.test.ts b/frontend/utils/handleFileUpload.test.ts index b3781ae84..039d783cc 100644 --- a/frontend/utils/handleFileUpload.test.ts +++ b/frontend/utils/handleFileUpload.test.ts @@ -46,8 +46,11 @@ it('returns 413 when file exceeds maxFileSize', async () => { const props = { target: { files: [ - {size: maxFileSize + 1} - ]}} + {size: maxFileSize + 1}, + ], + other: 1, + }, + } const resp = await handleFileUpload(props as any) expect(resp).toEqual({ diff --git a/frontend/utils/logger.ts b/frontend/utils/logger.ts index b1432f769..d07598b90 100644 --- a/frontend/utils/logger.ts +++ b/frontend/utils/logger.ts @@ -10,19 +10,19 @@ export default function logger( logType:LogType='info' ){ switch(logType){ - case 'error': + case 'error': // eslint-disable-next-line console.error(`[ERROR] ${message}`) - break - case 'warn': + break + case 'warn': // eslint-disable-next-line console.warn(`[WARNING] ${message}`) - break - default: + break + default: // info logs only in dev - if (process.env.NODE_ENV ==='development'){ + if (process.env.NODE_ENV ==='development'){ // eslint-disable-next-line console.log(`[INFO] ${message}`) - } + } } }