From a5b0e318e7321916733d159f9365f6dd9f31a9da Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Tue, 30 Jan 2024 19:29:49 -0500 Subject: [PATCH 01/19] fix url --- .../dashboard/components/DonorDataSummary/DownloadButtons.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx index 5aa64f8d..d7b77496 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx @@ -83,7 +83,7 @@ const DownloadButtons = ({ programShortName }) => { const onClickDownloadAll = () => { const url = urlJoin( GATEWAY_API_ROOT, - `/clinical/program/${programShortName}/all-clinical-data`, + `/clinical/proxy/program/${programShortName}/all-clinical-data`, ); setButtonLoadingState(true); @@ -111,7 +111,7 @@ const DownloadButtons = ({ programShortName }) => { From 3d67f0215b1199617c144fe48648e42f45aaf66b Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Tue, 30 Jan 2024 19:30:00 -0500 Subject: [PATCH 02/19] fix styles --- .../program/[shortName]/clinical-submission/page.tsx | 2 +- .../components/DonorDataSummary/DonorSummaryTable.tsx | 11 +++++++---- src/app/components/Content/ContentMain.tsx | 4 ---- src/app/hooks/ThemeProvider.tsx | 4 ---- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx index 2695d98a..032f4fb8 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx @@ -105,7 +105,7 @@ const ClinicalSubmission = ({ shortName }: { shortName: string }) => { updateQuery: updateClinicalSubmissionQuery, } = useClinicalQuery(CLINICAL_SUBMISSION_QUERY, { variables: { - shortName, + programShortName: shortName, }, }); diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx index c25040cf..0a85a9c1 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx @@ -355,10 +355,11 @@ const DonorSummaryTable = ({ programShortName, `/clinical-data/?donorId=${original.donorId}&tab=${errorTab || 'donor'}`, ); - - - {`${original.donorId} (${original.submitterDonorId})`} - ; + return ( + + {`${original.donorId} (${original.submitterDonorId})`} + + ); }, size: 135, }, @@ -837,6 +838,8 @@ const DonorSummaryTable = ({ }, ]; + console.log('data', programDonorSummaryEntries); + return (
{ display: flex; flex: 1 0 auto; flex-direction: column; - row-gap: 20px; padding: 25px 30px; > div { - ${containerStyle(theme)} - &.error { border: 1px solid ${theme.colors.error_2}; background-color: ${theme.colors.error_4}; diff --git a/src/app/hooks/ThemeProvider.tsx b/src/app/hooks/ThemeProvider.tsx index 9cc7ad0d..47033918 100644 --- a/src/app/hooks/ThemeProvider.tsx +++ b/src/app/hooks/ThemeProvider.tsx @@ -48,10 +48,6 @@ export default function ThemeProvider({ children }: { children: React.ReactNode margin: 0; } - :root { - font-size: 62.5%; - } - body { line-height: 1.5; font-family: ${workSans.style.fontFamily}; From 9b40f69203799f1455eb03c36a38b934315f7ebe Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Tue, 30 Jan 2024 19:38:53 -0500 Subject: [PATCH 03/19] dashboard styling --- .../DonorDataSummary/DonorSummaryTable.tsx | 19 ++++++------------- .../ProgramWorkspaceStatus/index.tsx | 4 ++-- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx index 0a85a9c1..501fde07 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx @@ -28,7 +28,6 @@ import { DEFAULT_TABLE_PAGE_SIZE, FilterClearButton, Icon, - Link, OnChangeFn, PaginationState, Row, @@ -44,7 +43,7 @@ import { } from '@icgc-argo/uikit'; import { find } from 'lodash'; -import NextLink from 'next/link'; +import Link from 'next/link'; import { useEffect, useState } from 'react'; import urlJoin from 'url-join'; import { defaultClinicalEntityFilters } from '../../../clinical-data/common'; @@ -356,9 +355,7 @@ const DonorSummaryTable = ({ `/clinical-data/?donorId=${original.donorId}&tab=${errorTab || 'donor'}`, ); return ( - - {`${original.donorId} (${original.submitterDonorId})`} - + {`${original.donorId} (${original.submitterDonorId})`} ); }, size: 135, @@ -816,12 +813,10 @@ const DonorSummaryTable = ({ return original.validWithCurrentDictionary ? ( '' ) : ( - - - {' '} - Update Clinical - - + + Update + Clinical + ); }, size: 125, @@ -838,8 +833,6 @@ const DonorSummaryTable = ({ }, ]; - console.log('data', programDonorSummaryEntries); - return (
{ display: flex; flex-direction: row; align-items: flex-end; - padding-top: 10px; + margin-top: 10px; `} >
{
Date: Tue, 30 Jan 2024 19:45:28 -0500 Subject: [PATCH 04/19] card --- .../components/Instructions.tsx | 5 +- src/app/components/Card.tsx | 64 ++++++++++--------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx b/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx index 7bd35cf2..2b0bb0ce 100644 --- a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx @@ -26,6 +26,7 @@ import { BUTTON_SIZES, BUTTON_VARIANTS, Button, + Container, FileSelectButton, Icon, InstructionBox, @@ -71,7 +72,7 @@ const Instructions = ({ ); return ( -
} /> -
+ ); }; diff --git a/src/app/components/Card.tsx b/src/app/components/Card.tsx index 8eac26f3..2da00ca9 100644 --- a/src/app/components/Card.tsx +++ b/src/app/components/Card.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import { css } from '@/lib/emotion'; -import { Typography } from '@icgc-argo/uikit'; +import { Container, Typography } from '@icgc-argo/uikit'; import { FC, ReactNode } from 'react'; type CardProps = { @@ -27,41 +27,43 @@ type CardProps = { children: ReactNode; }; const Card: FC = ({ title, action, fill = false, children }) => ( -
- {(title || action) && ( -
+
- + {(title || action) && ( +
- {title} - - {action} -
- )} + + {title} + + {action} +
+ )} - {children} -
+ {children} +
+ ); export default Card; From ee538cb498ea0b7208d80568ab5d9a848a9b7840 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 00:49:28 -0500 Subject: [PATCH 05/19] table fix to work with v3 uikit --- .../clinical-data/ClinicalEntityDataTable.tsx | 67 ++++++++++--------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx index b5521a27..56f4c7d4 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx @@ -640,8 +640,6 @@ const ClinicalEntityDataTable = ({ const headerStyle = css` background-color: ${theme.colors.grey_4}; - border-bottom: 1px solid ${theme.colors.grey_2}; - border-right: 1px solid ${theme.colors.grey_2}; font-size: 13px; padding: 5px; text-align: left; @@ -655,6 +653,13 @@ const ClinicalEntityDataTable = ({ z-index: 1; `; + const s = css` + height: 28px; + display: flex; + align-items: center; + justify-content: flex-start; + `; + columns = [ { id: 'clinical_core_completion_header', @@ -662,10 +667,10 @@ const ClinicalEntityDataTable = ({ sortingFn: sortEntityData, header: (props) => { return ( - @@ -700,7 +705,7 @@ const ClinicalEntityDataTable = ({
- +
); }, headerStyle: completionHeaderStyle, @@ -712,28 +717,24 @@ const ClinicalEntityDataTable = ({ const coreCompletionColumnsCount = 7; const isLastElement = index === coreCompletionColumnsCount - 1; const isSticky = value === 'donor_id'; - const isSorted = props.sorted; return ( - {value} - +
); }, maxWidth: noTableData ? 50 : 250, @@ -758,26 +759,21 @@ const ClinicalEntityDataTable = ({ ); return ( - -
- {content} -
- + {content} +
); }, })), @@ -786,9 +782,14 @@ const ClinicalEntityDataTable = ({ id: 'submitted_donor_data_header', meta: { customHeader: true }, header: (props) => ( - +
SUBMITTED DONOR DATA
- +
), headerStyle: dataHeaderStyle, columns: columns.slice(7), From fb1e2d52f6430b15e605151fd2e4a544abea4312 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 01:17:28 -0500 Subject: [PATCH 06/19] move componenents out of routing --- src/{app => }/App.tsx | 12 +++--- src/app/(error)/403/page.tsx | 2 +- .../submission/components/ProgramMenu.tsx | 16 +++---- src/app/(post-login)/submission/layout.tsx | 2 +- .../clinical-data/ClinicalEntityDataTable.tsx | 12 +++--- .../clinical-data/DownloadButtons.tsx | 8 ++-- .../SearchBar/FilterModal/index.tsx | 4 +- .../[shortName]/clinical-data/page.tsx | 14 +++---- .../components/ClearSubmissionButton.tsx | 6 +-- .../components/FilesNavigator/FilePreview.tsx | 2 +- .../FilesNavigator/FileRecordTable.tsx | 2 +- .../components/FilesNavigator/StatsArea.tsx | 2 +- .../components/FilesNavigator/TableCells.tsx | 2 +- .../components/FilesNavigator/index.tsx | 6 +-- .../components/FilesNavigator/tableConfig.tsx | 2 +- .../components/FilesNavigator/ui.tsx | 6 +-- .../clinical-submission/components/Header.tsx | 24 +++++------ .../components/Instructions.tsx | 6 +-- .../components/ProgressBar.tsx | 2 +- .../components/SubmissionSummaryTable.tsx | 2 +- .../[shortName]/clinical-submission/page.tsx | 40 +++++++++--------- .../ClinicalSubmissionProgressBar.tsx | 6 +-- .../SampleRegistrationProgressBar.tsx | 6 +-- .../components/ClinicalChart/index.tsx | 10 ++--- .../DonorDataSummary/DonorSummaryTable.tsx | 8 ++-- .../DonorSummaryTableLegend.tsx | 2 +- .../DonorSummaryTableStatArea.tsx | 2 +- .../DonorDataSummary/DownloadButtons.tsx | 4 +- .../EmptyDonorSummaryTable.tsx | 2 +- .../components/DonorDataSummary/common.tsx | 2 +- .../components/DonorDataSummary/index.tsx | 2 +- .../queries/useProgramDonorsSummaryQuery.tsx | 6 +-- .../components/DonorReleaseSummary/index.tsx | 4 +- .../ProgramWorkspaceStatus/index.tsx | 4 +- .../dashboard/components/StatsBar/index.tsx | 6 +-- .../program/[shortName]/dashboard/page.tsx | 8 ++-- .../components/FileTable.tsx | 2 +- .../components/Instructions.tsx | 2 +- .../components/RegisterSampleModal.tsx | 10 ++--- .../[shortName]/sample-registration/page.tsx | 30 ++++++------- .../(post-login)/submission/program/page.tsx | 8 ++-- src/app/(pre-login)/contact/page.tsx | 25 ++--------- src/app/(pre-login)/logging-in/page.tsx | 4 +- src/app/layout.tsx | 2 +- src/app/not-found.tsx | 2 +- src/app/page.tsx | 4 +- src/{app => }/components/Card.tsx | 0 .../components/Content/ContentMain.tsx | 0 .../components/ContentPlaceholder.tsx | 0 .../ErrorNotificationDefaultTable.tsx | 0 .../components/ErrorNotification/index.tsx | 0 src/{app => }/components/FadingDiv.tsx | 0 src/{app => }/components/FileError.tsx | 0 src/{app => }/components/Footer.tsx | 2 +- src/{app => }/components/Header.tsx | 2 +- src/{app => }/components/Hero.tsx | 2 +- src/{app => }/components/Loader.tsx | 0 src/{app => }/components/LoginButton.tsx | 2 +- src/{app => }/components/Modal.tsx | 0 src/{app => }/components/NoData.tsx | 0 src/{app => }/components/Page.tsx | 2 +- .../components/PageHeader/PageHeader.tsx | 0 .../components/PageHeader/TitleBar.tsx | 0 src/{app => }/components/ProfileMenu.tsx | 0 src/{app => }/components/RegionBanner.tsx | 0 src/{app => }/components/Table/common.tsx | 0 .../components/placeholders/ContentError.tsx | 0 .../components/placeholders/ContentLoader.tsx | 0 .../components/placeholders/index.tsx | 0 src/components/views/contact/Contact.tsx | 42 +++++++++++++++++++ .../views}/contact/components/form.tsx | 2 +- .../views}/contact/components/info.tsx | 2 +- .../CLEAR_CLINICAL_REGISTRATION_MUTATION.ts | 0 .../gql/clinical/CLEAR_CLINICAL_SUBMISSION.ts | 0 .../clinical/CLINICAL_ENTITY_DATA_QUERY.ts | 0 .../CLINICAL_ENTITY_SEARCH_RESULTS_QUERY.ts | 0 .../gql/clinical/CLINICAL_ERRORS_QUERY.ts | 0 .../gql/clinical/CLINICAL_SCHEMA_VERSION.ts | 0 .../clinical/CLINICAL_SUBMISSION_FRAGMENT.ts | 0 .../gql/clinical/CLINICAL_SUBMISSION_QUERY.ts | 0 .../CLINICAL_SUBMISSION_SYSTEM_STATUS.ts | 0 .../COMMIT_CLINICAL_REGISTRATION_MUTATION.ts | 0 .../gql/clinical/GET_REGISTRATION_QUERY.ts | 0 .../gql/clinical/REGISTRATION_FRAGMENT.ts | 0 .../gql/clinical/SIDEMENU_PROGRAM_STATUS.ts | 0 .../clinical/SIGN_OFF_SUBMISSION_MUTATION.ts | 0 .../SUBMITTED_DATA_SIDE_MENU_QUERY.ts | 0 .../clinical/VALIDATE_SUBMISSION_MUTATION.ts | 0 .../gateway/APPROVE_SUBMISSION_MUTATION.ts | 0 .../gql/gateway/DASHBOARD_SUMMARY_QUERY.ts | 0 .../gql/gateway/PROGRAMS_LIST_QUERY.ts | 0 ..._PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY.ts | 0 .../gateway/PROGRAM_DONOR_SUMMARY_QUERY.ts | 0 .../gql/gateway/REOPEN_SUBMISSION_MUTATION.ts | 0 .../gql/gateway/SIDEMENU_PROGRAMS.ts | 0 .../UPLOAD_CLINICAL_SUBMISSION_MUTATION.ts | 0 .../gateway/UPLOAD_REGISTRATION_MUTATION.ts | 0 src/{app => }/hooks/ApolloProvider.tsx | 2 +- src/{app => }/hooks/AppProvider.tsx | 0 src/{app => }/hooks/AuthProvider.tsx | 4 +- src/{app => }/hooks/GlobalLoaderProvider.tsx | 4 +- src/{app => }/hooks/ThemeProvider.tsx | 0 src/{app => }/hooks/ToastProvider.tsx | 0 src/{app => }/hooks/useApolloQuery.tsx | 0 src/{app => }/hooks/useCommonToasters.tsx | 0 src/{app => }/hooks/usePageContext.tsx | 0 .../hooks/useSubmissionSystemStatus.tsx | 0 src/{app => }/hooks/useTimeout.tsx | 0 src/{app => }/hooks/useURLQueryState.tsx | 0 src/{app => }/hooks/useUrlParamState.ts | 0 .../hooks/useUserConfirmationModalState.tsx | 0 src/{app => }/hooks/useUserRole.tsx | 0 112 files changed, 211 insertions(+), 188 deletions(-) rename src/{app => }/App.tsx (89%) rename src/{app => }/components/Card.tsx (100%) rename src/{app => }/components/Content/ContentMain.tsx (100%) rename src/{app => }/components/ContentPlaceholder.tsx (100%) rename src/{app => }/components/ErrorNotification/ErrorNotificationDefaultTable.tsx (100%) rename src/{app => }/components/ErrorNotification/index.tsx (100%) rename src/{app => }/components/FadingDiv.tsx (100%) rename src/{app => }/components/FileError.tsx (100%) rename src/{app => }/components/Footer.tsx (98%) rename src/{app => }/components/Header.tsx (98%) rename src/{app => }/components/Hero.tsx (98%) rename src/{app => }/components/Loader.tsx (100%) rename src/{app => }/components/LoginButton.tsx (97%) rename src/{app => }/components/Modal.tsx (100%) rename src/{app => }/components/NoData.tsx (100%) rename src/{app => }/components/Page.tsx (97%) rename src/{app => }/components/PageHeader/PageHeader.tsx (100%) rename src/{app => }/components/PageHeader/TitleBar.tsx (100%) rename src/{app => }/components/ProfileMenu.tsx (100%) rename src/{app => }/components/RegionBanner.tsx (100%) rename src/{app => }/components/Table/common.tsx (100%) rename src/{app => }/components/placeholders/ContentError.tsx (100%) rename src/{app => }/components/placeholders/ContentLoader.tsx (100%) rename src/{app => }/components/placeholders/index.tsx (100%) create mode 100644 src/components/views/contact/Contact.tsx rename src/{app/(pre-login) => components/views}/contact/components/form.tsx (99%) rename src/{app/(pre-login) => components/views}/contact/components/info.tsx (98%) rename src/{app => }/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION.ts (100%) rename src/{app => }/gql/clinical/CLEAR_CLINICAL_SUBMISSION.ts (100%) rename src/{app => }/gql/clinical/CLINICAL_ENTITY_DATA_QUERY.ts (100%) rename src/{app => }/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY.ts (100%) rename src/{app => }/gql/clinical/CLINICAL_ERRORS_QUERY.ts (100%) rename src/{app => }/gql/clinical/CLINICAL_SCHEMA_VERSION.ts (100%) rename src/{app => }/gql/clinical/CLINICAL_SUBMISSION_FRAGMENT.ts (100%) rename src/{app => }/gql/clinical/CLINICAL_SUBMISSION_QUERY.ts (100%) rename src/{app => }/gql/clinical/CLINICAL_SUBMISSION_SYSTEM_STATUS.ts (100%) rename src/{app => }/gql/clinical/COMMIT_CLINICAL_REGISTRATION_MUTATION.ts (100%) rename src/{app => }/gql/clinical/GET_REGISTRATION_QUERY.ts (100%) rename src/{app => }/gql/clinical/REGISTRATION_FRAGMENT.ts (100%) rename src/{app => }/gql/clinical/SIDEMENU_PROGRAM_STATUS.ts (100%) rename src/{app => }/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION.ts (100%) rename src/{app => }/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY.ts (100%) rename src/{app => }/gql/clinical/VALIDATE_SUBMISSION_MUTATION.ts (100%) rename src/{app => }/gql/gateway/APPROVE_SUBMISSION_MUTATION.ts (100%) rename src/{app => }/gql/gateway/DASHBOARD_SUMMARY_QUERY.ts (100%) rename src/{app => }/gql/gateway/PROGRAMS_LIST_QUERY.ts (100%) rename src/{app => }/gql/gateway/PROGRAM_DONOR_PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY.ts (100%) rename src/{app => }/gql/gateway/PROGRAM_DONOR_SUMMARY_QUERY.ts (100%) rename src/{app => }/gql/gateway/REOPEN_SUBMISSION_MUTATION.ts (100%) rename src/{app => }/gql/gateway/SIDEMENU_PROGRAMS.ts (100%) rename src/{app => }/gql/gateway/UPLOAD_CLINICAL_SUBMISSION_MUTATION.ts (100%) rename src/{app => }/gql/gateway/UPLOAD_REGISTRATION_MUTATION.ts (100%) rename src/{app => }/hooks/ApolloProvider.tsx (96%) rename src/{app => }/hooks/AppProvider.tsx (100%) rename src/{app => }/hooks/AuthProvider.tsx (98%) rename src/{app => }/hooks/GlobalLoaderProvider.tsx (96%) rename src/{app => }/hooks/ThemeProvider.tsx (100%) rename src/{app => }/hooks/ToastProvider.tsx (100%) rename src/{app => }/hooks/useApolloQuery.tsx (100%) rename src/{app => }/hooks/useCommonToasters.tsx (100%) rename src/{app => }/hooks/usePageContext.tsx (100%) rename src/{app => }/hooks/useSubmissionSystemStatus.tsx (100%) rename src/{app => }/hooks/useTimeout.tsx (100%) rename src/{app => }/hooks/useURLQueryState.tsx (100%) rename src/{app => }/hooks/useUrlParamState.ts (100%) rename src/{app => }/hooks/useUserConfirmationModalState.tsx (100%) rename src/{app => }/hooks/useUserRole.tsx (100%) diff --git a/src/app/App.tsx b/src/App.tsx similarity index 89% rename from src/app/App.tsx rename to src/App.tsx index 7468519c..74eaf66e 100644 --- a/src/app/App.tsx +++ b/src/App.tsx @@ -19,12 +19,12 @@ // all our context providers won't work server side, beacuse React.Context is client side 'use client'; -import { ApolloProvider } from '@/app/hooks/ApolloProvider'; -import { AppProvider } from '@/app/hooks/AppProvider'; -import { AuthProvider } from '@/app/hooks/AuthProvider'; -import GlobalLoaderProvider, { loaderPortalRef } from '@/app/hooks/GlobalLoaderProvider'; -import ThemeProvider from '@/app/hooks/ThemeProvider'; -import ToastProvider from '@/app/hooks/ToastProvider'; +import { ApolloProvider } from '@/hooks/ApolloProvider'; +import { AppProvider } from '@/hooks/AppProvider'; +import { AuthProvider } from '@/hooks/AuthProvider'; +import GlobalLoaderProvider, { loaderPortalRef } from '@/hooks/GlobalLoaderProvider'; +import ThemeProvider from '@/hooks/ThemeProvider'; +import ToastProvider from '@/hooks/ToastProvider'; import { css } from '@/lib/emotion'; import { loadDevMessages, loadErrorMessages } from '@apollo/client/dev'; import { ReactNode, forwardRef } from 'react'; diff --git a/src/app/(error)/403/page.tsx b/src/app/(error)/403/page.tsx index b50c7f20..aac64517 100644 --- a/src/app/(error)/403/page.tsx +++ b/src/app/(error)/403/page.tsx @@ -25,7 +25,7 @@ import NextLink from 'next/link'; import { Col, Row } from 'react-grid-system'; import dnaLockedImage from '../../../../public/assets/dna-locked.svg'; import logoMarkImage from '../../../../public/assets/logomark.svg'; -import { useAppConfigContext } from '../../hooks/AppProvider'; +import { useAppConfigContext } from '../../../hooks/AppProvider'; export default function Error403Page() { const { DOCS_URL_ROOT } = useAppConfigContext(); diff --git a/src/app/(post-login)/submission/components/ProgramMenu.tsx b/src/app/(post-login)/submission/components/ProgramMenu.tsx index 32351f3b..85523cb6 100644 --- a/src/app/(post-login)/submission/components/ProgramMenu.tsx +++ b/src/app/(post-login)/submission/components/ProgramMenu.tsx @@ -19,14 +19,7 @@ 'use client'; import { SideMenuProgramStatusQuery, SubmissionState } from '@/__generated__/clinical/graphql'; -import Loader from '@/app/components/Loader'; -import SIDEMENU_PROGRAM_STATUS from '@/app/gql/clinical/SIDEMENU_PROGRAM_STATUS'; -import SIDEMENU_PROGRAMS from '@/app/gql/gateway/SIDEMENU_PROGRAMS'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useAuthContext } from '@/app/hooks/AuthProvider'; -import { useClinicalQuery, useGatewayQuery } from '@/app/hooks/useApolloQuery'; -import { useSubmissionSystemStatus } from '@/app/hooks/useSubmissionSystemStatus'; -import useUserRole from '@/app/hooks/useUserRole'; +import Loader from '@/components/Loader'; import { PROGRAM_CLINICAL_DATA_PATH, PROGRAM_CLINICAL_SUBMISSION_PATH, @@ -35,6 +28,13 @@ import { PROGRAM_SAMPLE_REGISTRATION_PATH, } from '@/global/constants'; import { getProgramPath, notNull } from '@/global/utils'; +import SIDEMENU_PROGRAM_STATUS from '@/gql/clinical/SIDEMENU_PROGRAM_STATUS'; +import SIDEMENU_PROGRAMS from '@/gql/gateway/SIDEMENU_PROGRAMS'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; +import { useClinicalQuery, useGatewayQuery } from '@/hooks/useApolloQuery'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import useUserRole from '@/hooks/useUserRole'; import { css } from '@/lib/emotion'; import { Icon, MenuItem } from '@icgc-argo/uikit'; import orderBy from 'lodash/orderBy'; diff --git a/src/app/(post-login)/submission/layout.tsx b/src/app/(post-login)/submission/layout.tsx index bcb69328..0a6a1be4 100644 --- a/src/app/(post-login)/submission/layout.tsx +++ b/src/app/(post-login)/submission/layout.tsx @@ -18,7 +18,7 @@ */ 'use client'; -import { HEADER_HEIGHT_PX } from '@/app/components/Header'; +import { HEADER_HEIGHT_PX } from '@/components/Header'; import { css, useTheme } from '@/lib/emotion'; import { ReactNode, useState } from 'react'; import SideMenu from './components/SideMenu/Menu'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx index 56f4c7d4..aca6ba43 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx @@ -18,13 +18,13 @@ */ import { ClinicalSearchResults } from '@/__generated__/clinical/graphql'; -import ErrorNotification from '@/app/components/ErrorNotification'; -import { TableInfoHeaderContainer } from '@/app/components/Table/common'; -import CLINICAL_ENTITY_DATA_QUERY from '@/app/gql/clinical/CLINICAL_ENTITY_DATA_QUERY'; -import CLINICAL_SCHEMA_VERSION from '@/app/gql/clinical/CLINICAL_SCHEMA_VERSION'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useClinicalQuery } from '@/app/hooks/useApolloQuery'; +import ErrorNotification from '@/components/ErrorNotification'; +import { TableInfoHeaderContainer } from '@/components/Table/common'; import { PROGRAM_CLINICAL_SUBMISSION_PATH, PROGRAM_SHORT_NAME_PATH } from '@/global/constants'; +import CLINICAL_ENTITY_DATA_QUERY from '@/gql/clinical/CLINICAL_ENTITY_DATA_QUERY'; +import CLINICAL_SCHEMA_VERSION from '@/gql/clinical/CLINICAL_SCHEMA_VERSION'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; import { ContentPlaceholder, DnaLoader, diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/DownloadButtons.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-data/DownloadButtons.tsx index 2c7c81ee..9f46392b 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/DownloadButtons.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-data/DownloadButtons.tsx @@ -17,10 +17,10 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useAuthContext } from '@/app/hooks/AuthProvider'; -import useCommonToasters from '@/app/hooks/useCommonToasters'; -import usePageContext from '@/app/hooks/usePageContext'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; +import useCommonToasters from '@/hooks/useCommonToasters'; +import usePageContext from '@/hooks/usePageContext'; import { Button, Icon, css } from '@icgc-argo/uikit'; import React from 'react'; import { Col, Row } from 'react-grid-system'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/index.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/index.tsx index f22f3982..c7ccff8a 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/index.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/index.tsx @@ -17,8 +17,8 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { ModalPortal } from '@/app/components/Modal'; -import CLINICAL_ENTITY_SEARCH_RESULTS_QUERY from '@/app/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY'; +import { ModalPortal } from '@/components/Modal'; +import CLINICAL_ENTITY_SEARCH_RESULTS_QUERY from '@/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY'; import { useQuery } from '@apollo/client'; import { Button, Modal, css } from '@icgc-argo/uikit/'; import { Textarea } from '@icgc-argo/uikit/form/Textarea'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/page.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-data/page.tsx index 82e2c980..55e5b902 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-data/page.tsx @@ -18,14 +18,14 @@ */ 'use client'; -import ContentMain from '@/app/components/Content/ContentMain'; -import { pageWithPermissions } from '@/app/components/Page'; -import { BreadcrumbTitle, HelpLink, PageHeader } from '@/app/components/PageHeader/PageHeader'; -import CLINICAL_ENTITY_SEARCH_RESULTS_QUERY from '@/app/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY'; -import SUBMITTED_DATA_SIDE_MENU_QUERY from '@/app/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY'; -import { useClinicalQuery } from '@/app/hooks/useApolloQuery'; -import useUrlParamState from '@/app/hooks/useUrlParamState'; +import ContentMain from '@/components/Content/ContentMain'; +import { pageWithPermissions } from '@/components/Page'; +import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; import { notNull, parseDonorIdString } from '@/global/utils'; +import CLINICAL_ENTITY_SEARCH_RESULTS_QUERY from '@/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY'; +import SUBMITTED_DATA_SIDE_MENU_QUERY from '@/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import useUrlParamState from '@/hooks/useUrlParamState'; import { css } from '@/lib/emotion'; import { useQuery } from '@apollo/client'; import { Loader, Typography, VerticalTabs, useTheme } from '@icgc-argo/uikit'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ClearSubmissionButton.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ClearSubmissionButton.tsx index de26c0e2..a55f41bf 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ClearSubmissionButton.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ClearSubmissionButton.tsx @@ -18,10 +18,10 @@ */ 'use client'; -import { useGlobalLoader } from '@/app/hooks/GlobalLoaderProvider'; -import { useToaster } from '@/app/hooks/ToastProvider'; -import useCommonToasters from '@/app/hooks/useCommonToasters'; import { sleep } from '@/global/utils'; +import { useGlobalLoader } from '@/hooks/GlobalLoaderProvider'; +import { useToaster } from '@/hooks/ToastProvider'; +import useCommonToasters from '@/hooks/useCommonToasters'; import { css } from '@/lib/emotion'; import { Button } from '@icgc-argo/uikit'; import { FC } from 'react'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FilePreview.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FilePreview.tsx index 393c8e1a..00a6026d 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FilePreview.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FilePreview.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useSubmissionSystemStatus } from '@/app/hooks/useSubmissionSystemStatus'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; import { css } from '@/lib/emotion'; import { Button, Typography } from '@icgc-argo/uikit'; import { FC } from 'react'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FileRecordTable.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FileRecordTable.tsx index a1b2c76a..cc232c4d 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FileRecordTable.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FileRecordTable.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { SubmissionInfoArea, TableInfoHeaderContainer } from '@/app/components/Table/common'; +import { SubmissionInfoArea, TableInfoHeaderContainer } from '@/components/Table/common'; import { css, useTheme } from '@/lib/emotion'; import { Table } from '@icgc-argo/uikit'; import { ComponentProps } from 'react'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/StatsArea.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/StatsArea.tsx index 120f263d..ada85610 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/StatsArea.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/StatsArea.tsx @@ -1,4 +1,4 @@ -import { DataTableStarIcon, StatArea as StatAreaDisplay } from '@/app/components/Table/common'; +import { DataTableStarIcon, StatArea as StatAreaDisplay } from '@/components/Table/common'; import { Icon } from '@icgc-argo/uikit'; import pluralize from 'pluralize'; import { ComponentProps } from 'react'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/TableCells.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/TableCells.tsx index 3b5adb61..6b21778c 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/TableCells.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/TableCells.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { CellContentCenter, DataTableStarIcon } from '@/app/components/Table/common'; +import { CellContentCenter, DataTableStarIcon } from '@/components/Table/common'; import { css, useTheme } from '@/lib/emotion'; import { TableCellWrapper } from '@icgc-argo/uikit'; import { get } from 'lodash'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/index.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/index.tsx index fa94836a..32a64de2 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/index.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/index.tsx @@ -17,9 +17,9 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import CLEAR_CLINICAL_SUBMISSION from '@/app/gql/clinical/CLEAR_CLINICAL_SUBMISSION'; -import { useToaster } from '@/app/hooks/ToastProvider'; -import useCommonToasters from '@/app/hooks/useCommonToasters'; +import CLEAR_CLINICAL_SUBMISSION from '@/gql/clinical/CLEAR_CLINICAL_SUBMISSION'; +import { useToaster } from '@/hooks/ToastProvider'; +import useCommonToasters from '@/hooks/useCommonToasters'; import { css } from '@/lib/emotion'; import { useMutation } from '@apollo/client'; import { Col } from 'react-grid-system'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/tableConfig.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/tableConfig.tsx index 5e96360d..788e41c0 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/tableConfig.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/tableConfig.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { CellContentCenter, DataTableStarIcon } from '@/app/components/Table/common'; +import { CellContentCenter, DataTableStarIcon } from '@/components/Table/common'; import { toDisplayRowIndex } from '@/global/utils'; import { ColumnDef, Row, css } from '@icgc-argo/uikit'; import { diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/ui.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/ui.tsx index bcc20dc9..582303c7 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/ui.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/ui.tsx @@ -17,11 +17,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { ContentPlaceholder } from '@/app/components/ContentPlaceholder'; -import ErrorNotification from '@/app/components/ErrorNotification'; +import { ContentPlaceholder } from '@/components/ContentPlaceholder'; +import ErrorNotification from '@/components/ErrorNotification'; import ErrorNotificationDefaultTable, { getDefaultErrorReportColumns, -} from '@/app/components/ErrorNotification/ErrorNotificationDefaultTable'; +} from '@/components/ErrorNotification/ErrorNotificationDefaultTable'; import { toDisplayError } from '@/global/utils'; import { css } from '@/lib/emotion'; import { NOTIFICATION_VARIANTS } from '@icgc-argo/uikit'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Header.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Header.tsx index 8ca4d84d..aa39d5ca 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Header.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Header.tsx @@ -17,19 +17,19 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { ModalPortal } from '@/app/components/Modal'; -import { BreadcrumbTitle, HelpLink, PageHeader } from '@/app/components/PageHeader/PageHeader'; -import CLEAR_CLINICAL_SUBMISSION from '@/app/gql/clinical/CLEAR_CLINICAL_SUBMISSION'; -import APPROVE_SUBMISSION_MUTATION from '@/app/gql/gateway/APPROVE_SUBMISSION_MUTATION'; -import REOPEN_SUBMISSION_MUTATION from '@/app/gql/gateway/REOPEN_SUBMISSION_MUTATION'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useAuthContext } from '@/app/hooks/AuthProvider'; -import { useGlobalLoader } from '@/app/hooks/GlobalLoaderProvider'; -import { useToaster } from '@/app/hooks/ToastProvider'; -import useCommonToasters from '@/app/hooks/useCommonToasters'; -import { useSubmissionSystemStatus } from '@/app/hooks/useSubmissionSystemStatus'; -import useUserConfirmationModalState from '@/app/hooks/useUserConfirmationModalState'; +import { ModalPortal } from '@/components/Modal'; +import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; import { sleep } from '@/global/utils'; +import CLEAR_CLINICAL_SUBMISSION from '@/gql/clinical/CLEAR_CLINICAL_SUBMISSION'; +import APPROVE_SUBMISSION_MUTATION from '@/gql/gateway/APPROVE_SUBMISSION_MUTATION'; +import REOPEN_SUBMISSION_MUTATION from '@/gql/gateway/REOPEN_SUBMISSION_MUTATION'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; +import { useGlobalLoader } from '@/hooks/GlobalLoaderProvider'; +import { useToaster } from '@/hooks/ToastProvider'; +import useCommonToasters from '@/hooks/useCommonToasters'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import useUserConfirmationModalState from '@/hooks/useUserConfirmationModalState'; import { css, useTheme } from '@/lib/emotion'; import { useMutation } from '@apollo/client'; import { Button, Modal } from '@icgc-argo/uikit'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Instructions.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Instructions.tsx index 04c7d620..6a91d3e4 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Instructions.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Instructions.tsx @@ -18,10 +18,10 @@ */ 'use client'; -import CLINICAL_SCHEMA_VERSION from '@/app/gql/clinical/CLINICAL_SCHEMA_VERSION'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useClinicalQuery } from '@/app/hooks/useApolloQuery'; import { CLINICAL_TEMPLATE_PATH } from '@/global/constants'; +import CLINICAL_SCHEMA_VERSION from '@/gql/clinical/CLINICAL_SCHEMA_VERSION'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; import { css, useTheme } from '@/lib/emotion'; import { BUTTON_SIZES, diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ProgressBar.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ProgressBar.tsx index 0886c1ca..15d477f2 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ProgressBar.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ProgressBar.tsx @@ -19,7 +19,7 @@ 'use client'; import { ClinicalSubmissionQuery } from '@/__generated__/clinical/graphql'; -import { useSubmissionSystemStatus } from '@/app/hooks/useSubmissionSystemStatus'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; import { css } from '@/lib/emotion'; import { Progress, ProgressStatus } from '@icgc-argo/uikit'; import { isEmpty } from 'lodash'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/SubmissionSummaryTable.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/SubmissionSummaryTable.tsx index ea0af906..013b4de3 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/SubmissionSummaryTable.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/SubmissionSummaryTable.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { StatArea } from '@/app/components/Table/common'; +import { StatArea } from '@/components/Table/common'; import { ColumnDef, Table, TableCellWrapper, css, useTheme } from '@icgc-argo/uikit'; import { capitalize } from 'lodash'; import { createRef } from 'react'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx index 032f4fb8..d33edae0 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx @@ -19,28 +19,15 @@ 'use client'; import { ClinicalSubmissionEntity } from '@/__generated__/clinical/graphql'; -import ContentMain from '@/app/components/Content/ContentMain'; -import ErrorNotification, { ErrorReportColumns } from '@/app/components/ErrorNotification'; +import ContentMain from '@/components/Content/ContentMain'; +import ErrorNotification, { ErrorReportColumns } from '@/components/ErrorNotification'; import { errorNotificationTableProps, getDefaultErrorTableColumns, -} from '@/app/components/ErrorNotification/ErrorNotificationDefaultTable'; -import Loader from '@/app/components/Loader'; -import { ModalPortal } from '@/app/components/Modal'; -import { pageWithPermissions } from '@/app/components/Page'; -import CLEAR_CLINICAL_SUBMISSION from '@/app/gql/clinical/CLEAR_CLINICAL_SUBMISSION'; -import CLINICAL_SUBMISSION_QUERY from '@/app/gql/clinical/CLINICAL_SUBMISSION_QUERY'; -import SIGN_OFF_SUBMISSION_MUTATION from '@/app/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION'; -import VALIDATE_SUBMISSION_MUTATION from '@/app/gql/clinical/VALIDATE_SUBMISSION_MUTATION'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useAuthContext } from '@/app/hooks/AuthProvider'; -import { useGlobalLoader } from '@/app/hooks/GlobalLoaderProvider'; -import { useToaster } from '@/app/hooks/ToastProvider'; -import { useClinicalQuery } from '@/app/hooks/useApolloQuery'; -import useCommonToasters from '@/app/hooks/useCommonToasters'; -import { useSubmissionSystemStatus } from '@/app/hooks/useSubmissionSystemStatus'; -import useUrlQueryState from '@/app/hooks/useURLQueryState'; -import useUserConfirmationModalState from '@/app/hooks/useUserConfirmationModalState'; +} from '@/components/ErrorNotification/ErrorNotificationDefaultTable'; +import Loader from '@/components/Loader'; +import { ModalPortal } from '@/components/Modal'; +import { pageWithPermissions } from '@/components/Page'; import { PROGRAM_DASHBOARD_PATH, PROGRAM_SHORT_NAME_PATH, @@ -48,6 +35,19 @@ import { } from '@/global/constants'; import { displayDateAndTime, getProgramPath, sleep, toDisplayError } from '@/global/utils'; import { createFileFormData, uploadFileRequest } from '@/global/utils/form'; +import CLEAR_CLINICAL_SUBMISSION from '@/gql/clinical/CLEAR_CLINICAL_SUBMISSION'; +import CLINICAL_SUBMISSION_QUERY from '@/gql/clinical/CLINICAL_SUBMISSION_QUERY'; +import SIGN_OFF_SUBMISSION_MUTATION from '@/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION'; +import VALIDATE_SUBMISSION_MUTATION from '@/gql/clinical/VALIDATE_SUBMISSION_MUTATION'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; +import { useGlobalLoader } from '@/hooks/GlobalLoaderProvider'; +import { useToaster } from '@/hooks/ToastProvider'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import useCommonToasters from '@/hooks/useCommonToasters'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import useUrlQueryState from '@/hooks/useURLQueryState'; +import useUserConfirmationModalState from '@/hooks/useUserConfirmationModalState'; import { css } from '@/lib/emotion'; import { useMutation as useGQLMutation } from '@apollo/client'; import { @@ -61,7 +61,7 @@ import { usePathname, useRouter } from 'next/navigation'; import { useEffect, useMemo, useState } from 'react'; import { useMutation } from 'react-query'; import urlJoin from 'url-join'; -import FileError from '../../../../../components/FileError'; +import FileError from '../../../../../../components/FileError'; import FilesNavigator from './components/FilesNavigator'; import Header from './components/Header'; import Instructions from './components/Instructions'; diff --git a/src/app/(post-login)/submission/program/[shortName]/components/ClinicalSubmissionProgressBar.tsx b/src/app/(post-login)/submission/program/[shortName]/components/ClinicalSubmissionProgressBar.tsx index ab8d8705..f90b01b3 100644 --- a/src/app/(post-login)/submission/program/[shortName]/components/ClinicalSubmissionProgressBar.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/components/ClinicalSubmissionProgressBar.tsx @@ -17,9 +17,9 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import CLINICAL_SUBMISSION_QUERY from '@/app/gql/clinical/CLINICAL_SUBMISSION_QUERY'; -import { useClinicalQuery } from '@/app/hooks/useApolloQuery'; -import { useSubmissionSystemStatus } from '@/app/hooks/useSubmissionSystemStatus'; +import CLINICAL_SUBMISSION_QUERY from '@/gql/clinical/CLINICAL_SUBMISSION_QUERY'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; import { css, Progress } from '@icgc-argo/uikit'; import { ComponentProps, ComponentType, useMemo, useState } from 'react'; diff --git a/src/app/(post-login)/submission/program/[shortName]/components/SampleRegistrationProgressBar.tsx b/src/app/(post-login)/submission/program/[shortName]/components/SampleRegistrationProgressBar.tsx index 08ddb598..535bd121 100644 --- a/src/app/(post-login)/submission/program/[shortName]/components/SampleRegistrationProgressBar.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/components/SampleRegistrationProgressBar.tsx @@ -17,9 +17,9 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import GET_REGISTRATION_QUERY from '@/app/gql/clinical/GET_REGISTRATION_QUERY'; -import { useGatewayQuery } from '@/app/hooks/useApolloQuery'; -import { useSubmissionSystemStatus } from '@/app/hooks/useSubmissionSystemStatus'; +import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; +import { useGatewayQuery } from '@/hooks/useApolloQuery'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; import { Progress } from '@icgc-argo/uikit'; import get from 'lodash/get'; import { ComponentProps, ComponentType } from 'react'; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/index.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/index.tsx index c22b75e9..1485e382 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/index.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/index.tsx @@ -17,11 +17,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { ContentError, ContentLoader } from '@/app/components/placeholders'; -import DASHBOARD_SUMMARY_QUERY from '@/app/gql/gateway/DASHBOARD_SUMMARY_QUERY'; -import PROGRAM_DONOR_PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY from '@/app/gql/gateway/PROGRAM_DONOR_PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY'; -import { useGatewayQuery } from '@/app/hooks/useApolloQuery'; -import { useTimeout } from '@/app/hooks/useTimeout'; +import { ContentError, ContentLoader } from '@/components/placeholders'; +import DASHBOARD_SUMMARY_QUERY from '@/gql/gateway/DASHBOARD_SUMMARY_QUERY'; +import PROGRAM_DONOR_PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY from '@/gql/gateway/PROGRAM_DONOR_PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY'; +import { useGatewayQuery } from '@/hooks/useApolloQuery'; +import { useTimeout } from '@/hooks/useTimeout'; import { QueryHookOptions, useQuery } from '@apollo/client'; import { Typography, css, useElementDimension, useTheme } from '@icgc-argo/uikit'; import { format as formatDate, subDays } from 'date-fns'; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx index 501fde07..05b147c9 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx @@ -18,11 +18,11 @@ */ import { DonorSummaryEntry } from '@/__generated__/gateway/graphql'; -import { CellContentCenter, DataTableStarIcon as StarIcon } from '@/app/components/Table/common'; -import { ContentError } from '@/app/components/placeholders'; -import CLINICAL_ERRORS_QUERY from '@/app/gql/clinical/CLINICAL_ERRORS_QUERY'; -import { useClinicalQuery } from '@/app/hooks/useApolloQuery'; +import { CellContentCenter, DataTableStarIcon as StarIcon } from '@/components/Table/common'; +import { ContentError } from '@/components/placeholders'; import { displayDate, parseDonorIdString } from '@/global/utils'; +import CLINICAL_ERRORS_QUERY from '@/gql/clinical/CLINICAL_ERRORS_QUERY'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; import { ColumnDef, DEFAULT_TABLE_PAGE_SIZE, diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableLegend.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableLegend.tsx index c9448aef..4cfd6c2a 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableLegend.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableLegend.tsx @@ -23,7 +23,7 @@ import { TableLegendEntry, TableLegendSection, TableLegendStatusIcon, -} from '@/app/components/Table/common'; +} from '@/components/Table/common'; import { Icon, Typography, css, useTheme } from '@icgc-argo/uikit'; import { Col, Row } from 'react-grid-system'; import { diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableStatArea.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableStatArea.tsx index 713a4771..52949b40 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableStatArea.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableStatArea.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { StatArea as StatAreaDisplay } from '@/app/components/Table/common'; +import { StatArea as StatAreaDisplay } from '@/components/Table/common'; import { css, Icon, useTheme } from '@icgc-argo/uikit'; import { EMPTY_PROGRAM_SUMMARY_STATS, diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx index d7b77496..8f6ea6ba 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx @@ -17,9 +17,9 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useToaster } from '@/app/hooks/ToastProvider'; import { EGO_JWT_KEY } from '@/global/constants'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useToaster } from '@/hooks/ToastProvider'; import { Button, css, Icon, TOAST_VARIANTS } from '@icgc-argo/uikit'; import { format as formatDate } from 'date-fns'; import { saveAs } from 'file-saver'; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx index aad29b27..b527a388 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/app/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import { ContentPlaceholder, css, Link, styled, Typography } from '@icgc-argo/uikit'; import urljoin from 'url-join'; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/common.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/common.tsx index 6346578a..1eba4fe4 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/common.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/common.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { DataTableStarIcon as StarIcon } from '@/app/components/Table/common'; +import { DataTableStarIcon as StarIcon } from '@/components/Table/common'; import { ComponentProps } from 'react'; import { DonorDataReleaseState, diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/index.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/index.tsx index f6ab7829..755232dd 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/index.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/index.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { ContentError } from '@/app/components/placeholders'; +import { ContentError } from '@/components/placeholders'; import { Typography, css } from '@icgc-argo/uikit'; import { Col, Row } from 'react-grid-system'; import { DashboardCard } from '../common'; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx index bf245269..dfdc0097 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx @@ -17,9 +17,9 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import PROGRAM_DONOR_SUMMARY_QUERY from '@/app/gql/gateway/PROGRAM_DONOR_SUMMARY_QUERY'; -import { useGatewayQuery } from '@/app/hooks/useApolloQuery'; -import { useTimeout } from '@/app/hooks/useTimeout'; +import PROGRAM_DONOR_SUMMARY_QUERY from '@/gql/gateway/PROGRAM_DONOR_SUMMARY_QUERY'; +import { useGatewayQuery } from '@/hooks/useApolloQuery'; +import { useTimeout } from '@/hooks/useTimeout'; import { QueryHookOptions } from '@apollo/client'; import { POLL_INTERVAL_MILLISECONDS } from '../../common'; import { diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorReleaseSummary/index.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorReleaseSummary/index.tsx index ed10c8b6..d0e32bfe 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorReleaseSummary/index.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorReleaseSummary/index.tsx @@ -17,8 +17,8 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import DASHBOARD_SUMMARY_QUERY from '@/app/gql/gateway/DASHBOARD_SUMMARY_QUERY'; -import { useGatewayQuery } from '@/app/hooks/useApolloQuery'; +import DASHBOARD_SUMMARY_QUERY from '@/gql/gateway/DASHBOARD_SUMMARY_QUERY'; +import { useGatewayQuery } from '@/hooks/useApolloQuery'; import { css, Typography } from '@icgc-argo/uikit'; import { DashboardCard } from '../common'; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ProgramWorkspaceStatus/index.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ProgramWorkspaceStatus/index.tsx index d5c24b2d..66d4e88a 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ProgramWorkspaceStatus/index.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ProgramWorkspaceStatus/index.tsx @@ -17,8 +17,8 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAuthContext } from '@/app/hooks/AuthProvider'; -import useUserRole from '@/app/hooks/useUserRole'; +import { useAuthContext } from '@/hooks/AuthProvider'; +import useUserRole from '@/hooks/useUserRole'; import { css, HyperLinkProps, Link, Typography } from '@icgc-argo/uikit'; import { diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/StatsBar/index.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/StatsBar/index.tsx index 7cfc46fd..17881928 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/StatsBar/index.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/components/StatsBar/index.tsx @@ -17,9 +17,9 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import DASHBOARD_SUMMARY_QUERY from '@/app/gql/gateway/DASHBOARD_SUMMARY_QUERY'; -import { useGatewayQuery } from '@/app/hooks/useApolloQuery'; -import { useTimeout } from '@/app/hooks/useTimeout'; +import DASHBOARD_SUMMARY_QUERY from '@/gql/gateway/DASHBOARD_SUMMARY_QUERY'; +import { useGatewayQuery } from '@/hooks/useApolloQuery'; +import { useTimeout } from '@/hooks/useTimeout'; import { Container, css, PercentBar, styled, Typography } from '@icgc-argo/uikit'; import { ComponentType, ReactNode } from 'react'; import { Col, Row } from 'react-grid-system'; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx index 60c7f67f..17bbf5c7 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx @@ -19,10 +19,10 @@ 'use client'; -import ContentMain from '@/app/components/Content/ContentMain'; -import { pageWithPermissions } from '@/app/components/Page'; -import { BreadcrumbTitle, HelpLink, PageHeader } from '@/app/components/PageHeader/PageHeader'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; +import ContentMain from '@/components/Content/ContentMain'; +import { pageWithPermissions } from '@/components/Page'; +import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import { css, styled } from '@/lib/emotion'; import { Col, Row, ScreenClassRender, setConfiguration } from 'react-grid-system'; import urlJoin from 'url-join'; diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/FileTable.tsx b/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/FileTable.tsx index 40ece875..b63136b7 100644 --- a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/FileTable.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/FileTable.tsx @@ -23,7 +23,7 @@ import { StatArea as StatAreaDisplay, SubmissionInfoArea, TableInfoHeaderContainer, -} from '@/app/components/Table/common'; +} from '@/components/Table/common'; import { toDisplayRowIndex } from '@/global/utils/clinical'; import { ColumnDef, Icon, Table, css } from '@icgc-argo/uikit'; import memoize from 'lodash/memoize'; diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx b/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx index 2b0bb0ce..310402c9 100644 --- a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx @@ -19,8 +19,8 @@ 'use client'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; import { CLINICAL_TEMPLATE_PATH, CONTACT_PAGE_PATH } from '@/global/constants'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import { css } from '@/lib/emotion'; import { BUTTON_SIZES, diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/RegisterSampleModal.tsx b/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/RegisterSampleModal.tsx index e2353384..b0223008 100644 --- a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/RegisterSampleModal.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/RegisterSampleModal.tsx @@ -17,17 +17,17 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { ModalPortal } from '@/app/components/Modal'; -import COMMIT_CLINICAL_REGISTRATION_MUTATION from '@/app/gql/clinical/COMMIT_CLINICAL_REGISTRATION_MUTATION'; -import GET_REGISTRATION_QUERY from '@/app/gql/clinical/GET_REGISTRATION_QUERY'; -import { useGlobalLoader } from '@/app/hooks/GlobalLoaderProvider'; -import { useToaster } from '@/app/hooks/ToastProvider'; +import { ModalPortal } from '@/components/Modal'; import { CONTACT_PAGE_PATH, PROGRAM_DASHBOARD_PATH, PROGRAM_SHORT_NAME_PATH, } from '@/global/constants'; import { sleep } from '@/global/utils'; +import COMMIT_CLINICAL_REGISTRATION_MUTATION from '@/gql/clinical/COMMIT_CLINICAL_REGISTRATION_MUTATION'; +import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; +import { useGlobalLoader } from '@/hooks/GlobalLoaderProvider'; +import { useToaster } from '@/hooks/ToastProvider'; import { useMutation } from '@apollo/client'; import { Modal, TOAST_VARIANTS, Typography, Link as UIKitLink } from '@icgc-argo/uikit'; import { get } from 'lodash'; diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/page.tsx b/src/app/(post-login)/submission/program/[shortName]/sample-registration/page.tsx index 45b8d92f..e05eefad 100644 --- a/src/app/(post-login)/submission/program/[shortName]/sample-registration/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/sample-registration/page.tsx @@ -20,23 +20,23 @@ import Instructions from '@/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions'; import ProgressBar from '@/app/(post-login)/submission/program/[shortName]/sample-registration/components/ProgressBar'; -import Card from '@/app/components/Card'; -import ContentMain from '@/app/components/Content/ContentMain'; -import NoDataMessage from '@/app/components/NoData'; -import { pageWithPermissions } from '@/app/components/Page'; -import { BreadcrumbTitle, HelpLink, PageHeader } from '@/app/components/PageHeader/PageHeader'; -import CLEAR_CLINICAL_REGISTRATION_MUTATION from '@/app/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION'; -import CLINICAL_SCHEMA_VERSION from '@/app/gql/clinical/CLINICAL_SCHEMA_VERSION'; -import GET_REGISTRATION_QUERY from '@/app/gql/clinical/GET_REGISTRATION_QUERY'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useAuthContext } from '@/app/hooks/AuthProvider'; -import { useToaster } from '@/app/hooks/ToastProvider'; -import { useClinicalQuery } from '@/app/hooks/useApolloQuery'; -import useCommonToasters from '@/app/hooks/useCommonToasters'; -import { useSubmissionSystemStatus } from '@/app/hooks/useSubmissionSystemStatus'; +import Card from '@/components/Card'; +import ContentMain from '@/components/Content/ContentMain'; +import NoDataMessage from '@/components/NoData'; +import { pageWithPermissions } from '@/components/Page'; +import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; import { UPLOAD_REGISTRATION } from '@/global/constants'; import { getProgramPath, notNull } from '@/global/utils'; import { createFileFormData, uploadFileRequest } from '@/global/utils/form'; +import CLEAR_CLINICAL_REGISTRATION_MUTATION from '@/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION'; +import CLINICAL_SCHEMA_VERSION from '@/gql/clinical/CLINICAL_SCHEMA_VERSION'; +import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; +import { useToaster } from '@/hooks/ToastProvider'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import useCommonToasters from '@/hooks/useCommonToasters'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; import { css } from '@/lib/emotion'; import { useMutation as useGQLMutation, useQuery } from '@apollo/client'; import { @@ -51,7 +51,7 @@ import { get } from 'lodash'; import { useState } from 'react'; import { useMutation } from 'react-query'; import urlJoin from 'url-join'; -import FileError from '../../../../../components/FileError'; +import FileError from '../../../../../../components/FileError'; import FilePreview from './components/FilePreview'; import RegisterSamplesModal from './components/RegisterSampleModal'; import UploadError from './components/UploadError'; diff --git a/src/app/(post-login)/submission/program/page.tsx b/src/app/(post-login)/submission/program/page.tsx index dc067aee..764b95d1 100644 --- a/src/app/(post-login)/submission/program/page.tsx +++ b/src/app/(post-login)/submission/program/page.tsx @@ -19,12 +19,12 @@ 'use client'; -import { BreadcrumbTitle, PageHeader } from '@/app/components/PageHeader/PageHeader'; -import PROGRAMS_LIST_QUERY from '@/app/gql/gateway/PROGRAMS_LIST_QUERY'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useGatewayQuery } from '@/app/hooks/useApolloQuery'; +import { BreadcrumbTitle, PageHeader } from '@/components/PageHeader/PageHeader'; import { CREATE_PROGRAM_PAGE_PATH } from '@/global/constants'; import { notNull } from '@/global/utils'; +import PROGRAMS_LIST_QUERY from '@/gql/gateway/PROGRAMS_LIST_QUERY'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useGatewayQuery } from '@/hooks/useApolloQuery'; import { Button, Loader } from '@icgc-argo/uikit'; import Link from 'next/link'; import { notFound } from 'next/navigation'; diff --git a/src/app/(pre-login)/contact/page.tsx b/src/app/(pre-login)/contact/page.tsx index 621f0215..6466beb0 100644 --- a/src/app/(pre-login)/contact/page.tsx +++ b/src/app/(pre-login)/contact/page.tsx @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved + * Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved * * This program and the accompanying materials are made available under the terms of * the GNU Affero General Public License v3.0. You should have received a copy of the @@ -18,25 +18,6 @@ */ 'use client'; -import { css, useTheme } from '@icgc-argo/uikit'; -import { Row } from 'react-grid-system'; -import Form from './components/form'; -import Info from './components/info'; +import Contact from '@/components/views/contact/Contact'; -const Contact = () => { - const theme = useTheme(); - return ( - - -
- - ); -}; - -export default Contact; +export default () => ; diff --git a/src/app/(pre-login)/logging-in/page.tsx b/src/app/(pre-login)/logging-in/page.tsx index c3e0a037..42b0939c 100644 --- a/src/app/(pre-login)/logging-in/page.tsx +++ b/src/app/(pre-login)/logging-in/page.tsx @@ -18,8 +18,8 @@ */ 'use client'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; -import { useAuthContext } from '@/app/hooks/AuthProvider'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; import { DnaLoader, css, useTheme } from '@icgc-argo/uikit'; import { useRouter } from 'next/navigation'; import { useQuery } from 'react-query'; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 837b9f3d..809f8d37 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -22,7 +22,7 @@ import { BUILD_TIME_VARIABLES } from '@/global/constants'; import { ReactNode } from 'react'; -import App from './App'; +import App from '../App'; async function getAppConfig() { // cache: "no-store" ensures it's run server side diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx index c9bbf00e..11a8de4d 100644 --- a/src/app/not-found.tsx +++ b/src/app/not-found.tsx @@ -26,7 +26,7 @@ import NextLink from 'next/link'; import { Col, Row } from 'react-grid-system'; import dnaBrokenImage from '../../public/assets/dna-broken.svg'; import logoMarkImage from '../../public/assets/logomark.svg'; -import { useAppConfigContext } from './hooks/AppProvider'; +import { useAppConfigContext } from '../hooks/AppProvider'; export default function Error404Page() { const { DOCS_URL_ROOT } = useAppConfigContext(); diff --git a/src/app/page.tsx b/src/app/page.tsx index d0439c3d..2f39ce87 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -18,13 +18,13 @@ */ 'use client'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import { css, useTheme } from '@/lib/emotion'; import { DataCallout, Link, Typography, overtureLogo } from '@icgc-argo/uikit'; import Image from 'next/image'; import { ComponentType } from 'react'; import urlJoin from 'url-join'; -import Hero from './components/Hero'; +import Hero from '../components/Hero'; const OvertureBanner: ComponentType = () => { const theme = useTheme(); diff --git a/src/app/components/Card.tsx b/src/components/Card.tsx similarity index 100% rename from src/app/components/Card.tsx rename to src/components/Card.tsx diff --git a/src/app/components/Content/ContentMain.tsx b/src/components/Content/ContentMain.tsx similarity index 100% rename from src/app/components/Content/ContentMain.tsx rename to src/components/Content/ContentMain.tsx diff --git a/src/app/components/ContentPlaceholder.tsx b/src/components/ContentPlaceholder.tsx similarity index 100% rename from src/app/components/ContentPlaceholder.tsx rename to src/components/ContentPlaceholder.tsx diff --git a/src/app/components/ErrorNotification/ErrorNotificationDefaultTable.tsx b/src/components/ErrorNotification/ErrorNotificationDefaultTable.tsx similarity index 100% rename from src/app/components/ErrorNotification/ErrorNotificationDefaultTable.tsx rename to src/components/ErrorNotification/ErrorNotificationDefaultTable.tsx diff --git a/src/app/components/ErrorNotification/index.tsx b/src/components/ErrorNotification/index.tsx similarity index 100% rename from src/app/components/ErrorNotification/index.tsx rename to src/components/ErrorNotification/index.tsx diff --git a/src/app/components/FadingDiv.tsx b/src/components/FadingDiv.tsx similarity index 100% rename from src/app/components/FadingDiv.tsx rename to src/components/FadingDiv.tsx diff --git a/src/app/components/FileError.tsx b/src/components/FileError.tsx similarity index 100% rename from src/app/components/FileError.tsx rename to src/components/FileError.tsx diff --git a/src/app/components/Footer.tsx b/src/components/Footer.tsx similarity index 98% rename from src/app/components/Footer.tsx rename to src/components/Footer.tsx index 2e415bc0..c66ddb3c 100644 --- a/src/app/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/app/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import { css, useTheme } from '@/lib/emotion'; import { Icon, Link } from '@icgc-argo/uikit'; import { Fragment } from 'react'; diff --git a/src/app/components/Header.tsx b/src/components/Header.tsx similarity index 98% rename from src/app/components/Header.tsx rename to src/components/Header.tsx index 6c99fcd2..82bfc819 100644 --- a/src/app/components/Header.tsx +++ b/src/components/Header.tsx @@ -18,7 +18,7 @@ */ 'use client'; -import { useAuthContext } from '@/app/hooks/AuthProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; import { css, useTheme } from '@/lib/emotion'; import { AppBarMenuItem, DnaLoader, Link, NavElement } from '@icgc-argo/uikit'; import Image from 'next/image'; diff --git a/src/app/components/Hero.tsx b/src/components/Hero.tsx similarity index 98% rename from src/app/components/Hero.tsx rename to src/components/Hero.tsx index 0a0d11c4..0b8a1c1c 100644 --- a/src/app/components/Hero.tsx +++ b/src/components/Hero.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/app/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import { BUTTON_SIZES, Button, Icon, Typography, css, useTheme } from '@icgc-argo/uikit'; import Link from 'next/link'; import galaxyImage from '../../../public/assets/galaxy.png'; diff --git a/src/app/components/Loader.tsx b/src/components/Loader.tsx similarity index 100% rename from src/app/components/Loader.tsx rename to src/components/Loader.tsx diff --git a/src/app/components/LoginButton.tsx b/src/components/LoginButton.tsx similarity index 97% rename from src/app/components/LoginButton.tsx rename to src/components/LoginButton.tsx index 8dcb02d6..f0ada602 100644 --- a/src/app/components/LoginButton.tsx +++ b/src/components/LoginButton.tsx @@ -18,7 +18,7 @@ */ 'use client'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import { css } from '@/lib/emotion'; import { Button, Icon, useTheme } from '@icgc-argo/uikit'; diff --git a/src/app/components/Modal.tsx b/src/components/Modal.tsx similarity index 100% rename from src/app/components/Modal.tsx rename to src/components/Modal.tsx diff --git a/src/app/components/NoData.tsx b/src/components/NoData.tsx similarity index 100% rename from src/app/components/NoData.tsx rename to src/components/NoData.tsx diff --git a/src/app/components/Page.tsx b/src/components/Page.tsx similarity index 97% rename from src/app/components/Page.tsx rename to src/components/Page.tsx index 982c7526..1de7c31b 100644 --- a/src/app/components/Page.tsx +++ b/src/components/Page.tsx @@ -18,7 +18,7 @@ */ 'use client'; -import { useAuthContext } from '@/app/hooks/AuthProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; import { EmotionJSX } from '@emotion/react/types/jsx-namespace'; import { DnaLoader, css } from '@icgc-argo/uikit'; import { redirect } from 'next/navigation'; diff --git a/src/app/components/PageHeader/PageHeader.tsx b/src/components/PageHeader/PageHeader.tsx similarity index 100% rename from src/app/components/PageHeader/PageHeader.tsx rename to src/components/PageHeader/PageHeader.tsx diff --git a/src/app/components/PageHeader/TitleBar.tsx b/src/components/PageHeader/TitleBar.tsx similarity index 100% rename from src/app/components/PageHeader/TitleBar.tsx rename to src/components/PageHeader/TitleBar.tsx diff --git a/src/app/components/ProfileMenu.tsx b/src/components/ProfileMenu.tsx similarity index 100% rename from src/app/components/ProfileMenu.tsx rename to src/components/ProfileMenu.tsx diff --git a/src/app/components/RegionBanner.tsx b/src/components/RegionBanner.tsx similarity index 100% rename from src/app/components/RegionBanner.tsx rename to src/components/RegionBanner.tsx diff --git a/src/app/components/Table/common.tsx b/src/components/Table/common.tsx similarity index 100% rename from src/app/components/Table/common.tsx rename to src/components/Table/common.tsx diff --git a/src/app/components/placeholders/ContentError.tsx b/src/components/placeholders/ContentError.tsx similarity index 100% rename from src/app/components/placeholders/ContentError.tsx rename to src/components/placeholders/ContentError.tsx diff --git a/src/app/components/placeholders/ContentLoader.tsx b/src/components/placeholders/ContentLoader.tsx similarity index 100% rename from src/app/components/placeholders/ContentLoader.tsx rename to src/components/placeholders/ContentLoader.tsx diff --git a/src/app/components/placeholders/index.tsx b/src/components/placeholders/index.tsx similarity index 100% rename from src/app/components/placeholders/index.tsx rename to src/components/placeholders/index.tsx diff --git a/src/components/views/contact/Contact.tsx b/src/components/views/contact/Contact.tsx new file mode 100644 index 00000000..621f0215 --- /dev/null +++ b/src/components/views/contact/Contact.tsx @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved + * + * This program and the accompanying materials are made available under the terms of + * the GNU Affero General Public License v3.0. You should have received a copy of the + * GNU Affero General Public License along with this program. + * If not, see . + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +'use client'; + +import { css, useTheme } from '@icgc-argo/uikit'; +import { Row } from 'react-grid-system'; +import Form from './components/form'; +import Info from './components/info'; + +const Contact = () => { + const theme = useTheme(); + return ( + + + + + ); +}; + +export default Contact; diff --git a/src/app/(pre-login)/contact/components/form.tsx b/src/components/views/contact/components/form.tsx similarity index 99% rename from src/app/(pre-login)/contact/components/form.tsx rename to src/components/views/contact/components/form.tsx index fd26314a..4638cd8b 100644 --- a/src/app/(pre-login)/contact/components/form.tsx +++ b/src/components/views/contact/components/form.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/app/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import { zodResolver } from '@hookform/resolvers/zod'; import { Button, diff --git a/src/app/(pre-login)/contact/components/info.tsx b/src/components/views/contact/components/info.tsx similarity index 98% rename from src/app/(pre-login)/contact/components/info.tsx rename to src/components/views/contact/components/info.tsx index f1fdbf9e..16c8eec3 100644 --- a/src/app/(pre-login)/contact/components/info.tsx +++ b/src/components/views/contact/components/info.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/app/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import { Button, Link, Typography, css, useTheme } from '@icgc-argo/uikit'; import { Col } from 'react-grid-system'; import urljoin from 'url-join'; diff --git a/src/app/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION.ts b/src/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION.ts similarity index 100% rename from src/app/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION.ts rename to src/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION.ts diff --git a/src/app/gql/clinical/CLEAR_CLINICAL_SUBMISSION.ts b/src/gql/clinical/CLEAR_CLINICAL_SUBMISSION.ts similarity index 100% rename from src/app/gql/clinical/CLEAR_CLINICAL_SUBMISSION.ts rename to src/gql/clinical/CLEAR_CLINICAL_SUBMISSION.ts diff --git a/src/app/gql/clinical/CLINICAL_ENTITY_DATA_QUERY.ts b/src/gql/clinical/CLINICAL_ENTITY_DATA_QUERY.ts similarity index 100% rename from src/app/gql/clinical/CLINICAL_ENTITY_DATA_QUERY.ts rename to src/gql/clinical/CLINICAL_ENTITY_DATA_QUERY.ts diff --git a/src/app/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY.ts b/src/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY.ts similarity index 100% rename from src/app/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY.ts rename to src/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY.ts diff --git a/src/app/gql/clinical/CLINICAL_ERRORS_QUERY.ts b/src/gql/clinical/CLINICAL_ERRORS_QUERY.ts similarity index 100% rename from src/app/gql/clinical/CLINICAL_ERRORS_QUERY.ts rename to src/gql/clinical/CLINICAL_ERRORS_QUERY.ts diff --git a/src/app/gql/clinical/CLINICAL_SCHEMA_VERSION.ts b/src/gql/clinical/CLINICAL_SCHEMA_VERSION.ts similarity index 100% rename from src/app/gql/clinical/CLINICAL_SCHEMA_VERSION.ts rename to src/gql/clinical/CLINICAL_SCHEMA_VERSION.ts diff --git a/src/app/gql/clinical/CLINICAL_SUBMISSION_FRAGMENT.ts b/src/gql/clinical/CLINICAL_SUBMISSION_FRAGMENT.ts similarity index 100% rename from src/app/gql/clinical/CLINICAL_SUBMISSION_FRAGMENT.ts rename to src/gql/clinical/CLINICAL_SUBMISSION_FRAGMENT.ts diff --git a/src/app/gql/clinical/CLINICAL_SUBMISSION_QUERY.ts b/src/gql/clinical/CLINICAL_SUBMISSION_QUERY.ts similarity index 100% rename from src/app/gql/clinical/CLINICAL_SUBMISSION_QUERY.ts rename to src/gql/clinical/CLINICAL_SUBMISSION_QUERY.ts diff --git a/src/app/gql/clinical/CLINICAL_SUBMISSION_SYSTEM_STATUS.ts b/src/gql/clinical/CLINICAL_SUBMISSION_SYSTEM_STATUS.ts similarity index 100% rename from src/app/gql/clinical/CLINICAL_SUBMISSION_SYSTEM_STATUS.ts rename to src/gql/clinical/CLINICAL_SUBMISSION_SYSTEM_STATUS.ts diff --git a/src/app/gql/clinical/COMMIT_CLINICAL_REGISTRATION_MUTATION.ts b/src/gql/clinical/COMMIT_CLINICAL_REGISTRATION_MUTATION.ts similarity index 100% rename from src/app/gql/clinical/COMMIT_CLINICAL_REGISTRATION_MUTATION.ts rename to src/gql/clinical/COMMIT_CLINICAL_REGISTRATION_MUTATION.ts diff --git a/src/app/gql/clinical/GET_REGISTRATION_QUERY.ts b/src/gql/clinical/GET_REGISTRATION_QUERY.ts similarity index 100% rename from src/app/gql/clinical/GET_REGISTRATION_QUERY.ts rename to src/gql/clinical/GET_REGISTRATION_QUERY.ts diff --git a/src/app/gql/clinical/REGISTRATION_FRAGMENT.ts b/src/gql/clinical/REGISTRATION_FRAGMENT.ts similarity index 100% rename from src/app/gql/clinical/REGISTRATION_FRAGMENT.ts rename to src/gql/clinical/REGISTRATION_FRAGMENT.ts diff --git a/src/app/gql/clinical/SIDEMENU_PROGRAM_STATUS.ts b/src/gql/clinical/SIDEMENU_PROGRAM_STATUS.ts similarity index 100% rename from src/app/gql/clinical/SIDEMENU_PROGRAM_STATUS.ts rename to src/gql/clinical/SIDEMENU_PROGRAM_STATUS.ts diff --git a/src/app/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION.ts b/src/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION.ts similarity index 100% rename from src/app/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION.ts rename to src/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION.ts diff --git a/src/app/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY.ts b/src/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY.ts similarity index 100% rename from src/app/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY.ts rename to src/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY.ts diff --git a/src/app/gql/clinical/VALIDATE_SUBMISSION_MUTATION.ts b/src/gql/clinical/VALIDATE_SUBMISSION_MUTATION.ts similarity index 100% rename from src/app/gql/clinical/VALIDATE_SUBMISSION_MUTATION.ts rename to src/gql/clinical/VALIDATE_SUBMISSION_MUTATION.ts diff --git a/src/app/gql/gateway/APPROVE_SUBMISSION_MUTATION.ts b/src/gql/gateway/APPROVE_SUBMISSION_MUTATION.ts similarity index 100% rename from src/app/gql/gateway/APPROVE_SUBMISSION_MUTATION.ts rename to src/gql/gateway/APPROVE_SUBMISSION_MUTATION.ts diff --git a/src/app/gql/gateway/DASHBOARD_SUMMARY_QUERY.ts b/src/gql/gateway/DASHBOARD_SUMMARY_QUERY.ts similarity index 100% rename from src/app/gql/gateway/DASHBOARD_SUMMARY_QUERY.ts rename to src/gql/gateway/DASHBOARD_SUMMARY_QUERY.ts diff --git a/src/app/gql/gateway/PROGRAMS_LIST_QUERY.ts b/src/gql/gateway/PROGRAMS_LIST_QUERY.ts similarity index 100% rename from src/app/gql/gateway/PROGRAMS_LIST_QUERY.ts rename to src/gql/gateway/PROGRAMS_LIST_QUERY.ts diff --git a/src/app/gql/gateway/PROGRAM_DONOR_PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY.ts b/src/gql/gateway/PROGRAM_DONOR_PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY.ts similarity index 100% rename from src/app/gql/gateway/PROGRAM_DONOR_PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY.ts rename to src/gql/gateway/PROGRAM_DONOR_PUBLISHED_ANALYSIS_BY_DATE_RANGE_QUERY.ts diff --git a/src/app/gql/gateway/PROGRAM_DONOR_SUMMARY_QUERY.ts b/src/gql/gateway/PROGRAM_DONOR_SUMMARY_QUERY.ts similarity index 100% rename from src/app/gql/gateway/PROGRAM_DONOR_SUMMARY_QUERY.ts rename to src/gql/gateway/PROGRAM_DONOR_SUMMARY_QUERY.ts diff --git a/src/app/gql/gateway/REOPEN_SUBMISSION_MUTATION.ts b/src/gql/gateway/REOPEN_SUBMISSION_MUTATION.ts similarity index 100% rename from src/app/gql/gateway/REOPEN_SUBMISSION_MUTATION.ts rename to src/gql/gateway/REOPEN_SUBMISSION_MUTATION.ts diff --git a/src/app/gql/gateway/SIDEMENU_PROGRAMS.ts b/src/gql/gateway/SIDEMENU_PROGRAMS.ts similarity index 100% rename from src/app/gql/gateway/SIDEMENU_PROGRAMS.ts rename to src/gql/gateway/SIDEMENU_PROGRAMS.ts diff --git a/src/app/gql/gateway/UPLOAD_CLINICAL_SUBMISSION_MUTATION.ts b/src/gql/gateway/UPLOAD_CLINICAL_SUBMISSION_MUTATION.ts similarity index 100% rename from src/app/gql/gateway/UPLOAD_CLINICAL_SUBMISSION_MUTATION.ts rename to src/gql/gateway/UPLOAD_CLINICAL_SUBMISSION_MUTATION.ts diff --git a/src/app/gql/gateway/UPLOAD_REGISTRATION_MUTATION.ts b/src/gql/gateway/UPLOAD_REGISTRATION_MUTATION.ts similarity index 100% rename from src/app/gql/gateway/UPLOAD_REGISTRATION_MUTATION.ts rename to src/gql/gateway/UPLOAD_REGISTRATION_MUTATION.ts diff --git a/src/app/hooks/ApolloProvider.tsx b/src/hooks/ApolloProvider.tsx similarity index 96% rename from src/app/hooks/ApolloProvider.tsx rename to src/hooks/ApolloProvider.tsx index 75d01128..422ca4ae 100644 --- a/src/app/hooks/ApolloProvider.tsx +++ b/src/hooks/ApolloProvider.tsx @@ -19,7 +19,7 @@ 'use client'; -import { useAuthContext } from '@/app/hooks/AuthProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; import { createApolloClient } from '@/lib/gql'; import { ApolloProvider as DefaultApolloProvider } from '@apollo/client'; import { ReactNode } from 'react'; diff --git a/src/app/hooks/AppProvider.tsx b/src/hooks/AppProvider.tsx similarity index 100% rename from src/app/hooks/AppProvider.tsx rename to src/hooks/AppProvider.tsx diff --git a/src/app/hooks/AuthProvider.tsx b/src/hooks/AuthProvider.tsx similarity index 98% rename from src/app/hooks/AuthProvider.tsx rename to src/hooks/AuthProvider.tsx index decd3342..a8ab3132 100644 --- a/src/app/hooks/AuthProvider.tsx +++ b/src/hooks/AuthProvider.tsx @@ -18,10 +18,10 @@ */ 'use client'; -import Header from '@/app/components/Header'; -import { useAppConfigContext } from '@/app/hooks/AppProvider'; +import Header from '@/components/Header'; import { EGO_JWT_KEY, LOGIN_NONCE } from '@/global/constants'; import { getFilename } from '@/global/utils/stringUtils'; +import { useAppConfigContext } from '@/hooks/AppProvider'; import createEgoUtils from '@icgc-argo/ego-token-utils'; import { DnaLoader } from '@icgc-argo/uikit'; import Cookies from 'js-cookie'; diff --git a/src/app/hooks/GlobalLoaderProvider.tsx b/src/hooks/GlobalLoaderProvider.tsx similarity index 96% rename from src/app/hooks/GlobalLoaderProvider.tsx rename to src/hooks/GlobalLoaderProvider.tsx index a71e882c..dc5b2595 100644 --- a/src/app/hooks/GlobalLoaderProvider.tsx +++ b/src/hooks/GlobalLoaderProvider.tsx @@ -17,8 +17,8 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { FadingDiv } from '@/app/components/FadingDiv'; -import { fillAvailableHeight, fillAvailableWidth } from '@/app/components/Modal'; +import { FadingDiv } from '@/components/FadingDiv'; +import { fillAvailableHeight, fillAvailableWidth } from '@/components/Modal'; import { DnaLoader, Modal, css } from '@icgc-argo/uikit'; import { FC, ReactNode, createContext, createRef, useContext, useState } from 'react'; import ReactDOM from 'react-dom'; diff --git a/src/app/hooks/ThemeProvider.tsx b/src/hooks/ThemeProvider.tsx similarity index 100% rename from src/app/hooks/ThemeProvider.tsx rename to src/hooks/ThemeProvider.tsx diff --git a/src/app/hooks/ToastProvider.tsx b/src/hooks/ToastProvider.tsx similarity index 100% rename from src/app/hooks/ToastProvider.tsx rename to src/hooks/ToastProvider.tsx diff --git a/src/app/hooks/useApolloQuery.tsx b/src/hooks/useApolloQuery.tsx similarity index 100% rename from src/app/hooks/useApolloQuery.tsx rename to src/hooks/useApolloQuery.tsx diff --git a/src/app/hooks/useCommonToasters.tsx b/src/hooks/useCommonToasters.tsx similarity index 100% rename from src/app/hooks/useCommonToasters.tsx rename to src/hooks/useCommonToasters.tsx diff --git a/src/app/hooks/usePageContext.tsx b/src/hooks/usePageContext.tsx similarity index 100% rename from src/app/hooks/usePageContext.tsx rename to src/hooks/usePageContext.tsx diff --git a/src/app/hooks/useSubmissionSystemStatus.tsx b/src/hooks/useSubmissionSystemStatus.tsx similarity index 100% rename from src/app/hooks/useSubmissionSystemStatus.tsx rename to src/hooks/useSubmissionSystemStatus.tsx diff --git a/src/app/hooks/useTimeout.tsx b/src/hooks/useTimeout.tsx similarity index 100% rename from src/app/hooks/useTimeout.tsx rename to src/hooks/useTimeout.tsx diff --git a/src/app/hooks/useURLQueryState.tsx b/src/hooks/useURLQueryState.tsx similarity index 100% rename from src/app/hooks/useURLQueryState.tsx rename to src/hooks/useURLQueryState.tsx diff --git a/src/app/hooks/useUrlParamState.ts b/src/hooks/useUrlParamState.ts similarity index 100% rename from src/app/hooks/useUrlParamState.ts rename to src/hooks/useUrlParamState.ts diff --git a/src/app/hooks/useUserConfirmationModalState.tsx b/src/hooks/useUserConfirmationModalState.tsx similarity index 100% rename from src/app/hooks/useUserConfirmationModalState.tsx rename to src/hooks/useUserConfirmationModalState.tsx diff --git a/src/app/hooks/useUserRole.tsx b/src/hooks/useUserRole.tsx similarity index 100% rename from src/app/hooks/useUserRole.tsx rename to src/hooks/useUserRole.tsx From b1b89c0294b28f5bc73e095b3ca7a80c15296b47 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 01:22:13 -0500 Subject: [PATCH 07/19] add Home view --- src/app/(pre-login)/contact/page.tsx | 4 +- src/app/(pre-login)/logging-in/page.tsx | 2 +- src/app/page.tsx | 138 +-------------------- src/components/Hero.tsx | 3 +- src/components/NoData.tsx | 3 +- src/components/views/Home/Home.tsx | 155 ++++++++++++++++++++++++ 6 files changed, 163 insertions(+), 142 deletions(-) create mode 100644 src/components/views/Home/Home.tsx diff --git a/src/app/(pre-login)/contact/page.tsx b/src/app/(pre-login)/contact/page.tsx index 6466beb0..88809744 100644 --- a/src/app/(pre-login)/contact/page.tsx +++ b/src/app/(pre-login)/contact/page.tsx @@ -18,6 +18,6 @@ */ 'use client'; -import Contact from '@/components/views/contact/Contact'; +import Contact from '@/components/views/Contact/Contact'; -export default () => ; +export default Contact; diff --git a/src/app/(pre-login)/logging-in/page.tsx b/src/app/(pre-login)/logging-in/page.tsx index 42b0939c..31e1996c 100644 --- a/src/app/(pre-login)/logging-in/page.tsx +++ b/src/app/(pre-login)/logging-in/page.tsx @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved + * Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved * * This program and the accompanying materials are made available under the terms of * the GNU Affero General Public License v3.0. You should have received a copy of the diff --git a/src/app/page.tsx b/src/app/page.tsx index 2f39ce87..af45043c 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved + * Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved * * This program and the accompanying materials are made available under the terms of * the GNU Affero General Public License v3.0. You should have received a copy of the @@ -18,138 +18,6 @@ */ 'use client'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { css, useTheme } from '@/lib/emotion'; -import { DataCallout, Link, Typography, overtureLogo } from '@icgc-argo/uikit'; -import Image from 'next/image'; -import { ComponentType } from 'react'; -import urlJoin from 'url-join'; -import Hero from '../components/Hero'; +import Home from '@/components/views/Home/Home'; -const OvertureBanner: ComponentType = () => { - const theme = useTheme(); - return ( -
- - Logo for Ontario Institute for Cancer Research - - - The ARGO RDPCs are built with open-source products that you can incorporate into your - systems through{' '} - - Overture.bio - - . - -
- ); -}; - -const ActionBox: ComponentType = () => { - const { DOCS_URL_ROOT } = useAppConfigContext(); - return ( -
-
div:not(:last-child) { - border-right: 1px solid #dcdde1; - } - - /* breakpoint where buttons will soft wrap and look worse with icon on second line */ - @container callouts (width < 840px) { - grid-template-columns: 1fr; - row-gap: 20px; - padding: 0 5%; - - > div:not(:last-child) { - border-right: none; - border-bottom: 1px solid #dcdde1; - } - } - `} - > - - The Data Access Compliance Office (DACO) handles approval for access to controlled - molecular data in the ARGO Data Platform. - - - - Instructions for programs to submit clinical and molecular data. - - - - ARGO RDPC uniformly analyzes molecular data against the{' '} - GRCh38 Human Reference Genome. - -
-
- ); -}; - -export default function Home() { - return ( -
- - - -
- ); -} +export default Home; diff --git a/src/components/Hero.tsx b/src/components/Hero.tsx index 0b8a1c1c..737a7996 100644 --- a/src/components/Hero.tsx +++ b/src/components/Hero.tsx @@ -20,7 +20,6 @@ import { useAppConfigContext } from '@/hooks/AppProvider'; import { BUTTON_SIZES, Button, Icon, Typography, css, useTheme } from '@icgc-argo/uikit'; import Link from 'next/link'; -import galaxyImage from '../../../public/assets/galaxy.png'; import RegionBanner from './RegionBanner'; const Hero = () => { @@ -29,7 +28,7 @@ const Hero = () => { return (
Chemistry beakers. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +'use client'; + +import Hero from '@/components/Hero'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { css, useTheme } from '@/lib/emotion'; +import { DataCallout, Link, Typography, overtureLogo } from '@icgc-argo/uikit'; +import Image from 'next/image'; +import { ComponentType } from 'react'; +import urlJoin from 'url-join'; + +const OvertureBanner: ComponentType = () => { + const theme = useTheme(); + return ( +
+ + Logo for Ontario Institute for Cancer Research + + + The ARGO RDPCs are built with open-source products that you can incorporate into your + systems through{' '} + + Overture.bio + + . + +
+ ); +}; + +const ActionBox: ComponentType = () => { + const { DOCS_URL_ROOT } = useAppConfigContext(); + return ( +
+
div:not(:last-child) { + border-right: 1px solid #dcdde1; + } + + /* breakpoint where buttons will soft wrap and look worse with icon on second line */ + @container callouts (width < 840px) { + grid-template-columns: 1fr; + row-gap: 20px; + padding: 0 5%; + + > div:not(:last-child) { + border-right: none; + border-bottom: 1px solid #dcdde1; + } + } + `} + > + + The Data Access Compliance Office (DACO) handles approval for access to controlled + molecular data in the ARGO Data Platform. + + + + Instructions for programs to submit clinical and molecular data. + + + + ARGO RDPC uniformly analyzes molecular data against the{' '} + GRCh38 Human Reference Genome. + +
+
+ ); +}; + +export default function Home() { + return ( +
+ + + +
+ ); +} From 4e034345af86ac6716a9855b5f1629a454243022 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 01:28:37 -0500 Subject: [PATCH 08/19] move views folder to root --- src/app/(pre-login)/contact/page.tsx | 2 +- src/app/page.tsx | 2 +- src/{components/views/contact => views/Contact}/Contact.tsx | 0 .../views/contact => views/Contact}/components/form.tsx | 0 .../views/contact => views/Contact}/components/info.tsx | 0 src/{components => }/views/Home/Home.tsx | 0 6 files changed, 2 insertions(+), 2 deletions(-) rename src/{components/views/contact => views/Contact}/Contact.tsx (100%) rename src/{components/views/contact => views/Contact}/components/form.tsx (100%) rename src/{components/views/contact => views/Contact}/components/info.tsx (100%) rename src/{components => }/views/Home/Home.tsx (100%) diff --git a/src/app/(pre-login)/contact/page.tsx b/src/app/(pre-login)/contact/page.tsx index 88809744..f84fbe56 100644 --- a/src/app/(pre-login)/contact/page.tsx +++ b/src/app/(pre-login)/contact/page.tsx @@ -18,6 +18,6 @@ */ 'use client'; -import Contact from '@/components/views/Contact/Contact'; +import Contact from '@/views/Contact/Contact'; export default Contact; diff --git a/src/app/page.tsx b/src/app/page.tsx index af45043c..74c5af4e 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -18,6 +18,6 @@ */ 'use client'; -import Home from '@/components/views/Home/Home'; +import Home from '@/views/Home/Home'; export default Home; diff --git a/src/components/views/contact/Contact.tsx b/src/views/Contact/Contact.tsx similarity index 100% rename from src/components/views/contact/Contact.tsx rename to src/views/Contact/Contact.tsx diff --git a/src/components/views/contact/components/form.tsx b/src/views/Contact/components/form.tsx similarity index 100% rename from src/components/views/contact/components/form.tsx rename to src/views/Contact/components/form.tsx diff --git a/src/components/views/contact/components/info.tsx b/src/views/Contact/components/info.tsx similarity index 100% rename from src/components/views/contact/components/info.tsx rename to src/views/Contact/components/info.tsx diff --git a/src/components/views/Home/Home.tsx b/src/views/Home/Home.tsx similarity index 100% rename from src/components/views/Home/Home.tsx rename to src/views/Home/Home.tsx From f82028b72dd718f6d0f7de17d2c5f4232481af5d Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 01:46:24 -0500 Subject: [PATCH 09/19] add global types --- src/global/types.ts | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/global/types.ts diff --git a/src/global/types.ts b/src/global/types.ts new file mode 100644 index 00000000..58372f3e --- /dev/null +++ b/src/global/types.ts @@ -0,0 +1,3 @@ +import { ReactNode } from 'react'; + +export type FunctionComponentChildren = { children: ReactNode }; From 746ed1d49c1a049bc26af49d64e04bdff2900f9e Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 01:46:47 -0500 Subject: [PATCH 10/19] isolate layout components --- src/app/(post-login)/submission/layout.tsx | 41 ++----------- src/components/layouts/App.tsx | 57 +++++++++++++++++++ .../layouts}/SideMenu/Content.tsx | 4 +- .../layouts}/SideMenu/Menu.tsx | 0 .../layouts}/SideMenu/Toggle.tsx | 0 .../layouts}/SideMenu/types.ts | 0 src/components/layouts/index.tsx | 5 ++ 7 files changed, 69 insertions(+), 38 deletions(-) create mode 100644 src/components/layouts/App.tsx rename src/{app/(post-login)/submission/components => components/layouts}/SideMenu/Content.tsx (91%) rename src/{app/(post-login)/submission/components => components/layouts}/SideMenu/Menu.tsx (100%) rename src/{app/(post-login)/submission/components => components/layouts}/SideMenu/Toggle.tsx (100%) rename src/{app/(post-login)/submission/components => components/layouts}/SideMenu/types.ts (100%) create mode 100644 src/components/layouts/index.tsx diff --git a/src/app/(post-login)/submission/layout.tsx b/src/app/(post-login)/submission/layout.tsx index 0a6a1be4..93a3056f 100644 --- a/src/app/(post-login)/submission/layout.tsx +++ b/src/app/(post-login)/submission/layout.tsx @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved + * Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved * * This program and the accompanying materials are made available under the terms of * the GNU Affero General Public License v3.0. You should have received a copy of the @@ -18,40 +18,9 @@ */ 'use client'; -import { HEADER_HEIGHT_PX } from '@/components/Header'; -import { css, useTheme } from '@/lib/emotion'; -import { ReactNode, useState } from 'react'; -import SideMenu from './components/SideMenu/Menu'; +import Layout from '@/components/layouts'; +import { FunctionComponentChildren } from '@/global/types'; -export default function AppLayout({ children }: { children: ReactNode }) { - const theme = useTheme(); +const RootLayout = ({ children }: FunctionComponentChildren) => {children}; - const [isSidebarActive, setSidebarActive] = useState(true); - - return ( -
-
- setSidebarActive((active) => !active)} - /> -
- <>{children} -
- ); -} +export default RootLayout; diff --git a/src/components/layouts/App.tsx b/src/components/layouts/App.tsx new file mode 100644 index 00000000..0a6a1be4 --- /dev/null +++ b/src/components/layouts/App.tsx @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved + * + * This program and the accompanying materials are made available under the terms of + * the GNU Affero General Public License v3.0. You should have received a copy of the + * GNU Affero General Public License along with this program. + * If not, see . + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +'use client'; + +import { HEADER_HEIGHT_PX } from '@/components/Header'; +import { css, useTheme } from '@/lib/emotion'; +import { ReactNode, useState } from 'react'; +import SideMenu from './components/SideMenu/Menu'; + +export default function AppLayout({ children }: { children: ReactNode }) { + const theme = useTheme(); + + const [isSidebarActive, setSidebarActive] = useState(true); + + return ( +
+
+ setSidebarActive((active) => !active)} + /> +
+ <>{children} +
+ ); +} diff --git a/src/app/(post-login)/submission/components/SideMenu/Content.tsx b/src/components/layouts/SideMenu/Content.tsx similarity index 91% rename from src/app/(post-login)/submission/components/SideMenu/Content.tsx rename to src/components/layouts/SideMenu/Content.tsx index 0a073df2..4b54d67a 100644 --- a/src/app/(post-login)/submission/components/SideMenu/Content.tsx +++ b/src/components/layouts/SideMenu/Content.tsx @@ -20,8 +20,8 @@ import { Icon, MenuItem, SubMenu } from '@icgc-argo/uikit'; import { useState } from 'react'; -import ProgramMenu from '../ProgramMenu'; -import Search from '../Search'; +import ProgramMenu from '../../../app/(post-login)/submission/components/ProgramMenu'; +import Search from '../../../app/(post-login)/submission/components/Search'; const SideMenuContent = () => { const [programNameSearch, setProgramNameSearch] = useState(''); diff --git a/src/app/(post-login)/submission/components/SideMenu/Menu.tsx b/src/components/layouts/SideMenu/Menu.tsx similarity index 100% rename from src/app/(post-login)/submission/components/SideMenu/Menu.tsx rename to src/components/layouts/SideMenu/Menu.tsx diff --git a/src/app/(post-login)/submission/components/SideMenu/Toggle.tsx b/src/components/layouts/SideMenu/Toggle.tsx similarity index 100% rename from src/app/(post-login)/submission/components/SideMenu/Toggle.tsx rename to src/components/layouts/SideMenu/Toggle.tsx diff --git a/src/app/(post-login)/submission/components/SideMenu/types.ts b/src/components/layouts/SideMenu/types.ts similarity index 100% rename from src/app/(post-login)/submission/components/SideMenu/types.ts rename to src/components/layouts/SideMenu/types.ts diff --git a/src/components/layouts/index.tsx b/src/components/layouts/index.tsx new file mode 100644 index 00000000..16b61a8c --- /dev/null +++ b/src/components/layouts/index.tsx @@ -0,0 +1,5 @@ +import App from './App'; + +const Layout = { App: App }; + +export default Layout; From 5964aee19ac93aa0797384a966038ae7724da8d8 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 01:54:59 -0500 Subject: [PATCH 11/19] split Dashboard into View and App Route --- .../submission/program-table/config.tsx | 2 +- .../program/[shortName]/dashboard/page.tsx | 118 +---------------- .../(post-login)/submission/program/page.tsx | 2 +- src/components/layouts/App.tsx | 2 +- src/components/layouts/SideMenu/Content.tsx | 4 +- src/views/Submission/Dashboard/Dashboard.tsx | 119 ++++++++++++++++++ .../components/ClinicalChart/Legend.tsx | 0 .../ClinicalChart/LineChart/InfoBox.tsx | 0 .../ClinicalChart/LineChart/index.tsx | 0 .../ClinicalChart/LineChart/utils.ts | 0 .../ClinicalChart/RangeControlBar.tsx | 0 .../components/ClinicalChart/index.tsx | 0 .../ClinicalChart/rangeButtonsConfig.ts | 0 .../components/ClinicalChart/types.ts | 0 .../DonorDataSummary/DesignationCell.tsx | 0 .../DonorDataSummary/DonorSummaryTable.tsx | 2 +- .../DonorSummaryTableLegend.tsx | 0 .../DonorSummaryTableStatArea.tsx | 0 .../DonorDataSummary/DownloadButtons.tsx | 0 .../EmptyDonorSummaryTable.tsx | 0 .../DonorDataSummary/PipelineTabs.tsx | 0 .../components/DonorDataSummary/common.tsx | 0 .../components/DonorDataSummary/dtypes.tsx} | 0 .../components/DonorDataSummary/index.tsx | 0 .../queries/useProgramDonorsSummaryQuery.tsx | 0 .../components/DonorDataSummary/types.tsx | 0 .../components/DonorReleaseSummary/index.tsx | 0 .../Dashboard}/components/Pipeline/index.tsx | 0 .../ProgramWorkspaceStatus/index.tsx | 4 +- .../Dashboard}/components/StatsBar/index.tsx | 0 .../Dashboard}/components/common.tsx | 0 .../Submission/Dashboard}/components/data.tsx | 0 .../Submission}/components/ProgramList.tsx | 2 +- .../Submission}/components/ProgramMenu.tsx | 2 +- .../Submission}/components/Search.tsx | 0 .../common.tsx => views/Submission/data.ts} | 18 +-- src/views/Submission/types.ts | 16 +++ 37 files changed, 147 insertions(+), 144 deletions(-) create mode 100644 src/views/Submission/Dashboard/Dashboard.tsx rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/ClinicalChart/Legend.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/ClinicalChart/LineChart/InfoBox.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/ClinicalChart/LineChart/index.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/ClinicalChart/LineChart/utils.ts (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/ClinicalChart/RangeControlBar.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/ClinicalChart/index.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/ClinicalChart/rangeButtonsConfig.ts (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/ClinicalChart/types.ts (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/DesignationCell.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/DonorSummaryTable.tsx (99%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/DonorSummaryTableLegend.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/DonorSummaryTableStatArea.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/DownloadButtons.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/EmptyDonorSummaryTable.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/PipelineTabs.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/common.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard/DonorDataSummary/types.tsx => views/Submission/Dashboard/components/DonorDataSummary/dtypes.tsx} (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/index.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorDataSummary/types.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/DonorReleaseSummary/index.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/Pipeline/index.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/ProgramWorkspaceStatus/index.tsx (92%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/StatsBar/index.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/common.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/dashboard => views/Submission/Dashboard}/components/data.tsx (100%) rename src/{app/(post-login)/submission => views/Submission}/components/ProgramList.tsx (96%) rename src/{app/(post-login)/submission => views/Submission}/components/ProgramMenu.tsx (99%) rename src/{app/(post-login)/submission => views/Submission}/components/Search.tsx (100%) rename src/{app/(post-login)/submission/common.tsx => views/Submission/data.ts} (87%) create mode 100644 src/views/Submission/types.ts diff --git a/src/app/(post-login)/submission/program-table/config.tsx b/src/app/(post-login)/submission/program-table/config.tsx index abb5f8a7..5b559393 100644 --- a/src/app/(post-login)/submission/program-table/config.tsx +++ b/src/app/(post-login)/submission/program-table/config.tsx @@ -22,7 +22,7 @@ import { Program } from '@/__generated__/gateway/graphql'; import { notNull } from '@/global/utils'; import { ColumnDef } from '@icgc-argo/uikit'; -import { ArgoMembershipKey } from '../components/ProgramList'; +import { ArgoMembershipKey } from '../../../../views/Submission/components/ProgramList'; import CancerTypes from './CancerTypes'; import Countries from './Countries'; import DonorStatus from './DonorStatus'; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx index 17bbf5c7..8c50e1a6 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx @@ -1,121 +1,5 @@ -/* - * Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved - * - * This program and the accompanying materials are made available under the terms of - * the GNU Affero General Public License v3.0. You should have received a copy of the - * GNU Affero General Public License along with this program. - * If not, see . - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -'use client'; - -import ContentMain from '@/components/Content/ContentMain'; import { pageWithPermissions } from '@/components/Page'; -import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { css, styled } from '@/lib/emotion'; -import { Col, Row, ScreenClassRender, setConfiguration } from 'react-grid-system'; -import urlJoin from 'url-join'; -import ClinicalChart from './components/ClinicalChart'; -import DonorDataSummary from './components/DonorDataSummary'; -import DonorReleaseSummary from './components/DonorReleaseSummary'; -import ProgramWorkplaceStatus from './components/ProgramWorkspaceStatus'; -import StatsBar from './components/StatsBar'; - -setConfiguration({ gutterWidth: 9 }); - -type StackedSizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'xxxl'; - -const Dashboard = ({ shortName }: { shortName: string }) => { - // docs url - const { DOCS_URL_ROOT } = useAppConfigContext(); - const helpUrl = urlJoin(DOCS_URL_ROOT, '/docs/submission/submitted-data'); - - const PaddedRow = styled(Row)` - padding-bottom: 8px; - `; - - const applyStackedStyle = (size: StackedSizes) => css` - padding-bottom: ${['xl'].includes(size) ? '0' : '8'}px; - `; - - return ( -
- } - rightSlot={} - /> - - - - - - - - - - - - - - - - ( - - - - )} - /> - - - ( - - - - )} - /> - ( - - - - )} - /> - - - - - - - -
- ); -}; +import Dashboard from '@/views/Submission/Dashboard/Dashboard'; const DashboardPage = ({ params: { shortName } }: { params: { shortName: string } }) => { const Page = pageWithPermissions(Dashboard, { diff --git a/src/app/(post-login)/submission/program/page.tsx b/src/app/(post-login)/submission/program/page.tsx index 764b95d1..43385751 100644 --- a/src/app/(post-login)/submission/program/page.tsx +++ b/src/app/(post-login)/submission/program/page.tsx @@ -28,7 +28,7 @@ import { useGatewayQuery } from '@/hooks/useApolloQuery'; import { Button, Loader } from '@icgc-argo/uikit'; import Link from 'next/link'; import { notFound } from 'next/navigation'; -import ProgramList from '../components/ProgramList'; +import ProgramList from '../../../../views/Submission/components/ProgramList'; export default function Submission() { const { DATA_CENTER } = useAppConfigContext(); diff --git a/src/components/layouts/App.tsx b/src/components/layouts/App.tsx index 0a6a1be4..3a011bbb 100644 --- a/src/components/layouts/App.tsx +++ b/src/components/layouts/App.tsx @@ -21,7 +21,7 @@ import { HEADER_HEIGHT_PX } from '@/components/Header'; import { css, useTheme } from '@/lib/emotion'; import { ReactNode, useState } from 'react'; -import SideMenu from './components/SideMenu/Menu'; +import SideMenu from './SideMenu/Menu'; export default function AppLayout({ children }: { children: ReactNode }) { const theme = useTheme(); diff --git a/src/components/layouts/SideMenu/Content.tsx b/src/components/layouts/SideMenu/Content.tsx index 4b54d67a..28aac802 100644 --- a/src/components/layouts/SideMenu/Content.tsx +++ b/src/components/layouts/SideMenu/Content.tsx @@ -18,10 +18,10 @@ */ 'use client'; +import ProgramMenu from '@/views/Submission/components/ProgramMenu'; +import Search from '@/views/Submission/components/Search'; import { Icon, MenuItem, SubMenu } from '@icgc-argo/uikit'; import { useState } from 'react'; -import ProgramMenu from '../../../app/(post-login)/submission/components/ProgramMenu'; -import Search from '../../../app/(post-login)/submission/components/Search'; const SideMenuContent = () => { const [programNameSearch, setProgramNameSearch] = useState(''); diff --git a/src/views/Submission/Dashboard/Dashboard.tsx b/src/views/Submission/Dashboard/Dashboard.tsx new file mode 100644 index 00000000..fb294762 --- /dev/null +++ b/src/views/Submission/Dashboard/Dashboard.tsx @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved + * + * This program and the accompanying materials are made available under the terms of + * the GNU Affero General Public License v3.0. You should have received a copy of the + * GNU Affero General Public License along with this program. + * If not, see . + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +'use client'; + +import ContentMain from '@/components/Content/ContentMain'; +import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { css, styled } from '@/lib/emotion'; +import { Col, Row, ScreenClassRender, setConfiguration } from 'react-grid-system'; +import urlJoin from 'url-join'; +import ClinicalChart from './components/ClinicalChart'; +import DonorDataSummary from './components/DonorDataSummary'; +import DonorReleaseSummary from './components/DonorReleaseSummary'; +import ProgramWorkplaceStatus from './components/ProgramWorkspaceStatus'; +import StatsBar from './components/StatsBar'; + +setConfiguration({ gutterWidth: 9 }); + +type StackedSizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'xxxl'; + +const Dashboard = ({ shortName }: { shortName: string }) => { + // docs url + const { DOCS_URL_ROOT } = useAppConfigContext(); + const helpUrl = urlJoin(DOCS_URL_ROOT, '/docs/submission/submitted-data'); + + const PaddedRow = styled(Row)` + padding-bottom: 8px; + `; + + const applyStackedStyle = (size: StackedSizes) => css` + padding-bottom: ${['xl'].includes(size) ? '0' : '8'}px; + `; + + return ( +
+ } + rightSlot={} + /> + + + + + + + + + + + + + + + + ( + + + + )} + /> + + + ( + + + + )} + /> + ( + + + + )} + /> + + + + + + + +
+ ); +}; + +export default Dashboard; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/Legend.tsx b/src/views/Submission/Dashboard/components/ClinicalChart/Legend.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/Legend.tsx rename to src/views/Submission/Dashboard/components/ClinicalChart/Legend.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/LineChart/InfoBox.tsx b/src/views/Submission/Dashboard/components/ClinicalChart/LineChart/InfoBox.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/LineChart/InfoBox.tsx rename to src/views/Submission/Dashboard/components/ClinicalChart/LineChart/InfoBox.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/LineChart/index.tsx b/src/views/Submission/Dashboard/components/ClinicalChart/LineChart/index.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/LineChart/index.tsx rename to src/views/Submission/Dashboard/components/ClinicalChart/LineChart/index.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/LineChart/utils.ts b/src/views/Submission/Dashboard/components/ClinicalChart/LineChart/utils.ts similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/LineChart/utils.ts rename to src/views/Submission/Dashboard/components/ClinicalChart/LineChart/utils.ts diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/RangeControlBar.tsx b/src/views/Submission/Dashboard/components/ClinicalChart/RangeControlBar.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/RangeControlBar.tsx rename to src/views/Submission/Dashboard/components/ClinicalChart/RangeControlBar.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/index.tsx b/src/views/Submission/Dashboard/components/ClinicalChart/index.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/index.tsx rename to src/views/Submission/Dashboard/components/ClinicalChart/index.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/rangeButtonsConfig.ts b/src/views/Submission/Dashboard/components/ClinicalChart/rangeButtonsConfig.ts similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/rangeButtonsConfig.ts rename to src/views/Submission/Dashboard/components/ClinicalChart/rangeButtonsConfig.ts diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/types.ts b/src/views/Submission/Dashboard/components/ClinicalChart/types.ts similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/ClinicalChart/types.ts rename to src/views/Submission/Dashboard/components/ClinicalChart/types.ts diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DesignationCell.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/DesignationCell.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DesignationCell.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/DesignationCell.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx similarity index 99% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx index 05b147c9..becd24f9 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTable.tsx +++ b/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx @@ -46,7 +46,7 @@ import { find } from 'lodash'; import Link from 'next/link'; import { useEffect, useState } from 'react'; import urlJoin from 'url-join'; -import { defaultClinicalEntityFilters } from '../../../clinical-data/common'; +import { defaultClinicalEntityFilters } from '../../../../../app/(post-login)/submission/program/[shortName]/clinical-data/common'; import { Pipeline } from '../Pipeline'; import { DesignationCell } from './DesignationCell'; import DonorSummaryTableLegend from './DonorSummaryTableLegend'; diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableLegend.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTableLegend.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableLegend.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTableLegend.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableStatArea.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTableStatArea.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DonorSummaryTableStatArea.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTableStatArea.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/DownloadButtons.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/DownloadButtons.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/DownloadButtons.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/PipelineTabs.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/PipelineTabs.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/PipelineTabs.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/PipelineTabs.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/common.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/common.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/common.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/common.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/DonorDataSummary/types.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/dtypes.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/DonorDataSummary/types.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/dtypes.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/index.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/index.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/index.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/index.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/types.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/types.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorDataSummary/types.tsx rename to src/views/Submission/Dashboard/components/DonorDataSummary/types.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorReleaseSummary/index.tsx b/src/views/Submission/Dashboard/components/DonorReleaseSummary/index.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/DonorReleaseSummary/index.tsx rename to src/views/Submission/Dashboard/components/DonorReleaseSummary/index.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/Pipeline/index.tsx b/src/views/Submission/Dashboard/components/Pipeline/index.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/Pipeline/index.tsx rename to src/views/Submission/Dashboard/components/Pipeline/index.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ProgramWorkspaceStatus/index.tsx b/src/views/Submission/Dashboard/components/ProgramWorkspaceStatus/index.tsx similarity index 92% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/ProgramWorkspaceStatus/index.tsx rename to src/views/Submission/Dashboard/components/ProgramWorkspaceStatus/index.tsx index 66d4e88a..057ad61c 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/ProgramWorkspaceStatus/index.tsx +++ b/src/views/Submission/Dashboard/components/ProgramWorkspaceStatus/index.tsx @@ -28,8 +28,8 @@ import { } from '@/global/constants'; import NextLink, { LinkProps } from 'next/link'; import { ComponentType, ReactNode } from 'react'; -import ClinicalSubmissionProgressBar from '../../../components/ClinicalSubmissionProgressBar'; -import SampleRegistrationProgressBar from '../../../components/SampleRegistrationProgressBar'; +import ClinicalSubmissionProgressBar from '../../../../../app/(post-login)/submission/program/[shortName]/components/ClinicalSubmissionProgressBar'; +import SampleRegistrationProgressBar from '../../../../../app/(post-login)/submission/program/[shortName]/components/SampleRegistrationProgressBar'; import { DashboardCard } from '../common'; const ConditionalLink: ComponentType<{ diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/StatsBar/index.tsx b/src/views/Submission/Dashboard/components/StatsBar/index.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/StatsBar/index.tsx rename to src/views/Submission/Dashboard/components/StatsBar/index.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/common.tsx b/src/views/Submission/Dashboard/components/common.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/common.tsx rename to src/views/Submission/Dashboard/components/common.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/components/data.tsx b/src/views/Submission/Dashboard/components/data.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/dashboard/components/data.tsx rename to src/views/Submission/Dashboard/components/data.tsx diff --git a/src/app/(post-login)/submission/components/ProgramList.tsx b/src/views/Submission/components/ProgramList.tsx similarity index 96% rename from src/app/(post-login)/submission/components/ProgramList.tsx rename to src/views/Submission/components/ProgramList.tsx index 4b171e8e..6a372655 100644 --- a/src/app/(post-login)/submission/components/ProgramList.tsx +++ b/src/views/Submission/components/ProgramList.tsx @@ -23,7 +23,7 @@ import { containerStyle } from '@/global/styles/style'; import { css, useTheme } from '@/lib/emotion'; import { Table, Typography } from '@icgc-argo/uikit'; import orderBy from 'lodash/orderBy'; -import { columns } from '../program-table/config'; +import { columns } from '../../../app/(post-login)/submission/program-table/config'; export type ArgoMembershipKey = 'FULL' | 'ASSOCIATE'; diff --git a/src/app/(post-login)/submission/components/ProgramMenu.tsx b/src/views/Submission/components/ProgramMenu.tsx similarity index 99% rename from src/app/(post-login)/submission/components/ProgramMenu.tsx rename to src/views/Submission/components/ProgramMenu.tsx index 85523cb6..23090196 100644 --- a/src/app/(post-login)/submission/components/ProgramMenu.tsx +++ b/src/views/Submission/components/ProgramMenu.tsx @@ -41,7 +41,7 @@ import orderBy from 'lodash/orderBy'; import Link from 'next/link'; import { notFound, useParams, usePathname } from 'next/navigation'; import { FC, ReactNode, useState } from 'react'; -import { defaultClinicalEntityFilters } from '../common'; +import { defaultClinicalEntityFilters } from '../data'; const StatusMenuItem: FC<{ children: ReactNode }> = ({ children }) => { return ( diff --git a/src/app/(post-login)/submission/components/Search.tsx b/src/views/Submission/components/Search.tsx similarity index 100% rename from src/app/(post-login)/submission/components/Search.tsx rename to src/views/Submission/components/Search.tsx diff --git a/src/app/(post-login)/submission/common.tsx b/src/views/Submission/data.ts similarity index 87% rename from src/app/(post-login)/submission/common.tsx rename to src/views/Submission/data.ts index b399f216..f40d04d8 100644 --- a/src/app/(post-login)/submission/common.tsx +++ b/src/views/Submission/data.ts @@ -18,6 +18,7 @@ */ import { ClinicalInput } from '@/__generated__/clinical/graphql'; +import { CompletionStates } from './types'; export const aliasSortNames = { donor_id: 'donorId', @@ -51,23 +52,6 @@ export const aliasedEntityNames = { export const clinicalEntityFields = Object.keys(aliasedEntityNames); -export type ClinicalFilter = { - entityTypes: string[]; - page: number; - pageSize: number; - donorIds?: string[]; - submitterDonorIds?: string[]; - completionState?: CompletionStates; - sort?: string; -}; - -export enum CompletionStates { - all = 'all', - invalid = 'invalid', - complete = 'complete', - incomplete = 'incomplete', -} - export const defaultClinicalEntityFilters: ClinicalInput = { entityTypes: clinicalEntityFields, page: 0, diff --git a/src/views/Submission/types.ts b/src/views/Submission/types.ts new file mode 100644 index 00000000..66b5d82a --- /dev/null +++ b/src/views/Submission/types.ts @@ -0,0 +1,16 @@ +export type ClinicalFilter = { + entityTypes: string[]; + page: number; + pageSize: number; + donorIds?: string[]; + submitterDonorIds?: string[]; + completionState?: CompletionStates; + sort?: string; +}; + +export enum CompletionStates { + all = 'all', + invalid = 'invalid', + complete = 'complete', + incomplete = 'incomplete', +} From 58100f096f21960fc2f63f2866c0d3fd1b1b386f Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 01:58:06 -0500 Subject: [PATCH 12/19] split sample reg into view and route --- .../program/[shortName]/dashboard/page.tsx | 2 + .../[shortName]/sample-registration/page.tsx | 254 +---------------- .../SampleRegistration/SampleRegistration.tsx | 257 ++++++++++++++++++ .../components/FilePreview.tsx | 0 .../components/FileTable.tsx | 0 .../components/Instructions.tsx | 0 .../components/ProgressBar.tsx | 0 .../components/RegisterSampleModal.tsx | 0 .../components/UploadError.tsx | 0 9 files changed, 260 insertions(+), 253 deletions(-) create mode 100644 src/views/Submission/SampleRegistration/SampleRegistration.tsx rename src/{app/(post-login)/submission/program/[shortName]/sample-registration => views/Submission/SampleRegistration}/components/FilePreview.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/sample-registration => views/Submission/SampleRegistration}/components/FileTable.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/sample-registration => views/Submission/SampleRegistration}/components/Instructions.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/sample-registration => views/Submission/SampleRegistration}/components/ProgressBar.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/sample-registration => views/Submission/SampleRegistration}/components/RegisterSampleModal.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/sample-registration => views/Submission/SampleRegistration}/components/UploadError.tsx (100%) diff --git a/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx b/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx index 8c50e1a6..626e8a5c 100644 --- a/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/dashboard/page.tsx @@ -1,3 +1,5 @@ +'use client'; + import { pageWithPermissions } from '@/components/Page'; import Dashboard from '@/views/Submission/Dashboard/Dashboard'; diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/page.tsx b/src/app/(post-login)/submission/program/[shortName]/sample-registration/page.tsx index e05eefad..2d032da0 100644 --- a/src/app/(post-login)/submission/program/[shortName]/sample-registration/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/sample-registration/page.tsx @@ -1,259 +1,7 @@ -/* - * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved - * - * This program and the accompanying materials are made available under the terms of - * the GNU Affero General Public License v3.0. You should have received a copy of the - * GNU Affero General Public License along with this program. - * If not, see . - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ 'use client'; -import Instructions from '@/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions'; -import ProgressBar from '@/app/(post-login)/submission/program/[shortName]/sample-registration/components/ProgressBar'; -import Card from '@/components/Card'; -import ContentMain from '@/components/Content/ContentMain'; -import NoDataMessage from '@/components/NoData'; import { pageWithPermissions } from '@/components/Page'; -import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; -import { UPLOAD_REGISTRATION } from '@/global/constants'; -import { getProgramPath, notNull } from '@/global/utils'; -import { createFileFormData, uploadFileRequest } from '@/global/utils/form'; -import CLEAR_CLINICAL_REGISTRATION_MUTATION from '@/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION'; -import CLINICAL_SCHEMA_VERSION from '@/gql/clinical/CLINICAL_SCHEMA_VERSION'; -import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useAuthContext } from '@/hooks/AuthProvider'; -import { useToaster } from '@/hooks/ToastProvider'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; -import useCommonToasters from '@/hooks/useCommonToasters'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; -import { css } from '@/lib/emotion'; -import { useMutation as useGQLMutation, useQuery } from '@apollo/client'; -import { - BUTTON_SIZES, - BUTTON_VARIANTS, - Button, - NOTIFICATION_VARIANTS, - NotificationInteraction, - Typography, -} from '@icgc-argo/uikit'; -import { get } from 'lodash'; -import { useState } from 'react'; -import { useMutation } from 'react-query'; -import urlJoin from 'url-join'; -import FileError from '../../../../../../components/FileError'; -import FilePreview from './components/FilePreview'; -import RegisterSamplesModal from './components/RegisterSampleModal'; -import UploadError from './components/UploadError'; - -const Register = ({ shortName }: { shortName: string }) => { - const { - data, - refetch, - updateQuery: updateClinicalRegistrationQuery, - } = useQuery(GET_REGISTRATION_QUERY, { - variables: { shortName }, - }); - - const { egoJwt } = useAuthContext(); - - // get dictionary version - const latestDictionaryResponse = useClinicalQuery(CLINICAL_SCHEMA_VERSION); - const { loading: isLoadingDictVersion, data: dictData } = latestDictionaryResponse; - const dictionaryVersion = - (!isLoadingDictVersion && dictData?.clinicalSubmissionSchemaVersion) || ''; - - // toasters - const toaster = useToaster(); - const commonToaster = useCommonToasters(); - - // docs url - const { DOCS_URL_ROOT, CLINICAL_API_ROOT } = useAppConfigContext(); - const helpUrl = urlJoin(DOCS_URL_ROOT, '/docs/submission/registering-samples'); - - // modal state - const [showRegisterModal, setShowModal] = useState(false); - - // pull out some clinical registration data - const clinicalRegistration = data?.clinicalRegistration; - const schemaOrValidationErrors = get(clinicalRegistration, 'errors', []); - const fileErrors = get(clinicalRegistration, 'fileErrors') || []; - - const { isDisabled: isSubmissionSystemDisabled } = useSubmissionSystemStatus(); - - const instructionFlags = { - uploadEnabled: !isSubmissionSystemDisabled, - registrationEnabled: !isSubmissionSystemDisabled && !!get(clinicalRegistration, 'id'), - }; - - const hasClinicalRegistration = !!(clinicalRegistration && clinicalRegistration.records.length); - const hasErrors = !!schemaOrValidationErrors.length; - const registrationId = get(clinicalRegistration, 'id', '') || ''; - - // handlers - const uploadFile = useMutation( - (formData) => { - const url = urlJoin(CLINICAL_API_ROOT, getProgramPath(UPLOAD_REGISTRATION, shortName)); - return uploadFileRequest(url, formData, egoJwt); - }, - { - onError: () => { - commonToaster.unknownError(); - }, - }, - ); - - const handleUpload = (file: File) => { - const fileFormData = createFileFormData(file, 'registrationFile'); - return uploadFile.mutate(fileFormData); - }; - - const handleRegister = () => { - setShowModal((state) => !state); - }; - - // file preview clear - const [clearRegistration] = useGQLMutation(CLEAR_CLINICAL_REGISTRATION_MUTATION); - const handleClearClick = async () => { - if (clinicalRegistration?.id == null) { - refetch(); - return; - } - - try { - await clearRegistration({ - variables: { - shortName, - registrationId, - }, - }); - await refetch(); - } catch (err) { - await refetch(); - toaster.addToast({ - variant: 'ERROR', - title: 'Something went wrong', - content: 'Uh oh! It looks like something went wrong. This page has been reloaded.', - }); - } - }; - - const handleRegisterCancelClick = () => { - setShowModal(false); - }; - - const onFileErrorClose = - (index: number) => - ({ type }: { type: NotificationInteraction }) => { - if (type === 'CLOSE') { - updateClinicalRegistrationQuery((previous) => ({ - ...previous, - clinicalRegistration: { - ...previous.clinicalRegistration, - fileErrors: previous?.clinicalRegistration?.fileErrors?.filter((_, i) => i !== index), - }, - })); - } - }; - - return ( - <> -
- - - - - } - rightSlot={} - /> - - - {fileErrors.filter(notNull).map((fileError, index) => ( - - ))} - {clinicalRegistration?.records.length ? ( - - Clear - - } - > - - - ) : schemaOrValidationErrors.length ? ( - - ) : ( - - - - )} - -
- - {/** Modals */} - {showRegisterModal && ( - - )} - - ); -}; +import Register from '@/views/Submission/SampleRegistration/SampleRegistration'; const RegisterPage = ({ params: { shortName } }: { params: { shortName: string } }) => { const RegisterWithPermissions = pageWithPermissions(Register, { diff --git a/src/views/Submission/SampleRegistration/SampleRegistration.tsx b/src/views/Submission/SampleRegistration/SampleRegistration.tsx new file mode 100644 index 00000000..b0d26317 --- /dev/null +++ b/src/views/Submission/SampleRegistration/SampleRegistration.tsx @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved + * + * This program and the accompanying materials are made available under the terms of + * the GNU Affero General Public License v3.0. You should have received a copy of the + * GNU Affero General Public License along with this program. + * If not, see . + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +'use client'; + +import Instructions from '@/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions'; +import ProgressBar from '@/app/(post-login)/submission/program/[shortName]/sample-registration/components/ProgressBar'; +import Card from '@/components/Card'; +import ContentMain from '@/components/Content/ContentMain'; +import NoDataMessage from '@/components/NoData'; +import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; +import { UPLOAD_REGISTRATION } from '@/global/constants'; +import { getProgramPath, notNull } from '@/global/utils'; +import { createFileFormData, uploadFileRequest } from '@/global/utils/form'; +import CLEAR_CLINICAL_REGISTRATION_MUTATION from '@/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION'; +import CLINICAL_SCHEMA_VERSION from '@/gql/clinical/CLINICAL_SCHEMA_VERSION'; +import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; +import { useToaster } from '@/hooks/ToastProvider'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import useCommonToasters from '@/hooks/useCommonToasters'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import { css } from '@/lib/emotion'; +import { useMutation as useGQLMutation, useQuery } from '@apollo/client'; +import { + BUTTON_SIZES, + BUTTON_VARIANTS, + Button, + NOTIFICATION_VARIANTS, + NotificationInteraction, + Typography, +} from '@icgc-argo/uikit'; +import { get } from 'lodash'; +import { useState } from 'react'; +import { useMutation } from 'react-query'; +import urlJoin from 'url-join'; +import FileError from '../../../../../../components/FileError'; +import FilePreview from './components/FilePreview'; +import RegisterSamplesModal from './components/RegisterSampleModal'; +import UploadError from './components/UploadError'; + +const Register = ({ shortName }: { shortName: string }) => { + const { + data, + refetch, + updateQuery: updateClinicalRegistrationQuery, + } = useQuery(GET_REGISTRATION_QUERY, { + variables: { shortName }, + }); + + const { egoJwt } = useAuthContext(); + + // get dictionary version + const latestDictionaryResponse = useClinicalQuery(CLINICAL_SCHEMA_VERSION); + const { loading: isLoadingDictVersion, data: dictData } = latestDictionaryResponse; + const dictionaryVersion = + (!isLoadingDictVersion && dictData?.clinicalSubmissionSchemaVersion) || ''; + + // toasters + const toaster = useToaster(); + const commonToaster = useCommonToasters(); + + // docs url + const { DOCS_URL_ROOT, CLINICAL_API_ROOT } = useAppConfigContext(); + const helpUrl = urlJoin(DOCS_URL_ROOT, '/docs/submission/registering-samples'); + + // modal state + const [showRegisterModal, setShowModal] = useState(false); + + // pull out some clinical registration data + const clinicalRegistration = data?.clinicalRegistration; + const schemaOrValidationErrors = get(clinicalRegistration, 'errors', []); + const fileErrors = get(clinicalRegistration, 'fileErrors') || []; + + const { isDisabled: isSubmissionSystemDisabled } = useSubmissionSystemStatus(); + + const instructionFlags = { + uploadEnabled: !isSubmissionSystemDisabled, + registrationEnabled: !isSubmissionSystemDisabled && !!get(clinicalRegistration, 'id'), + }; + + const hasClinicalRegistration = !!(clinicalRegistration && clinicalRegistration.records.length); + const hasErrors = !!schemaOrValidationErrors.length; + const registrationId = get(clinicalRegistration, 'id', '') || ''; + + // handlers + const uploadFile = useMutation( + (formData) => { + const url = urlJoin(CLINICAL_API_ROOT, getProgramPath(UPLOAD_REGISTRATION, shortName)); + return uploadFileRequest(url, formData, egoJwt); + }, + { + onError: () => { + commonToaster.unknownError(); + }, + }, + ); + + const handleUpload = (file: File) => { + const fileFormData = createFileFormData(file, 'registrationFile'); + return uploadFile.mutate(fileFormData); + }; + + const handleRegister = () => { + setShowModal((state) => !state); + }; + + // file preview clear + const [clearRegistration] = useGQLMutation(CLEAR_CLINICAL_REGISTRATION_MUTATION); + const handleClearClick = async () => { + if (clinicalRegistration?.id == null) { + refetch(); + return; + } + + try { + await clearRegistration({ + variables: { + shortName, + registrationId, + }, + }); + await refetch(); + } catch (err) { + await refetch(); + toaster.addToast({ + variant: 'ERROR', + title: 'Something went wrong', + content: 'Uh oh! It looks like something went wrong. This page has been reloaded.', + }); + } + }; + + const handleRegisterCancelClick = () => { + setShowModal(false); + }; + + const onFileErrorClose = + (index: number) => + ({ type }: { type: NotificationInteraction }) => { + if (type === 'CLOSE') { + updateClinicalRegistrationQuery((previous) => ({ + ...previous, + clinicalRegistration: { + ...previous.clinicalRegistration, + fileErrors: previous?.clinicalRegistration?.fileErrors?.filter((_, i) => i !== index), + }, + })); + } + }; + + return ( + <> +
+ + + + + } + rightSlot={} + /> + + + {fileErrors.filter(notNull).map((fileError, index) => ( + + ))} + {clinicalRegistration?.records.length ? ( + + Clear + + } + > + + + ) : schemaOrValidationErrors.length ? ( + + ) : ( + + + + )} + +
+ + {/** Modals */} + {showRegisterModal && ( + + )} + + ); +}; + +export default Register; diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/FilePreview.tsx b/src/views/Submission/SampleRegistration/components/FilePreview.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/sample-registration/components/FilePreview.tsx rename to src/views/Submission/SampleRegistration/components/FilePreview.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/FileTable.tsx b/src/views/Submission/SampleRegistration/components/FileTable.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/sample-registration/components/FileTable.tsx rename to src/views/Submission/SampleRegistration/components/FileTable.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx b/src/views/Submission/SampleRegistration/components/Instructions.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions.tsx rename to src/views/Submission/SampleRegistration/components/Instructions.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/ProgressBar.tsx b/src/views/Submission/SampleRegistration/components/ProgressBar.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/sample-registration/components/ProgressBar.tsx rename to src/views/Submission/SampleRegistration/components/ProgressBar.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/RegisterSampleModal.tsx b/src/views/Submission/SampleRegistration/components/RegisterSampleModal.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/sample-registration/components/RegisterSampleModal.tsx rename to src/views/Submission/SampleRegistration/components/RegisterSampleModal.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/sample-registration/components/UploadError.tsx b/src/views/Submission/SampleRegistration/components/UploadError.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/sample-registration/components/UploadError.tsx rename to src/views/Submission/SampleRegistration/components/UploadError.tsx From 1d2f457a799113fa1d72b2c8a6a362985468cc37 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 01:59:27 -0500 Subject: [PATCH 13/19] fix imports --- .../Submission/SampleRegistration/SampleRegistration.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/Submission/SampleRegistration/SampleRegistration.tsx b/src/views/Submission/SampleRegistration/SampleRegistration.tsx index b0d26317..bc31b36e 100644 --- a/src/views/Submission/SampleRegistration/SampleRegistration.tsx +++ b/src/views/Submission/SampleRegistration/SampleRegistration.tsx @@ -18,10 +18,9 @@ */ 'use client'; -import Instructions from '@/app/(post-login)/submission/program/[shortName]/sample-registration/components/Instructions'; -import ProgressBar from '@/app/(post-login)/submission/program/[shortName]/sample-registration/components/ProgressBar'; import Card from '@/components/Card'; import ContentMain from '@/components/Content/ContentMain'; +import FileError from '@/components/FileError'; import NoDataMessage from '@/components/NoData'; import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; import { UPLOAD_REGISTRATION } from '@/global/constants'; @@ -37,6 +36,8 @@ import { useClinicalQuery } from '@/hooks/useApolloQuery'; import useCommonToasters from '@/hooks/useCommonToasters'; import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; import { css } from '@/lib/emotion'; +import Instructions from '@/views/Submission/SampleRegistration/components/Instructions'; +import ProgressBar from '@/views/Submission/SampleRegistration/components/ProgressBar'; import { useMutation as useGQLMutation, useQuery } from '@apollo/client'; import { BUTTON_SIZES, @@ -50,7 +51,6 @@ import { get } from 'lodash'; import { useState } from 'react'; import { useMutation } from 'react-query'; import urlJoin from 'url-join'; -import FileError from '../../../../../../components/FileError'; import FilePreview from './components/FilePreview'; import RegisterSamplesModal from './components/RegisterSampleModal'; import UploadError from './components/UploadError'; From 678c3abbfbb2571754acf641e2be0200ce6dc1a4 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 02:04:03 -0500 Subject: [PATCH 14/19] split clinical submission into view and route --- .../[shortName]/clinical-submission/page.tsx | 478 +---------------- .../ClinicalSubmission/ClinicalSubmission.tsx | 499 ++++++++++++++++++ .../components/ClearSubmissionButton.tsx | 0 .../components/FilesNavigator/FilePreview.tsx | 0 .../FilesNavigator/FileRecordTable.tsx | 0 .../components/FilesNavigator/StatsArea.tsx | 0 .../components/FilesNavigator/TableCells.tsx | 0 .../components/FilesNavigator/Tabs.tsx | 0 .../components/FilesNavigator/index.tsx | 0 .../components/FilesNavigator/tableConfig.tsx | 0 .../components/FilesNavigator/types.tsx | 0 .../components/FilesNavigator/ui.tsx | 0 .../ClinicalSubmission}/components/Header.tsx | 0 .../components/Instructions.tsx | 0 .../components/ProgressBar.tsx | 0 .../components/SignOffValidationModal.tsx | 0 .../components/SubmissionSummaryTable.tsx | 0 .../Submission/ClinicalSubmission}/data.tsx | 0 .../Submission/ClinicalSubmission}/types.ts | 0 19 files changed, 500 insertions(+), 477 deletions(-) create mode 100644 src/views/Submission/ClinicalSubmission/ClinicalSubmission.tsx rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/ClearSubmissionButton.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/FilesNavigator/FilePreview.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/FilesNavigator/FileRecordTable.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/FilesNavigator/StatsArea.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/FilesNavigator/TableCells.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/FilesNavigator/Tabs.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/FilesNavigator/index.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/FilesNavigator/tableConfig.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/FilesNavigator/types.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/FilesNavigator/ui.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/Header.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/Instructions.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/ProgressBar.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/SignOffValidationModal.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/components/SubmissionSummaryTable.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/data.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-submission => views/Submission/ClinicalSubmission}/types.ts (100%) diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx index d33edae0..2458b5ad 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-submission/page.tsx @@ -18,484 +18,8 @@ */ 'use client'; -import { ClinicalSubmissionEntity } from '@/__generated__/clinical/graphql'; -import ContentMain from '@/components/Content/ContentMain'; -import ErrorNotification, { ErrorReportColumns } from '@/components/ErrorNotification'; -import { - errorNotificationTableProps, - getDefaultErrorTableColumns, -} from '@/components/ErrorNotification/ErrorNotificationDefaultTable'; -import Loader from '@/components/Loader'; -import { ModalPortal } from '@/components/Modal'; import { pageWithPermissions } from '@/components/Page'; -import { - PROGRAM_DASHBOARD_PATH, - PROGRAM_SHORT_NAME_PATH, - UPLOAD_CLINICAL_DATA, -} from '@/global/constants'; -import { displayDateAndTime, getProgramPath, sleep, toDisplayError } from '@/global/utils'; -import { createFileFormData, uploadFileRequest } from '@/global/utils/form'; -import CLEAR_CLINICAL_SUBMISSION from '@/gql/clinical/CLEAR_CLINICAL_SUBMISSION'; -import CLINICAL_SUBMISSION_QUERY from '@/gql/clinical/CLINICAL_SUBMISSION_QUERY'; -import SIGN_OFF_SUBMISSION_MUTATION from '@/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION'; -import VALIDATE_SUBMISSION_MUTATION from '@/gql/clinical/VALIDATE_SUBMISSION_MUTATION'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useAuthContext } from '@/hooks/AuthProvider'; -import { useGlobalLoader } from '@/hooks/GlobalLoaderProvider'; -import { useToaster } from '@/hooks/ToastProvider'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; -import useCommonToasters from '@/hooks/useCommonToasters'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; -import useUrlQueryState from '@/hooks/useURLQueryState'; -import useUserConfirmationModalState from '@/hooks/useUserConfirmationModalState'; -import { css } from '@/lib/emotion'; -import { useMutation as useGQLMutation } from '@apollo/client'; -import { - ColumnDef, - NOTIFICATION_VARIANTS, - NotificationVariant, - Table, - Typography, -} from '@icgc-argo/uikit'; -import { usePathname, useRouter } from 'next/navigation'; -import { useEffect, useMemo, useState } from 'react'; -import { useMutation } from 'react-query'; -import urlJoin from 'url-join'; -import FileError from '../../../../../../components/FileError'; -import FilesNavigator from './components/FilesNavigator'; -import Header from './components/Header'; -import Instructions from './components/Instructions'; -import SignOffValidationModal from './components/SignOffValidationModal'; -import SubmissionSummaryTable from './components/SubmissionSummaryTable'; -import { parseGQLResp } from './data'; -import { - ClinicalEntity, - ClinicalSubmissionError, - ErrorTableColumnProperties, - ErrorTableColumns, -} from './types'; - -const ClinicalSubmission = ({ shortName }: { shortName: string }) => { - const URL_QUERY_KEY = 'tab'; - const commonToaster = useCommonToasters(); - const [query] = useUrlQueryState(URL_QUERY_KEY); - const [selectedClinicalEntityType, setEntityType] = useState(query); - const router = useRouter(); - const pathname = usePathname(); - const { setGlobalLoading } = useGlobalLoader(); - const toaster = useToaster(); - const { CLINICAL_API_ROOT } = useAppConfigContext(); - const { egoJwt } = useAuthContext(); - - useEffect(() => { - const defaultQuery = '?tab=donor'; - if (query === '') { - const url = `${pathname}${defaultQuery}`; - router.replace(url); - } else { - setEntityType(query); - } - }, [query]); - - // page data query - const { - data: gqlData, - loading: isLoading, - refetch, - updateQuery: updateClinicalSubmissionQuery, - } = useClinicalQuery(CLINICAL_SUBMISSION_QUERY, { - variables: { - programShortName: shortName, - }, - }); - - // mutations - const [clearClinicalSubmission] = useGQLMutation(CLEAR_CLINICAL_SUBMISSION); - - const uploadClinicalSubmission = useMutation( - (formData) => { - const url = urlJoin(CLINICAL_API_ROOT, getProgramPath(UPLOAD_CLINICAL_DATA, shortName)); - return uploadFileRequest(url, formData, egoJwt); - }, - { - onError: () => { - commonToaster.unknownError(); - }, - }, - ); - - const handleSubmissionFilesUpload = (files: FileList) => { - const fileFormData = createFileFormData(files, 'clinicalFiles'); - return uploadClinicalSubmission.mutate(fileFormData); - }; - - const [validateSubmission] = useGQLMutation(VALIDATE_SUBMISSION_MUTATION, { - onCompleted: () => { - //setSelectedClinicalEntityType(defaultClinicalEntityType); - }, - }); - - const [signOffSubmission] = useGQLMutation(SIGN_OFF_SUBMISSION_MUTATION); - - const { isDisabled: isSubmissionSystemDisabled } = useSubmissionSystemStatus(); - - /** - * Data - */ - const { - clinicalState, - clinicalFileErrors, - clinicalEntities, - clinicalVersion, - isPendingApproval, - updateInfo, - } = parseGQLResp(gqlData); - - const allDataErrors = useMemo( - () => - clinicalEntities.reduce>( - (acc, entity) => [ - ...acc, - ...entity.dataErrors.map((err) => ({ - ...err, - fileName: entity.fileName, - })), - ], - [], - ), - [clinicalEntities], - ); - - const allDataWarnings = useMemo( - () => - clinicalEntities.reduce>( - (acc, entity) => [ - ...acc, - ...entity.dataWarnings.map((err) => ({ - ...err, - fileName: entity.fileName, - })), - ], - [], - ), - [clinicalEntities], - ); - - // File Errors - const onErrorClose = - (index: number) => - ({ type }: { type: string }) => { - if (type === 'CLOSE') { - updateClinicalSubmissionQuery((previous) => ({ - ...previous, - clinicalSubmissions: { - ...previous.clinicalSubmissions, - fileErrors: previous.clinicalSubmissions.fileErrors?.filter((_, i) => i !== index), - }, - })); - } - }; - - /** - * Submission data errors and warnings - */ - const getErrorColumns = ( - level: NotificationVariant, - ): { - errorReportColumns: ErrorReportColumns[]; - errorTableColumns: ColumnDef[]; - } => { - const errorTableColumns: ErrorTableColumnProperties[] = [ - { - accessorKey: 'fileName', - header: 'File', - maxSize: 150, - }, - ...getDefaultErrorTableColumns(level), - ]; - - const errorReportColumns: ErrorReportColumns[] = errorTableColumns.map( - ({ accessorKey, header }) => ({ - header, - id: accessorKey, - }), - ); - - return { errorReportColumns, errorTableColumns }; - }; - - // Errors - const { errorReportColumns, errorTableColumns } = getErrorColumns(NOTIFICATION_VARIANTS.ERROR); - const errorData = allDataErrors.map(toDisplayError); - const ErrorTable = ( - - ); - - // Warnings - const { errorReportColumns: warningReportColumns, errorTableColumns: warningTableColumns } = - getErrorColumns(NOTIFICATION_VARIANTS.WARNING); - const warningData = allDataWarnings.map(toDisplayError); - const WarningTable = ( -
- ); - - const { - isModalShown: signOffModalShown, - getUserConfirmation: getSignOffConfirmation, - onConfirmed: onSignOffApproved, - onCancel: onSignOffCanceled, - } = useUserConfirmationModalState(); - - if (isLoading) { - return ; - } else if (gqlData) { - const hasDataWarning = !!allDataWarnings.length; - const hasDataError = !!allDataErrors.length; - const hasSchemaErrorsAfterMigration = clinicalState === 'INVALID_BY_MIGRATION'; - const hasSchemaError = - clinicalEntities.length && clinicalEntities.some(({ schemaErrors }) => !!schemaErrors.length); - const hasSomeEntity = clinicalEntities.some(({ records }) => !!records.length); - - /** - * Instruction Box - */ - // Instruction box state - const isReadyForValidation = hasSomeEntity && !hasSchemaError && !hasSchemaErrorsAfterMigration; - const isReadyForSignoff = isReadyForValidation && clinicalState === 'VALID'; - const isValidated = clinicalState !== 'OPEN'; - // Instruction box handlers - const handleSubmissionValidation = async () => { - try { - await validateSubmission({ - variables: { - programShortName: shortName, - submissionVersion: clinicalVersion, - }, - }); - } catch (err) { - await refetch(); - commonToaster.unknownErrorWithReloadMessage(); - } - }; - - const handleSignOff = async () => { - try { - const userDidApprove = await getSignOffConfirmation(); - - if (userDidApprove) { - setGlobalLoading(true); - await sleep(); - const { data: newData } = await signOffSubmission({ - variables: { - programShortName: shortName, - submissionVersion: clinicalVersion, - }, - }); - - if (newData.clinicalSubmissions.state === null) { - router.push(PROGRAM_DASHBOARD_PATH.replace(PROGRAM_SHORT_NAME_PATH, shortName)); - setGlobalLoading(false); - - toaster.addToast({ - variant: 'SUCCESS', - interactionType: 'CLOSE', - title: 'Successful Clinical Submission!', - content: - 'Your clinical data has been submitted. You will see the updates on your dashboard shortly.', - }); - } else { - setGlobalLoading(false); - } - } - } catch (err) { - await refetch(); - commonToaster.unknownErrorWithReloadMessage(); - setGlobalLoading(false); - } - }; - - /** - * File Navigator - */ - // FileNavigator handlers - // errors are client side only and not persisted, this updates GQL cache only - const handleClearSchemaError = async (file: ClinicalEntity) => { - updateClinicalSubmissionQuery((previous) => { - return { - ...previous, - clinicalSubmissions: { - ...previous.clinicalSubmissions, - clinicalEntities: previous.clinicalSubmissions.clinicalEntities.map((entity) => { - const clearedSchemaType = file.clinicalType; - const currentEntityType = entity?.clinicalType || ''; - const currentEntitySchemaError = entity?.schemaErrors || []; - return { - ...entity, - schemaErrors: - clearedSchemaType === currentEntityType ? [] : currentEntitySchemaError, - } as ClinicalSubmissionEntity; - }), - }, - }; - }); - }; - const setSelectedClinicalEntityType = () => null; - - return ( - <> - {signOffModalShown && ( - - - - )} -
-
- - clinicalType)} - /> - {isPendingApproval && ( -
-
- - Submission Summary - - - Signed off on {displayDateAndTime(updateInfo.updatedAt)} by{' '} - {updateInfo.updatedBy} - -
- -
- )} - - {/* File errors */} - {clinicalFileErrors.map(({ fileNames, message }, i) => ( - - ))} - - {/* Submimssion data errors */} - {hasDataError && ( -
- -
- )} - - {/* Submission data warnings */} - {hasDataWarning && ( -
- -
- )} - {/* Main clinical entity section */} - -
-
- - ); - } else { - return <>; - } -}; +import ClinicalSubmission from '@/views/Submission/ClinicalSubmission/ClinicalSubmission'; const ClinicalSubmissionPage = ({ params: { shortName } }: { params: { shortName: string } }) => { const Page = pageWithPermissions(ClinicalSubmission, { diff --git a/src/views/Submission/ClinicalSubmission/ClinicalSubmission.tsx b/src/views/Submission/ClinicalSubmission/ClinicalSubmission.tsx new file mode 100644 index 00000000..6b776e67 --- /dev/null +++ b/src/views/Submission/ClinicalSubmission/ClinicalSubmission.tsx @@ -0,0 +1,499 @@ +/* + * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved + * + * This program and the accompanying materials are made available under the terms of + * the GNU Affero General Public License v3.0. You should have received a copy of the + * GNU Affero General Public License along with this program. + * If not, see . + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +'use client'; + +import { ClinicalSubmissionEntity } from '@/__generated__/clinical/graphql'; +import ContentMain from '@/components/Content/ContentMain'; +import ErrorNotification, { ErrorReportColumns } from '@/components/ErrorNotification'; +import { + errorNotificationTableProps, + getDefaultErrorTableColumns, +} from '@/components/ErrorNotification/ErrorNotificationDefaultTable'; +import FileError from '@/components/FileError'; +import Loader from '@/components/Loader'; +import { ModalPortal } from '@/components/Modal'; +import { + PROGRAM_DASHBOARD_PATH, + PROGRAM_SHORT_NAME_PATH, + UPLOAD_CLINICAL_DATA, +} from '@/global/constants'; +import { displayDateAndTime, getProgramPath, sleep, toDisplayError } from '@/global/utils'; +import { createFileFormData, uploadFileRequest } from '@/global/utils/form'; +import CLEAR_CLINICAL_SUBMISSION from '@/gql/clinical/CLEAR_CLINICAL_SUBMISSION'; +import CLINICAL_SUBMISSION_QUERY from '@/gql/clinical/CLINICAL_SUBMISSION_QUERY'; +import SIGN_OFF_SUBMISSION_MUTATION from '@/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION'; +import VALIDATE_SUBMISSION_MUTATION from '@/gql/clinical/VALIDATE_SUBMISSION_MUTATION'; +import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAuthContext } from '@/hooks/AuthProvider'; +import { useGlobalLoader } from '@/hooks/GlobalLoaderProvider'; +import { useToaster } from '@/hooks/ToastProvider'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import useCommonToasters from '@/hooks/useCommonToasters'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import useUrlQueryState from '@/hooks/useURLQueryState'; +import useUserConfirmationModalState from '@/hooks/useUserConfirmationModalState'; +import { css } from '@/lib/emotion'; +import { useMutation as useGQLMutation } from '@apollo/client'; +import { + ColumnDef, + NOTIFICATION_VARIANTS, + NotificationVariant, + Table, + Typography, +} from '@icgc-argo/uikit'; +import { usePathname, useRouter } from 'next/navigation'; +import { useEffect, useMemo, useState } from 'react'; +import { useMutation } from 'react-query'; +import urlJoin from 'url-join'; +import FilesNavigator from './components/FilesNavigator'; +import Header from './components/Header'; +import Instructions from './components/Instructions'; +import SignOffValidationModal from './components/SignOffValidationModal'; +import SubmissionSummaryTable from './components/SubmissionSummaryTable'; +import { parseGQLResp } from './data'; +import { + ClinicalEntity, + ClinicalSubmissionError, + ErrorTableColumnProperties, + ErrorTableColumns, +} from './types'; + +const ClinicalSubmission = ({ shortName }: { shortName: string }) => { + const URL_QUERY_KEY = 'tab'; + const commonToaster = useCommonToasters(); + const [query] = useUrlQueryState(URL_QUERY_KEY); + const [selectedClinicalEntityType, setEntityType] = useState(query); + const router = useRouter(); + const pathname = usePathname(); + const { setGlobalLoading } = useGlobalLoader(); + const toaster = useToaster(); + const { CLINICAL_API_ROOT } = useAppConfigContext(); + const { egoJwt } = useAuthContext(); + + useEffect(() => { + const defaultQuery = '?tab=donor'; + if (query === '') { + const url = `${pathname}${defaultQuery}`; + router.replace(url); + } else { + setEntityType(query); + } + }, [query]); + + // page data query + const { + data: gqlData, + loading: isLoading, + refetch, + updateQuery: updateClinicalSubmissionQuery, + } = useClinicalQuery(CLINICAL_SUBMISSION_QUERY, { + variables: { + programShortName: shortName, + }, + }); + + // mutations + const [clearClinicalSubmission] = useGQLMutation(CLEAR_CLINICAL_SUBMISSION); + + const uploadClinicalSubmission = useMutation( + (formData) => { + const url = urlJoin(CLINICAL_API_ROOT, getProgramPath(UPLOAD_CLINICAL_DATA, shortName)); + return uploadFileRequest(url, formData, egoJwt); + }, + { + onError: () => { + commonToaster.unknownError(); + }, + }, + ); + + const handleSubmissionFilesUpload = (files: FileList) => { + const fileFormData = createFileFormData(files, 'clinicalFiles'); + return uploadClinicalSubmission.mutate(fileFormData); + }; + + const [validateSubmission] = useGQLMutation(VALIDATE_SUBMISSION_MUTATION, { + onCompleted: () => { + //setSelectedClinicalEntityType(defaultClinicalEntityType); + }, + }); + + const [signOffSubmission] = useGQLMutation(SIGN_OFF_SUBMISSION_MUTATION); + + const { isDisabled: isSubmissionSystemDisabled } = useSubmissionSystemStatus(); + + /** + * Data + */ + const { + clinicalState, + clinicalFileErrors, + clinicalEntities, + clinicalVersion, + isPendingApproval, + updateInfo, + } = parseGQLResp(gqlData); + + const allDataErrors = useMemo( + () => + clinicalEntities.reduce>( + (acc, entity) => [ + ...acc, + ...entity.dataErrors.map((err) => ({ + ...err, + fileName: entity.fileName, + })), + ], + [], + ), + [clinicalEntities], + ); + + const allDataWarnings = useMemo( + () => + clinicalEntities.reduce>( + (acc, entity) => [ + ...acc, + ...entity.dataWarnings.map((err) => ({ + ...err, + fileName: entity.fileName, + })), + ], + [], + ), + [clinicalEntities], + ); + + // File Errors + const onErrorClose = + (index: number) => + ({ type }: { type: string }) => { + if (type === 'CLOSE') { + updateClinicalSubmissionQuery((previous) => ({ + ...previous, + clinicalSubmissions: { + ...previous.clinicalSubmissions, + fileErrors: previous.clinicalSubmissions.fileErrors?.filter((_, i) => i !== index), + }, + })); + } + }; + + /** + * Submission data errors and warnings + */ + const getErrorColumns = ( + level: NotificationVariant, + ): { + errorReportColumns: ErrorReportColumns[]; + errorTableColumns: ColumnDef[]; + } => { + const errorTableColumns: ErrorTableColumnProperties[] = [ + { + accessorKey: 'fileName', + header: 'File', + maxSize: 150, + }, + ...getDefaultErrorTableColumns(level), + ]; + + const errorReportColumns: ErrorReportColumns[] = errorTableColumns.map( + ({ accessorKey, header }) => ({ + header, + id: accessorKey, + }), + ); + + return { errorReportColumns, errorTableColumns }; + }; + + // Errors + const { errorReportColumns, errorTableColumns } = getErrorColumns(NOTIFICATION_VARIANTS.ERROR); + const errorData = allDataErrors.map(toDisplayError); + const ErrorTable = ( +
+ ); + + // Warnings + const { errorReportColumns: warningReportColumns, errorTableColumns: warningTableColumns } = + getErrorColumns(NOTIFICATION_VARIANTS.WARNING); + const warningData = allDataWarnings.map(toDisplayError); + const WarningTable = ( +
+ ); + + const { + isModalShown: signOffModalShown, + getUserConfirmation: getSignOffConfirmation, + onConfirmed: onSignOffApproved, + onCancel: onSignOffCanceled, + } = useUserConfirmationModalState(); + + if (isLoading) { + return ; + } else if (gqlData) { + const hasDataWarning = !!allDataWarnings.length; + const hasDataError = !!allDataErrors.length; + const hasSchemaErrorsAfterMigration = clinicalState === 'INVALID_BY_MIGRATION'; + const hasSchemaError = + clinicalEntities.length && clinicalEntities.some(({ schemaErrors }) => !!schemaErrors.length); + const hasSomeEntity = clinicalEntities.some(({ records }) => !!records.length); + + /** + * Instruction Box + */ + // Instruction box state + const isReadyForValidation = hasSomeEntity && !hasSchemaError && !hasSchemaErrorsAfterMigration; + const isReadyForSignoff = isReadyForValidation && clinicalState === 'VALID'; + const isValidated = clinicalState !== 'OPEN'; + // Instruction box handlers + const handleSubmissionValidation = async () => { + try { + await validateSubmission({ + variables: { + programShortName: shortName, + submissionVersion: clinicalVersion, + }, + }); + } catch (err) { + await refetch(); + commonToaster.unknownErrorWithReloadMessage(); + } + }; + + const handleSignOff = async () => { + try { + const userDidApprove = await getSignOffConfirmation(); + + if (userDidApprove) { + setGlobalLoading(true); + await sleep(); + const { data: newData } = await signOffSubmission({ + variables: { + programShortName: shortName, + submissionVersion: clinicalVersion, + }, + }); + + if (newData.clinicalSubmissions.state === null) { + router.push(PROGRAM_DASHBOARD_PATH.replace(PROGRAM_SHORT_NAME_PATH, shortName)); + setGlobalLoading(false); + + toaster.addToast({ + variant: 'SUCCESS', + interactionType: 'CLOSE', + title: 'Successful Clinical Submission!', + content: + 'Your clinical data has been submitted. You will see the updates on your dashboard shortly.', + }); + } else { + setGlobalLoading(false); + } + } + } catch (err) { + await refetch(); + commonToaster.unknownErrorWithReloadMessage(); + setGlobalLoading(false); + } + }; + + /** + * File Navigator + */ + // FileNavigator handlers + // errors are client side only and not persisted, this updates GQL cache only + const handleClearSchemaError = async (file: ClinicalEntity) => { + updateClinicalSubmissionQuery((previous) => { + return { + ...previous, + clinicalSubmissions: { + ...previous.clinicalSubmissions, + clinicalEntities: previous.clinicalSubmissions.clinicalEntities.map((entity) => { + const clearedSchemaType = file.clinicalType; + const currentEntityType = entity?.clinicalType || ''; + const currentEntitySchemaError = entity?.schemaErrors || []; + return { + ...entity, + schemaErrors: + clearedSchemaType === currentEntityType ? [] : currentEntitySchemaError, + } as ClinicalSubmissionEntity; + }), + }, + }; + }); + }; + const setSelectedClinicalEntityType = () => null; + + return ( + <> + {signOffModalShown && ( + + + + )} +
+
+ + clinicalType)} + /> + {isPendingApproval && ( +
+
+ + Submission Summary + + + Signed off on {displayDateAndTime(updateInfo.updatedAt)} by{' '} + {updateInfo.updatedBy} + +
+ +
+ )} + + {/* File errors */} + {clinicalFileErrors.map(({ fileNames, message }, i) => ( + + ))} + + {/* Submimssion data errors */} + {hasDataError && ( +
+ +
+ )} + + {/* Submission data warnings */} + {hasDataWarning && ( +
+ +
+ )} + {/* Main clinical entity section */} + +
+
+ + ); + } else { + return <>; + } +}; + +export default ClinicalSubmission; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ClearSubmissionButton.tsx b/src/views/Submission/ClinicalSubmission/components/ClearSubmissionButton.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ClearSubmissionButton.tsx rename to src/views/Submission/ClinicalSubmission/components/ClearSubmissionButton.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FilePreview.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/FilePreview.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FilePreview.tsx rename to src/views/Submission/ClinicalSubmission/components/FilesNavigator/FilePreview.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FileRecordTable.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/FileRecordTable.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/FileRecordTable.tsx rename to src/views/Submission/ClinicalSubmission/components/FilesNavigator/FileRecordTable.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/StatsArea.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/StatsArea.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/StatsArea.tsx rename to src/views/Submission/ClinicalSubmission/components/FilesNavigator/StatsArea.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/TableCells.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/TableCells.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/TableCells.tsx rename to src/views/Submission/ClinicalSubmission/components/FilesNavigator/TableCells.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/Tabs.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/Tabs.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/Tabs.tsx rename to src/views/Submission/ClinicalSubmission/components/FilesNavigator/Tabs.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/index.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/index.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/index.tsx rename to src/views/Submission/ClinicalSubmission/components/FilesNavigator/index.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/tableConfig.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/tableConfig.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/tableConfig.tsx rename to src/views/Submission/ClinicalSubmission/components/FilesNavigator/tableConfig.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/types.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/types.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/types.tsx rename to src/views/Submission/ClinicalSubmission/components/FilesNavigator/types.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/ui.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/ui.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/FilesNavigator/ui.tsx rename to src/views/Submission/ClinicalSubmission/components/FilesNavigator/ui.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Header.tsx b/src/views/Submission/ClinicalSubmission/components/Header.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Header.tsx rename to src/views/Submission/ClinicalSubmission/components/Header.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Instructions.tsx b/src/views/Submission/ClinicalSubmission/components/Instructions.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/Instructions.tsx rename to src/views/Submission/ClinicalSubmission/components/Instructions.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ProgressBar.tsx b/src/views/Submission/ClinicalSubmission/components/ProgressBar.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/ProgressBar.tsx rename to src/views/Submission/ClinicalSubmission/components/ProgressBar.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/SignOffValidationModal.tsx b/src/views/Submission/ClinicalSubmission/components/SignOffValidationModal.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/SignOffValidationModal.tsx rename to src/views/Submission/ClinicalSubmission/components/SignOffValidationModal.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/SubmissionSummaryTable.tsx b/src/views/Submission/ClinicalSubmission/components/SubmissionSummaryTable.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/components/SubmissionSummaryTable.tsx rename to src/views/Submission/ClinicalSubmission/components/SubmissionSummaryTable.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/data.tsx b/src/views/Submission/ClinicalSubmission/data.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/data.tsx rename to src/views/Submission/ClinicalSubmission/data.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-submission/types.ts b/src/views/Submission/ClinicalSubmission/types.ts similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-submission/types.ts rename to src/views/Submission/ClinicalSubmission/types.ts From 63625ad428726ca57f6d8716b108abd98a2c1b03 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 02:12:11 -0500 Subject: [PATCH 15/19] split clinical data page into view and route --- .../[shortName]/clinical-data/common.tsx | 227 -------------- .../[shortName]/clinical-data/page.tsx | 278 +--------------- .../Submission/ClinicalData/ClinicalData.tsx | 296 ++++++++++++++++++ .../components}/ClinicalEntityDataTable.tsx | 5 +- .../components}/DownloadButtons.tsx | 2 +- .../SearchBar/FilterModal/MatchResults.tsx | 0 .../SearchBar/FilterModal/UploadButton.tsx | 0 .../SearchBar/FilterModal/index.tsx | 3 +- .../SearchBar/SearchResultsMenu.tsx | 0 .../components}/SearchBar/index.tsx | 10 +- .../components}/SearchBar/style.tsx | 0 src/views/Submission/ClinicalData/data.ts | 113 +++++++ src/views/Submission/ClinicalData/types.ts | 98 ++++++ .../DonorDataSummary/DonorSummaryTable.tsx | 2 +- 14 files changed, 517 insertions(+), 517 deletions(-) delete mode 100644 src/app/(post-login)/submission/program/[shortName]/clinical-data/common.tsx create mode 100644 src/views/Submission/ClinicalData/ClinicalData.tsx rename src/{app/(post-login)/submission/program/[shortName]/clinical-data => views/Submission/ClinicalData/components}/ClinicalEntityDataTable.tsx (99%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-data => views/Submission/ClinicalData/components}/DownloadButtons.tsx (98%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-data => views/Submission/ClinicalData/components}/SearchBar/FilterModal/MatchResults.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-data => views/Submission/ClinicalData/components}/SearchBar/FilterModal/UploadButton.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-data => views/Submission/ClinicalData/components}/SearchBar/FilterModal/index.tsx (97%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-data => views/Submission/ClinicalData/components}/SearchBar/SearchResultsMenu.tsx (100%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-data => views/Submission/ClinicalData/components}/SearchBar/index.tsx (97%) rename src/{app/(post-login)/submission/program/[shortName]/clinical-data => views/Submission/ClinicalData/components}/SearchBar/style.tsx (100%) create mode 100644 src/views/Submission/ClinicalData/data.ts create mode 100644 src/views/Submission/ClinicalData/types.ts diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/common.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-data/common.tsx deleted file mode 100644 index f1f254cd..00000000 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/common.tsx +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2022 The Ontario Institute for Cancer Research. All rights reserved - * - * This program and the accompanying materials are made available under the terms of - * the GNU Affero General Public License v3.0. You should have received a copy of the - * GNU Affero General Public License along with this program. - * If not, see . - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -export enum CoreCompletionEntities { - donor = 'donor', - primaryDiagnosis = 'primaryDiagnosis', - specimens = 'specimens', - treatments = 'treatments', - followUps = 'followUps', -} - -export type CoreCompletion = { - [field in CoreCompletionEntities]: number; -}; - -export type CompletionStats = { - coreCompletion: CoreCompletion; - coreCompletionDate: string; - coreCompletionPercentage: number; - donorId: number; - overriddenCoreCompletion: [CoreCompletionEntities]; - entityData?: CompletionEntityData; -}; - -export type CompletionEntityData = { - specimens?: SpecimenCoreCompletion; -}; - -export type SpecimenCoreCompletion = { - coreCompletionPercentage: number; - normalSpecimensPercentage: number; - tumourSpecimensPercentage: number; - normalRegistrations: number; - normalSubmissions: number; - tumourRegistrations: number; - tumourSubmissions: number; -}; - -export enum CompletionStates { - all = 'all', - invalid = 'invalid', - complete = 'complete', - incomplete = 'incomplete', -} - -export type ClinicalEntity = { - entityName: string; - entityFields: string[]; - totalDocs: number; - completionStats?: Array; - records: Array<{ - name: string; - value: any; - }>[]; -}; - -export type ClinicalSearchResult = { - donorId: number; - submitterDonorId: string; -}; - -export type ClinicalErrorData = { - donorId: number; - submitterDonorId: string; - errors: { - entityName: string; - errorType: string; - fieldName: string; - index: number; - info: { value: string[] }; - message: string; - }[]; -}; - -export type ClinicalEntityQueryResponse = { - clinicalData: { - programShortName?: string; - clinicalEntities: Array; - clinicalErrors: Array; - }; -}; - -export type ClinicalEntitySearchResultResponse = { - clinicalSearchResults: { - programShortName?: string; - totalResults: number; - searchResults: Array; - }; -}; - -export type ClinicalFilter = { - entityTypes: string[]; - page: number; - pageSize: number; - donorIds?: string[]; - submitterDonorIds?: string[]; - completionState?: CompletionStates; - sort?: string; -}; - -export const clinicalEntityDisplayNames = { - donor: 'Donor', - sampleRegistration: 'Sample Registration', - sample_registration: 'Sample Registration', - specimens: 'Specimen', - specimen: 'Specimen', - primaryDiagnoses: 'Primary Diagnosis', - primary_diagnosis: 'Primary Diagnosis', - treatment: 'Treatment', - chemotherapy: 'Chemotherapy', - hormoneTherapy: 'Hormone Therapy', - hormone_therapy: 'Hormone Therapy', - immunotherapy: 'Immunotherapy', - radiation: 'Radiation', - surgery: 'Surgery', - followUps: 'Follow Up', - follow_up: 'Follow Up', - familyHistory: 'Family History', - family_history: 'Family History', - exposure: 'Exposure', - comorbidity: 'Comorbidity', - biomarker: 'Biomarker', -} as const; - -export const aliasedEntityNames = { - donor: 'donor', - sampleRegistration: 'sample_registration', - specimens: 'specimen', - primaryDiagnoses: 'primary_diagnosis', - familyHistory: 'family_history', - treatment: 'treatment', - chemotherapy: 'chemotherapy', - immunotherapy: 'immunotherapy', - surgery: 'surgery', - radiation: 'radiation', - followUps: 'follow_up', - hormoneTherapy: 'hormone_therapy', - exposure: 'exposure', - comorbidity: 'comorbidity', - biomarker: 'biomarker', -}; - -type AliasedEntityNamesKeys = keyof typeof aliasedEntityNames; -export const clinicalEntityFields = Object.keys(aliasedEntityNames) as AliasedEntityNamesKeys[]; -export const aliasedEntityFields = Object.values(aliasedEntityNames); - -// Util for finding camelCase alias for snake_case values -export const reverseLookUpEntityAlias = (selectedClinicalEntity: string) => { - const findAlias = Object.entries(aliasedEntityNames).find( - ([key, value]) => value === selectedClinicalEntity, - ); - - return findAlias ? findAlias[0] : 'donor'; -}; - -export const parseDonorIdString = (donorId: string) => - donorId.match(/do/i) ? parseInt(donorId.split('DO')[1]) : parseInt(donorId); - -export const aliasSortNames = { - donor_id: 'donorId', - program_id: 'programId', - submitter_id: 'submitterId', - DO: 'donorId', - PD: 'primaryDiagnoses', - NS: 'specimens', - TS: 'familyHistory', - TR: 'treatments', - FO: 'followUps', -}; - -export const defaultClinicalEntityFilters: ClinicalFilter = { - entityTypes: clinicalEntityFields, - page: 0, - pageSize: 20, - donorIds: [], - submitterDonorIds: [], - completionState: CompletionStates['all'], - sort: aliasSortNames.donor_id, -}; - -export const hasClinicalErrors = ( - { clinicalErrors }: ClinicalEntityQueryResponse['clinicalData'], - currentEntity: string, -) => - clinicalErrors && - clinicalErrors.length > 0 && - clinicalErrors.filter( - (donor) => - donor.errors && - donor.errors.some( - ({ entityName }) => - aliasedEntityFields.includes(entityName) && - reverseLookUpEntityAlias(entityName) === currentEntity, - ), - ).length > 0; - -export const emptyClinicalDataResponse: ClinicalEntityQueryResponse = { - clinicalData: { - clinicalEntities: [], - clinicalErrors: [], - }, -}; - -export const emptySearchResponse: ClinicalEntitySearchResultResponse = { - clinicalSearchResults: { - searchResults: [], - totalResults: 0, - }, -}; - -export type TsvDownloadIds = { donorIds: number[]; submitterDonorIds: string[] }; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/page.tsx b/src/app/(post-login)/submission/program/[shortName]/clinical-data/page.tsx index 55e5b902..490f8daa 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/page.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/clinical-data/page.tsx @@ -18,284 +18,8 @@ */ 'use client'; -import ContentMain from '@/components/Content/ContentMain'; import { pageWithPermissions } from '@/components/Page'; -import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; -import { notNull, parseDonorIdString } from '@/global/utils'; -import CLINICAL_ENTITY_SEARCH_RESULTS_QUERY from '@/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY'; -import SUBMITTED_DATA_SIDE_MENU_QUERY from '@/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; -import useUrlParamState from '@/hooks/useUrlParamState'; -import { css } from '@/lib/emotion'; -import { useQuery } from '@apollo/client'; -import { Loader, Typography, VerticalTabs, useTheme } from '@icgc-argo/uikit'; -import { useState } from 'react'; -import { setConfiguration } from 'react-grid-system'; -import ClinicalEntityDataTable from './ClinicalEntityDataTable'; -import ClinicalDownloadButton from './DownloadButtons'; -import SearchBar from './SearchBar'; -import { - ClinicalEntitySearchResultResponse, - CompletionStates, - TsvDownloadIds, - aliasedEntityNames, - clinicalEntityDisplayNames, - clinicalEntityFields, - defaultClinicalEntityFilters, - emptyClinicalDataResponse, - emptySearchResponse, - hasClinicalErrors, - reverseLookUpEntityAlias, -} from './common'; - -setConfiguration({ gutterWidth: 9 }); - -const defaultClinicalEntityTab = aliasedEntityNames.donor; - -// convert codegen automated types to definitions in existing code -// make data object shape uniform -const parseSearchResult = ( - data: ClinicalEntitySearchResultResponse | undefined, -): ClinicalEntitySearchResultResponse => { - if (!data) return emptySearchResponse; - return { - clinicalSearchResults: { - searchResults: data.clinicalSearchResults.searchResults.map((searchResults) => ({ - donorId: searchResults?.donorId || 0, - submitterDonorId: searchResults?.submitterDonorId || '', - })), - totalResults: data.clinicalSearchResults.totalResults, - }, - }; -}; - -const ClinicalDataPageComp = ({ programShortName }: { programShortName: string }) => { - const theme = useTheme(); - - const [keyword, setKeyword] = useState(''); - const [completionState, setCompletionState] = useState(CompletionStates['all']); - const [modalVisible, setModalVisible] = useState(false); - - const [selectedClinicalEntityTab, setSelectedClinicalEntityTab] = useUrlParamState( - 'tab', - defaultClinicalEntityTab, - ); - const [selectedDonors, setSelectedDonors] = useUrlParamState('donorId', ''); - - const currentEntity = reverseLookUpEntityAlias(selectedClinicalEntityTab); - const urlDonorQueryStrings = selectedDonors ? selectedDonors.split(',') : []; - const currentDonors = urlDonorQueryStrings.length - ? urlDonorQueryStrings.map((donorId) => parseDonorIdString(donorId)) - : []; - - // Matches multiple digits and/or digits preceded by DO, followed by a comma, space, or end of string - // Example: DO259138, 2579137, DASH-7, DO253290abcdef - // Regex will match first 2 Donor IDs, but not 3rd Submitter ID or 4th case w/ random text - const searchDonorIds = - keyword - .match(/(?=DO|\d)\d+(?=,| |$)/gi) - ?.filter((match) => !!match) - .map((idString) => parseInt(idString)) || []; - - // Matches 'D' or 'DO' exactly (case insensitive) - const donorPrefixSearch = keyword.match(/^(d|do)\b/gi); - - const searchSubmitterIds = donorPrefixSearch - ? [] - : keyword.split(/, |,/).filter((word) => !!word); - - // Search Result Query - // Populates dropdown menu; Search query populates data table if there are no URL params - const { data: searchResultData, loading: searchResultsLoading } = useClinicalQuery( - CLINICAL_ENTITY_SEARCH_RESULTS_QUERY, - { - errorPolicy: 'all', - variables: { - programShortName, - filters: { - ...defaultClinicalEntityFilters, - completionState, - entityTypes: [currentEntity], - donorIds: searchDonorIds, - submitterDonorIds: searchSubmitterIds, - }, - }, - }, - ); - - const parsedSearchResultData = parseSearchResult(searchResultData); - - const searchResults = parsedSearchResultData?.clinicalSearchResults?.searchResults; - const searchResultIds = searchResults.map((result) => result?.donorId).filter(notNull); - - const sideMenuQueryDonorIds = - urlDonorQueryStrings.length > 0 - ? currentDonors - : searchResults.length > 0 && keyword.length > 0 - ? searchResultIds - : []; - - // Side Menu Query - // Populates Clinical Entity Table, Side Menu, Title Bar - const { data: sideMenuQuery, loading: sideMenuLoading } = useQuery( - SUBMITTED_DATA_SIDE_MENU_QUERY, - { - errorPolicy: 'all', - variables: { - programShortName, - filters: { - ...defaultClinicalEntityFilters, - completionState, - donorIds: sideMenuQueryDonorIds, - }, - }, - }, - ); - - const sideMenuData = - sideMenuQuery == undefined || sideMenuLoading ? emptyClinicalDataResponse : sideMenuQuery; - - const { clinicalData } = sideMenuData; - - const useDefaultQuery = - currentDonors.length === 0 && - (donorPrefixSearch || (searchDonorIds.length === 0 && searchSubmitterIds.length === 0)) && - completionState === 'all'; - - const noSearchData = searchResultData === null || searchResultData === undefined; - const noData = - clinicalData.clinicalEntities.length === 0 && noSearchData && currentDonors.length === 0; - - const entityTableDonorIds = - currentDonors.length > 0 ? currentDonors : searchResults.length > 0 ? searchResultIds : []; - - const entityTableSubmitterDonorIds = (searchResults || []) - .map((searchResults) => searchResults?.submitterDonorId) - .filter(Boolean); - - const tsvDownloadIds: TsvDownloadIds = { - donorIds: useDefaultQuery ? [] : entityTableDonorIds, - submitterDonorIds: useDefaultQuery ? [] : entityTableSubmitterDonorIds.filter(notNull), - }; - - const menuItems = clinicalEntityFields.map((entity) => ( - setSelectedClinicalEntityTab(aliasedEntityNames[entity])} - disabled={ - !clinicalData.clinicalEntities.some((e) => e?.entityName === aliasedEntityNames[entity]) - } - > - {clinicalEntityDisplayNames[entity]} - {hasClinicalErrors(clinicalData, entity) && ( - ! - )} - - )); - - return ( -
- } - rightSlot={} - /> - {searchResultsLoading ? ( - - ) : ( - <> - - -
- {/* Sidebar */} -
- {menuItems} -
- {/* Content */} -
- {/* Header */} -
- - {clinicalEntityDisplayNames[currentEntity]} Data - - - -
- {/* DataTable */} -
- -
-
{' '} -
-
- - )} -
- ); -}; +import ClinicalDataPageComp from '@/views/Submission/ClinicalData/ClinicalData'; const ClinicalDataPage = ({ params: { shortName = '' } }: { params: { shortName: string } }) => { const ClinicalDataWithPermissions = pageWithPermissions(ClinicalDataPageComp, { diff --git a/src/views/Submission/ClinicalData/ClinicalData.tsx b/src/views/Submission/ClinicalData/ClinicalData.tsx new file mode 100644 index 00000000..aae33018 --- /dev/null +++ b/src/views/Submission/ClinicalData/ClinicalData.tsx @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2023 The Ontario Institute for Cancer Research. All rights reserved + * + * This program and the accompanying materials are made available under the terms of + * the GNU Affero General Public License v3.0. You should have received a copy of the + * GNU Affero General Public License along with this program. + * If not, see . + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +'use client'; + +import ContentMain from '@/components/Content/ContentMain'; +import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/PageHeader'; +import { notNull, parseDonorIdString } from '@/global/utils'; +import CLINICAL_ENTITY_SEARCH_RESULTS_QUERY from '@/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY'; +import SUBMITTED_DATA_SIDE_MENU_QUERY from '@/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import useUrlParamState from '@/hooks/useUrlParamState'; +import { css } from '@/lib/emotion'; +import { useQuery } from '@apollo/client'; +import { Loader, Typography, VerticalTabs, useTheme } from '@icgc-argo/uikit'; +import { useState } from 'react'; +import { setConfiguration } from 'react-grid-system'; +import { aliasedEntityNames, clinicalEntityFields, defaultClinicalEntityFilters } from '../data'; +import { CompletionStates } from '../types'; +import ClinicalEntityDataTable from './components/ClinicalEntityDataTable'; +import ClinicalDownloadButton from './components/DownloadButtons'; +import SearchBar from './components/SearchBar'; +import { + clinicalEntityDisplayNames, + emptyClinicalDataResponse, + emptySearchResponse, + hasClinicalErrors, + reverseLookUpEntityAlias, +} from './data'; +import { ClinicalEntitySearchResultResponse, TsvDownloadIds } from './types'; + +setConfiguration({ gutterWidth: 9 }); + +const defaultClinicalEntityTab = aliasedEntityNames.donor; + +// convert codegen automated types to definitions in existing code +// make data object shape uniform +const parseSearchResult = ( + data: ClinicalEntitySearchResultResponse | undefined, +): ClinicalEntitySearchResultResponse => { + if (!data) return emptySearchResponse; + return { + clinicalSearchResults: { + searchResults: data.clinicalSearchResults.searchResults.map((searchResults) => ({ + donorId: searchResults?.donorId || 0, + submitterDonorId: searchResults?.submitterDonorId || '', + })), + totalResults: data.clinicalSearchResults.totalResults, + }, + }; +}; + +const ClinicalDataPageComp = ({ programShortName }: { programShortName: string }) => { + const theme = useTheme(); + + const [keyword, setKeyword] = useState(''); + const [completionState, setCompletionState] = useState(CompletionStates['all']); + const [modalVisible, setModalVisible] = useState(false); + + const [selectedClinicalEntityTab, setSelectedClinicalEntityTab] = useUrlParamState( + 'tab', + defaultClinicalEntityTab, + ); + const [selectedDonors, setSelectedDonors] = useUrlParamState('donorId', ''); + + const currentEntity = reverseLookUpEntityAlias(selectedClinicalEntityTab); + const urlDonorQueryStrings = selectedDonors ? selectedDonors.split(',') : []; + const currentDonors = urlDonorQueryStrings.length + ? urlDonorQueryStrings.map((donorId) => parseDonorIdString(donorId)) + : []; + + // Matches multiple digits and/or digits preceded by DO, followed by a comma, space, or end of string + // Example: DO259138, 2579137, DASH-7, DO253290abcdef + // Regex will match first 2 Donor IDs, but not 3rd Submitter ID or 4th case w/ random text + const searchDonorIds = + keyword + .match(/(?=DO|\d)\d+(?=,| |$)/gi) + ?.filter((match) => !!match) + .map((idString) => parseInt(idString)) || []; + + // Matches 'D' or 'DO' exactly (case insensitive) + const donorPrefixSearch = keyword.match(/^(d|do)\b/gi); + + const searchSubmitterIds = donorPrefixSearch + ? [] + : keyword.split(/, |,/).filter((word) => !!word); + + // Search Result Query + // Populates dropdown menu; Search query populates data table if there are no URL params + const { data: searchResultData, loading: searchResultsLoading } = useClinicalQuery( + CLINICAL_ENTITY_SEARCH_RESULTS_QUERY, + { + errorPolicy: 'all', + variables: { + programShortName, + filters: { + ...defaultClinicalEntityFilters, + completionState, + entityTypes: [currentEntity], + donorIds: searchDonorIds, + submitterDonorIds: searchSubmitterIds, + }, + }, + }, + ); + + const parsedSearchResultData = parseSearchResult(searchResultData); + + const searchResults = parsedSearchResultData?.clinicalSearchResults?.searchResults; + const searchResultIds = searchResults.map((result) => result?.donorId).filter(notNull); + + const sideMenuQueryDonorIds = + urlDonorQueryStrings.length > 0 + ? currentDonors + : searchResults.length > 0 && keyword.length > 0 + ? searchResultIds + : []; + + // Side Menu Query + // Populates Clinical Entity Table, Side Menu, Title Bar + const { data: sideMenuQuery, loading: sideMenuLoading } = useQuery( + SUBMITTED_DATA_SIDE_MENU_QUERY, + { + errorPolicy: 'all', + variables: { + programShortName, + filters: { + ...defaultClinicalEntityFilters, + completionState, + donorIds: sideMenuQueryDonorIds, + }, + }, + }, + ); + + const sideMenuData = + sideMenuQuery == undefined || sideMenuLoading ? emptyClinicalDataResponse : sideMenuQuery; + + const { clinicalData } = sideMenuData; + + const useDefaultQuery = + currentDonors.length === 0 && + (donorPrefixSearch || (searchDonorIds.length === 0 && searchSubmitterIds.length === 0)) && + completionState === 'all'; + + const noSearchData = searchResultData === null || searchResultData === undefined; + const noData = + clinicalData.clinicalEntities.length === 0 && noSearchData && currentDonors.length === 0; + + const entityTableDonorIds = + currentDonors.length > 0 ? currentDonors : searchResults.length > 0 ? searchResultIds : []; + + const entityTableSubmitterDonorIds = (searchResults || []) + .map((searchResults) => searchResults?.submitterDonorId) + .filter(Boolean); + + const tsvDownloadIds: TsvDownloadIds = { + donorIds: useDefaultQuery ? [] : entityTableDonorIds, + submitterDonorIds: useDefaultQuery ? [] : entityTableSubmitterDonorIds.filter(notNull), + }; + + const menuItems = clinicalEntityFields.map((entity) => ( + setSelectedClinicalEntityTab(aliasedEntityNames[entity])} + disabled={ + !clinicalData.clinicalEntities.some((e) => e?.entityName === aliasedEntityNames[entity]) + } + > + {clinicalEntityDisplayNames[entity]} + {hasClinicalErrors(clinicalData, entity) && ( + ! + )} + + )); + + return ( +
+ } + rightSlot={} + /> + {searchResultsLoading ? ( + + ) : ( + <> + + +
+ {/* Sidebar */} +
+ {menuItems} +
+ {/* Content */} +
+ {/* Header */} +
+ + {clinicalEntityDisplayNames[currentEntity]} Data + + + +
+ {/* DataTable */} +
+ +
+
{' '} +
+
+ + )} +
+ ); +}; + +export default ClinicalDataPageComp; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx b/src/views/Submission/ClinicalData/components/ClinicalEntityDataTable.tsx similarity index 99% rename from src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx rename to src/views/Submission/ClinicalData/components/ClinicalEntityDataTable.tsx index aca6ba43..e80d8712 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/ClinicalEntityDataTable.tsx +++ b/src/views/Submission/ClinicalData/components/ClinicalEntityDataTable.tsx @@ -41,8 +41,6 @@ import memoize from 'lodash/memoize'; import { createRef, useEffect, useState } from 'react'; import urljoin from 'url-join'; import { - ClinicalEntitySearchResultResponse, - CompletionStates, aliasSortNames, aliasedEntityFields, aliasedEntityNames, @@ -51,7 +49,8 @@ import { defaultClinicalEntityFilters, emptyClinicalDataResponse, emptySearchResponse, -} from './common'; +} from '../data'; +import { ClinicalEntitySearchResultResponse, CompletionStates } from '../types'; export type DonorEntry = { row: string; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/DownloadButtons.tsx b/src/views/Submission/ClinicalData/components/DownloadButtons.tsx similarity index 98% rename from src/app/(post-login)/submission/program/[shortName]/clinical-data/DownloadButtons.tsx rename to src/views/Submission/ClinicalData/components/DownloadButtons.tsx index 9f46392b..c9939cc6 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/DownloadButtons.tsx +++ b/src/views/Submission/ClinicalData/components/DownloadButtons.tsx @@ -25,7 +25,7 @@ import { Button, Icon, css } from '@icgc-argo/uikit'; import React from 'react'; import { Col, Row } from 'react-grid-system'; import urlJoin from 'url-join'; -import { CompletionStates, TsvDownloadIds } from './common'; +import { CompletionStates, TsvDownloadIds } from '../types'; const DownloadButton = ({ text, diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/MatchResults.tsx b/src/views/Submission/ClinicalData/components/SearchBar/FilterModal/MatchResults.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/MatchResults.tsx rename to src/views/Submission/ClinicalData/components/SearchBar/FilterModal/MatchResults.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/UploadButton.tsx b/src/views/Submission/ClinicalData/components/SearchBar/FilterModal/UploadButton.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/UploadButton.tsx rename to src/views/Submission/ClinicalData/components/SearchBar/FilterModal/UploadButton.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/index.tsx b/src/views/Submission/ClinicalData/components/SearchBar/FilterModal/index.tsx similarity index 97% rename from src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/index.tsx rename to src/views/Submission/ClinicalData/components/SearchBar/FilterModal/index.tsx index c7ccff8a..77b92d40 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/FilterModal/index.tsx +++ b/src/views/Submission/ClinicalData/components/SearchBar/FilterModal/index.tsx @@ -23,7 +23,8 @@ import { useQuery } from '@apollo/client'; import { Button, Modal, css } from '@icgc-argo/uikit/'; import { Textarea } from '@icgc-argo/uikit/form/Textarea'; import { useEffect, useState } from 'react'; -import { ClinicalEntitySearchResultResponse, defaultClinicalEntityFilters } from '../../common'; +import { defaultClinicalEntityFilters } from '../../../data'; +import { ClinicalEntitySearchResultResponse } from '../../../types'; import MatchResults from './MatchResults'; import UploadButton from './UploadButton'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/SearchResultsMenu.tsx b/src/views/Submission/ClinicalData/components/SearchBar/SearchResultsMenu.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/SearchResultsMenu.tsx rename to src/views/Submission/ClinicalData/components/SearchBar/SearchResultsMenu.tsx diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/index.tsx b/src/views/Submission/ClinicalData/components/SearchBar/index.tsx similarity index 97% rename from src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/index.tsx rename to src/views/Submission/ClinicalData/components/SearchBar/index.tsx index 7d2b1e8f..e29dfd1f 100644 --- a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/index.tsx +++ b/src/views/Submission/ClinicalData/components/SearchBar/index.tsx @@ -30,13 +30,9 @@ import { useTheme, } from '@icgc-argo/uikit'; import { createRef, Dispatch, RefObject, SetStateAction, useState } from 'react'; -import { - clinicalEntityFields, - ClinicalEntitySearchResultResponse, - CompletionStates, - emptySearchResponse, - TsvDownloadIds, -} from '../common'; + +import { clinicalEntityFields, emptySearchResponse } from '../../data'; +import { ClinicalEntitySearchResultResponse, CompletionStates, TsvDownloadIds } from '../../types'; import ClinicalDownloadButton from '../DownloadButtons'; import FilterModal from './FilterModal'; import SearchResultsMenu from './SearchResultsMenu'; diff --git a/src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/style.tsx b/src/views/Submission/ClinicalData/components/SearchBar/style.tsx similarity index 100% rename from src/app/(post-login)/submission/program/[shortName]/clinical-data/SearchBar/style.tsx rename to src/views/Submission/ClinicalData/components/SearchBar/style.tsx diff --git a/src/views/Submission/ClinicalData/data.ts b/src/views/Submission/ClinicalData/data.ts new file mode 100644 index 00000000..b02592fc --- /dev/null +++ b/src/views/Submission/ClinicalData/data.ts @@ -0,0 +1,113 @@ +import { + ClinicalEntityQueryResponse, + ClinicalEntitySearchResultResponse, + ClinicalFilter, + CompletionStates, +} from './types'; + +export const clinicalEntityDisplayNames = { + donor: 'Donor', + sampleRegistration: 'Sample Registration', + sample_registration: 'Sample Registration', + specimens: 'Specimen', + specimen: 'Specimen', + primaryDiagnoses: 'Primary Diagnosis', + primary_diagnosis: 'Primary Diagnosis', + treatment: 'Treatment', + chemotherapy: 'Chemotherapy', + hormoneTherapy: 'Hormone Therapy', + hormone_therapy: 'Hormone Therapy', + immunotherapy: 'Immunotherapy', + radiation: 'Radiation', + surgery: 'Surgery', + followUps: 'Follow Up', + follow_up: 'Follow Up', + familyHistory: 'Family History', + family_history: 'Family History', + exposure: 'Exposure', + comorbidity: 'Comorbidity', + biomarker: 'Biomarker', +} as const; + +export const aliasedEntityNames = { + donor: 'donor', + sampleRegistration: 'sample_registration', + specimens: 'specimen', + primaryDiagnoses: 'primary_diagnosis', + familyHistory: 'family_history', + treatment: 'treatment', + chemotherapy: 'chemotherapy', + immunotherapy: 'immunotherapy', + surgery: 'surgery', + radiation: 'radiation', + followUps: 'follow_up', + hormoneTherapy: 'hormone_therapy', + exposure: 'exposure', + comorbidity: 'comorbidity', + biomarker: 'biomarker', +}; + +type AliasedEntityNamesKeys = keyof typeof aliasedEntityNames; +export const clinicalEntityFields = Object.keys(aliasedEntityNames) as AliasedEntityNamesKeys[]; +export const aliasedEntityFields = Object.values(aliasedEntityNames); + +// Util for finding camelCase alias for snake_case values +export const reverseLookUpEntityAlias = (selectedClinicalEntity: string) => { + const findAlias = Object.entries(aliasedEntityNames).find( + ([key, value]) => value === selectedClinicalEntity, + ); + + return findAlias ? findAlias[0] : 'donor'; +}; + +export const aliasSortNames = { + donor_id: 'donorId', + program_id: 'programId', + submitter_id: 'submitterId', + DO: 'donorId', + PD: 'primaryDiagnoses', + NS: 'specimens', + TS: 'familyHistory', + TR: 'treatments', + FO: 'followUps', +}; + +export const defaultClinicalEntityFilters: ClinicalFilter = { + entityTypes: clinicalEntityFields, + page: 0, + pageSize: 20, + donorIds: [], + submitterDonorIds: [], + completionState: CompletionStates['all'], + sort: aliasSortNames.donor_id, +}; + +export const hasClinicalErrors = ( + { clinicalErrors }: ClinicalEntityQueryResponse['clinicalData'], + currentEntity: string, +) => + clinicalErrors && + clinicalErrors.length > 0 && + clinicalErrors.filter( + (donor) => + donor.errors && + donor.errors.some( + ({ entityName }) => + aliasedEntityFields.includes(entityName) && + reverseLookUpEntityAlias(entityName) === currentEntity, + ), + ).length > 0; + +export const emptyClinicalDataResponse: ClinicalEntityQueryResponse = { + clinicalData: { + clinicalEntities: [], + clinicalErrors: [], + }, +}; + +export const emptySearchResponse: ClinicalEntitySearchResultResponse = { + clinicalSearchResults: { + searchResults: [], + totalResults: 0, + }, +}; diff --git a/src/views/Submission/ClinicalData/types.ts b/src/views/Submission/ClinicalData/types.ts new file mode 100644 index 00000000..9b89d283 --- /dev/null +++ b/src/views/Submission/ClinicalData/types.ts @@ -0,0 +1,98 @@ +export enum CoreCompletionEntities { + donor = 'donor', + primaryDiagnosis = 'primaryDiagnosis', + specimens = 'specimens', + treatments = 'treatments', + followUps = 'followUps', +} + +export type CoreCompletion = { + [field in CoreCompletionEntities]: number; +}; + +export type CompletionStats = { + coreCompletion: CoreCompletion; + coreCompletionDate: string; + coreCompletionPercentage: number; + donorId: number; + overriddenCoreCompletion: [CoreCompletionEntities]; + entityData?: CompletionEntityData; +}; + +export type CompletionEntityData = { + specimens?: SpecimenCoreCompletion; +}; + +export type SpecimenCoreCompletion = { + coreCompletionPercentage: number; + normalSpecimensPercentage: number; + tumourSpecimensPercentage: number; + normalRegistrations: number; + normalSubmissions: number; + tumourRegistrations: number; + tumourSubmissions: number; +}; + +export enum CompletionStates { + all = 'all', + invalid = 'invalid', + complete = 'complete', + incomplete = 'incomplete', +} + +export type ClinicalEntity = { + entityName: string; + entityFields: string[]; + totalDocs: number; + completionStats?: Array; + records: Array<{ + name: string; + value: any; + }>[]; +}; + +export type ClinicalSearchResult = { + donorId: number; + submitterDonorId: string; +}; + +export type ClinicalErrorData = { + donorId: number; + submitterDonorId: string; + errors: { + entityName: string; + errorType: string; + fieldName: string; + index: number; + info: { value: string[] }; + message: string; + }[]; +}; + +export type ClinicalEntityQueryResponse = { + clinicalData: { + programShortName?: string; + clinicalEntities: Array; + clinicalErrors: Array; + }; +}; + +export type ClinicalEntitySearchResultResponse = { + clinicalSearchResults: { + programShortName?: string; + totalResults: number; + searchResults: Array; + }; +}; + +export type ClinicalFilter = { + entityTypes: string[]; + page: number; + pageSize: number; + donorIds?: string[]; + submitterDonorIds?: string[]; + completionState?: CompletionStates; + sort?: string; +}; + +export type TsvDownloadIds = { donorIds: number[]; submitterDonorIds: string[] }; diff --git a/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx index becd24f9..7f3f02e0 100644 --- a/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx +++ b/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx @@ -42,11 +42,11 @@ import { useTheme, } from '@icgc-argo/uikit'; +import { defaultClinicalEntityFilters } from '@/views/Submission/data'; import { find } from 'lodash'; import Link from 'next/link'; import { useEffect, useState } from 'react'; import urlJoin from 'url-join'; -import { defaultClinicalEntityFilters } from '../../../../../app/(post-login)/submission/program/[shortName]/clinical-data/common'; import { Pipeline } from '../Pipeline'; import { DesignationCell } from './DesignationCell'; import DonorSummaryTableLegend from './DonorSummaryTableLegend'; From 1c5b4ba0594a71fe56a79f0e715390b76d913246 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 02:13:34 -0500 Subject: [PATCH 16/19] move common --- .../ClinicalSubmissionProgressBar.tsx | 118 ++++++++++++++++++ .../SampleRegistrationProgressBar.tsx | 69 ++++++++++ 2 files changed, 187 insertions(+) create mode 100644 src/views/Submission/components/ClinicalSubmissionProgressBar.tsx create mode 100644 src/views/Submission/components/SampleRegistrationProgressBar.tsx diff --git a/src/views/Submission/components/ClinicalSubmissionProgressBar.tsx b/src/views/Submission/components/ClinicalSubmissionProgressBar.tsx new file mode 100644 index 00000000..f90b01b3 --- /dev/null +++ b/src/views/Submission/components/ClinicalSubmissionProgressBar.tsx @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved + * + * This program and the accompanying materials are made available under the terms of + * the GNU Affero General Public License v3.0. You should have received a copy of the + * GNU Affero General Public License along with this program. + * If not, see . + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import CLINICAL_SUBMISSION_QUERY from '@/gql/clinical/CLINICAL_SUBMISSION_QUERY'; +import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import { css, Progress } from '@icgc-argo/uikit'; +import { ComponentProps, ComponentType, useMemo, useState } from 'react'; + +const ClinicalSubmissionProgressBar: ComponentType<{ + programShortName: string; + approvalBarWidth?: number; +}> = ({ programShortName, approvalBarWidth }) => { + const [] = useState(null); + const { isDisabled: isSubmissionSystemDisabled } = useSubmissionSystemStatus(); + + const { data, loading: isLoading } = useClinicalQuery(CLINICAL_SUBMISSION_QUERY, { + variables: { + programShortName, + }, + }); + + const allDataErrors = useMemo( + () => + isLoading + ? [] + : data.clinicalSubmissions.clinicalEntities.reduce( + (acc, entity) => [ + ...acc, + ...entity.dataErrors.map((err) => ({ + ...err, + fileName: entity.batchName, + })), + ], + [], + ), + [data, isLoading], + ); + + const hasDataError = !!allDataErrors.length; + const hasSchemaError = + !isLoading && + !!data.clinicalSubmissions.clinicalEntities.length && + data.clinicalSubmissions.clinicalEntities.some(({ schemaErrors }) => !!schemaErrors.length); + const hasSomeEntity = + !isLoading && data.clinicalSubmissions.clinicalEntities.some(({ records }) => !!records.length); + const hasSchemaErrorsAfterMigration = + !isLoading && data.clinicalSubmissions.state === 'INVALID_BY_MIGRATION'; + const isReadyForValidation = hasSomeEntity && !hasSchemaError && !hasSchemaErrorsAfterMigration; + const isReadyForSignoff = isReadyForValidation && data.clinicalSubmissions.state === 'VALID'; + const isPendingApproval = !isLoading && data.clinicalSubmissions.state === 'PENDING_APPROVAL'; + + const progressStates: { + upload: ComponentProps['state']; + validate: ComponentProps['state']; + signOff: ComponentProps['state']; + } = { + upload: isSubmissionSystemDisabled + ? 'locked' + : isReadyForValidation + ? 'success' + : hasSchemaError || hasSchemaErrorsAfterMigration + ? 'error' + : 'disabled', + validate: isSubmissionSystemDisabled + ? 'locked' + : isReadyForSignoff || isPendingApproval + ? 'success' + : isReadyForValidation + ? hasDataError + ? 'error' + : 'pending' + : 'disabled', + signOff: isSubmissionSystemDisabled + ? 'locked' + : isReadyForSignoff + ? 'pending' + : isPendingApproval + ? 'success' + : 'disabled', + }; + + const pendingApprovalWidth = `${approvalBarWidth || 100}px`; + return ( + + + + + {isPendingApproval && ( + + )} + + ); +}; + +export default ClinicalSubmissionProgressBar; diff --git a/src/views/Submission/components/SampleRegistrationProgressBar.tsx b/src/views/Submission/components/SampleRegistrationProgressBar.tsx new file mode 100644 index 00000000..535bd121 --- /dev/null +++ b/src/views/Submission/components/SampleRegistrationProgressBar.tsx @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved + * + * This program and the accompanying materials are made available under the terms of + * the GNU Affero General Public License v3.0. You should have received a copy of the + * GNU Affero General Public License along with this program. + * If not, see . + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; +import { useGatewayQuery } from '@/hooks/useApolloQuery'; +import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import { Progress } from '@icgc-argo/uikit'; +import get from 'lodash/get'; +import { ComponentProps, ComponentType } from 'react'; + +const SampleRegistrationProgressBar: ComponentType<{ programShortName: string }> = ({ + programShortName, +}) => { + const { data: { clinicalRegistration = undefined } = {} } = useGatewayQuery( + GET_REGISTRATION_QUERY, + { + variables: { shortName: programShortName }, + }, + ); + + const schemaOrValidationErrors = get(clinicalRegistration, 'errors', []); + + const { isDisabled: isSubmissionSystemDisabled } = useSubmissionSystemStatus(); + + const progressStates: { + upload: ComponentProps['state']; + register: ComponentProps['state']; + } = { + upload: isSubmissionSystemDisabled + ? 'locked' + : clinicalRegistration && clinicalRegistration.records.length > 0 + ? 'success' + : schemaOrValidationErrors.length > 0 + ? 'error' + : 'disabled', + register: isSubmissionSystemDisabled + ? 'locked' + : clinicalRegistration && clinicalRegistration.records.length > 0 + ? 'pending' + : schemaOrValidationErrors.length > 0 + ? 'disabled' + : 'disabled', + }; + + return ( + + + + + ); +}; + +export default SampleRegistrationProgressBar; From a9f1f753e2556698e6196887a263f95bb2f03997 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 02:33:36 -0500 Subject: [PATCH 17/19] cleanup hooks imports with barrel file --- src/App.tsx | 11 ++++------- .../components/ClinicalSubmissionProgressBar.tsx | 5 ++--- .../components/SampleRegistrationProgressBar.tsx | 3 +-- src/app/(post-login)/submission/program/page.tsx | 3 +-- src/app/(pre-login)/logging-in/page.tsx | 3 +-- src/components/Footer.tsx | 3 +-- src/components/Header.tsx | 2 +- src/components/Hero.tsx | 2 +- src/components/LoginButton.tsx | 2 +- src/components/Page.tsx | 2 +- src/hooks/ApolloProvider.tsx | 2 +- src/hooks/AuthProvider.tsx | 2 +- src/hooks/index.ts | 15 +++++++++++++++ src/views/Contact/components/form.tsx | 2 +- src/views/Contact/components/info.tsx | 2 +- src/views/Home/Home.tsx | 2 +- .../Submission/ClinicalData/ClinicalData.tsx | 2 +- .../components/ClinicalEntityDataTable.tsx | 4 ++-- .../ClinicalData/components/DownloadButtons.tsx | 4 ++-- .../ClinicalSubmission/ClinicalSubmission.tsx | 14 ++++++++------ .../components/FilesNavigator/FilePreview.tsx | 2 +- .../ClinicalSubmission/components/Header.tsx | 12 +++++++----- .../components/Instructions.tsx | 3 +-- .../ClinicalSubmission/components/ProgressBar.tsx | 2 +- .../DonorDataSummary/DonorSummaryTable.tsx | 2 +- .../DonorDataSummary/DownloadButtons.tsx | 5 ++--- .../DonorDataSummary/EmptyDonorSummaryTable.tsx | 2 +- .../queries/useProgramDonorsSummaryQuery.tsx | 4 ++-- .../components/DonorReleaseSummary/index.tsx | 2 +- .../components/ProgramWorkspaceStatus/index.tsx | 2 +- .../Dashboard/components/StatsBar/index.tsx | 5 ++--- .../SampleRegistration/SampleRegistration.tsx | 12 +++++++----- .../components/Instructions.tsx | 2 +- .../components/RegisterSampleModal.tsx | 3 +-- .../components/ClinicalSubmissionProgressBar.tsx | 5 ++--- src/views/Submission/components/ProgramMenu.tsx | 11 +++++++---- .../components/SampleRegistrationProgressBar.tsx | 3 +-- 37 files changed, 86 insertions(+), 76 deletions(-) create mode 100644 src/hooks/index.ts diff --git a/src/App.tsx b/src/App.tsx index 74eaf66e..0dacc1f2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,19 +19,16 @@ // all our context providers won't work server side, beacuse React.Context is client side 'use client'; -import { ApolloProvider } from '@/hooks/ApolloProvider'; -import { AppProvider } from '@/hooks/AppProvider'; -import { AuthProvider } from '@/hooks/AuthProvider'; -import GlobalLoaderProvider, { loaderPortalRef } from '@/hooks/GlobalLoaderProvider'; -import ThemeProvider from '@/hooks/ThemeProvider'; -import ToastProvider from '@/hooks/ToastProvider'; -import { css } from '@/lib/emotion'; +import { ThemeProvider, css } from '@/lib/emotion'; +import { ApolloProvider } from '@apollo/client'; import { loadDevMessages, loadErrorMessages } from '@apollo/client/dev'; import { ReactNode, forwardRef } from 'react'; import { QueryClient, QueryClientProvider } from 'react-query'; import Footer from './components/Footer'; import Header from './components/Header'; import { modalPortalRef } from './components/Modal'; +import { AppProvider, AuthProvider, GlobalLoaderProvider, loaderPortalRef } from './hooks'; +import ToastProvider from './hooks/ToastProvider'; // Apollo on app error messaging instead of error messages in webpages if (process.env.NODE_ENV === 'development') { diff --git a/src/app/(post-login)/submission/program/[shortName]/components/ClinicalSubmissionProgressBar.tsx b/src/app/(post-login)/submission/program/[shortName]/components/ClinicalSubmissionProgressBar.tsx index f90b01b3..b7f78c63 100644 --- a/src/app/(post-login)/submission/program/[shortName]/components/ClinicalSubmissionProgressBar.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/components/ClinicalSubmissionProgressBar.tsx @@ -18,9 +18,8 @@ */ import CLINICAL_SUBMISSION_QUERY from '@/gql/clinical/CLINICAL_SUBMISSION_QUERY'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; -import { css, Progress } from '@icgc-argo/uikit'; +import { useClinicalQuery, useSubmissionSystemStatus } from '@/hooks'; +import { Progress, css } from '@icgc-argo/uikit'; import { ComponentProps, ComponentType, useMemo, useState } from 'react'; const ClinicalSubmissionProgressBar: ComponentType<{ diff --git a/src/app/(post-login)/submission/program/[shortName]/components/SampleRegistrationProgressBar.tsx b/src/app/(post-login)/submission/program/[shortName]/components/SampleRegistrationProgressBar.tsx index 535bd121..d5101bbd 100644 --- a/src/app/(post-login)/submission/program/[shortName]/components/SampleRegistrationProgressBar.tsx +++ b/src/app/(post-login)/submission/program/[shortName]/components/SampleRegistrationProgressBar.tsx @@ -18,8 +18,7 @@ */ import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; -import { useGatewayQuery } from '@/hooks/useApolloQuery'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import { useGatewayQuery, useSubmissionSystemStatus } from '@/hooks'; import { Progress } from '@icgc-argo/uikit'; import get from 'lodash/get'; import { ComponentProps, ComponentType } from 'react'; diff --git a/src/app/(post-login)/submission/program/page.tsx b/src/app/(post-login)/submission/program/page.tsx index 43385751..916173b9 100644 --- a/src/app/(post-login)/submission/program/page.tsx +++ b/src/app/(post-login)/submission/program/page.tsx @@ -23,8 +23,7 @@ import { BreadcrumbTitle, PageHeader } from '@/components/PageHeader/PageHeader' import { CREATE_PROGRAM_PAGE_PATH } from '@/global/constants'; import { notNull } from '@/global/utils'; import PROGRAMS_LIST_QUERY from '@/gql/gateway/PROGRAMS_LIST_QUERY'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useGatewayQuery } from '@/hooks/useApolloQuery'; +import { useAppConfigContext, useGatewayQuery } from '@/hooks'; import { Button, Loader } from '@icgc-argo/uikit'; import Link from 'next/link'; import { notFound } from 'next/navigation'; diff --git a/src/app/(pre-login)/logging-in/page.tsx b/src/app/(pre-login)/logging-in/page.tsx index 31e1996c..e552d447 100644 --- a/src/app/(pre-login)/logging-in/page.tsx +++ b/src/app/(pre-login)/logging-in/page.tsx @@ -18,8 +18,7 @@ */ 'use client'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useAuthContext } from '@/hooks/AuthProvider'; +import { useAppConfigContext, useAuthContext } from '@/hooks'; import { DnaLoader, css, useTheme } from '@icgc-argo/uikit'; import { useRouter } from 'next/navigation'; import { useQuery } from 'react-query'; diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index c66ddb3c..c0e44558 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -16,8 +16,7 @@ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks'; import { css, useTheme } from '@/lib/emotion'; import { Icon, Link } from '@icgc-argo/uikit'; import { Fragment } from 'react'; diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 82bfc819..a33a13bd 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -18,7 +18,7 @@ */ 'use client'; -import { useAuthContext } from '@/hooks/AuthProvider'; +import { useAuthContext } from '@/hooks'; import { css, useTheme } from '@/lib/emotion'; import { AppBarMenuItem, DnaLoader, Link, NavElement } from '@icgc-argo/uikit'; import Image from 'next/image'; diff --git a/src/components/Hero.tsx b/src/components/Hero.tsx index 737a7996..52252ad9 100644 --- a/src/components/Hero.tsx +++ b/src/components/Hero.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks'; import { BUTTON_SIZES, Button, Icon, Typography, css, useTheme } from '@icgc-argo/uikit'; import Link from 'next/link'; import RegionBanner from './RegionBanner'; diff --git a/src/components/LoginButton.tsx b/src/components/LoginButton.tsx index f0ada602..a23d0445 100644 --- a/src/components/LoginButton.tsx +++ b/src/components/LoginButton.tsx @@ -18,7 +18,7 @@ */ 'use client'; -import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks'; import { css } from '@/lib/emotion'; import { Button, Icon, useTheme } from '@icgc-argo/uikit'; diff --git a/src/components/Page.tsx b/src/components/Page.tsx index 1de7c31b..3b239da8 100644 --- a/src/components/Page.tsx +++ b/src/components/Page.tsx @@ -18,7 +18,7 @@ */ 'use client'; -import { useAuthContext } from '@/hooks/AuthProvider'; +import { useAuthContext } from '@/hooks'; import { EmotionJSX } from '@emotion/react/types/jsx-namespace'; import { DnaLoader, css } from '@icgc-argo/uikit'; import { redirect } from 'next/navigation'; diff --git a/src/hooks/ApolloProvider.tsx b/src/hooks/ApolloProvider.tsx index 422ca4ae..74758586 100644 --- a/src/hooks/ApolloProvider.tsx +++ b/src/hooks/ApolloProvider.tsx @@ -19,7 +19,7 @@ 'use client'; -import { useAuthContext } from '@/hooks/AuthProvider'; +import { useAuthContext } from '@/hooks'; import { createApolloClient } from '@/lib/gql'; import { ApolloProvider as DefaultApolloProvider } from '@apollo/client'; import { ReactNode } from 'react'; diff --git a/src/hooks/AuthProvider.tsx b/src/hooks/AuthProvider.tsx index a8ab3132..88e6cc27 100644 --- a/src/hooks/AuthProvider.tsx +++ b/src/hooks/AuthProvider.tsx @@ -21,7 +21,7 @@ import Header from '@/components/Header'; import { EGO_JWT_KEY, LOGIN_NONCE } from '@/global/constants'; import { getFilename } from '@/global/utils/stringUtils'; -import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks'; import createEgoUtils from '@icgc-argo/ego-token-utils'; import { DnaLoader } from '@icgc-argo/uikit'; import Cookies from 'js-cookie'; diff --git a/src/hooks/index.ts b/src/hooks/index.ts new file mode 100644 index 00000000..8ac7a31e --- /dev/null +++ b/src/hooks/index.ts @@ -0,0 +1,15 @@ +export * from './ApolloProvider'; +export * from './AppProvider'; +export * from './AuthProvider'; +export * from './GlobalLoaderProvider'; +export * from './ThemeProvider'; +export * from './ToastProvider'; +export * from './useApolloQuery'; +export * from './useCommonToasters'; +export * from './usePageContext'; +export * from './useSubmissionSystemStatus'; +export * from './useTimeout'; +export * from './useURLQueryState'; +export * from './useUrlParamState'; +export * from './useUserConfirmationModalState'; +export * from './useUserRole'; diff --git a/src/views/Contact/components/form.tsx b/src/views/Contact/components/form.tsx index 4638cd8b..20e6754d 100644 --- a/src/views/Contact/components/form.tsx +++ b/src/views/Contact/components/form.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks'; import { zodResolver } from '@hookform/resolvers/zod'; import { Button, diff --git a/src/views/Contact/components/info.tsx b/src/views/Contact/components/info.tsx index 16c8eec3..e0e177e6 100644 --- a/src/views/Contact/components/info.tsx +++ b/src/views/Contact/components/info.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks'; import { Button, Link, Typography, css, useTheme } from '@icgc-argo/uikit'; import { Col } from 'react-grid-system'; import urljoin from 'url-join'; diff --git a/src/views/Home/Home.tsx b/src/views/Home/Home.tsx index db013805..b8633878 100644 --- a/src/views/Home/Home.tsx +++ b/src/views/Home/Home.tsx @@ -19,7 +19,7 @@ 'use client'; import Hero from '@/components/Hero'; -import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks'; import { css, useTheme } from '@/lib/emotion'; import { DataCallout, Link, Typography, overtureLogo } from '@icgc-argo/uikit'; import Image from 'next/image'; diff --git a/src/views/Submission/ClinicalData/ClinicalData.tsx b/src/views/Submission/ClinicalData/ClinicalData.tsx index aae33018..7049a90e 100644 --- a/src/views/Submission/ClinicalData/ClinicalData.tsx +++ b/src/views/Submission/ClinicalData/ClinicalData.tsx @@ -23,7 +23,7 @@ import { BreadcrumbTitle, HelpLink, PageHeader } from '@/components/PageHeader/P import { notNull, parseDonorIdString } from '@/global/utils'; import CLINICAL_ENTITY_SEARCH_RESULTS_QUERY from '@/gql/clinical/CLINICAL_ENTITY_SEARCH_RESULTS_QUERY'; import SUBMITTED_DATA_SIDE_MENU_QUERY from '@/gql/clinical/SUBMITTED_DATA_SIDE_MENU_QUERY'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import { useClinicalQuery } from '@/hooks'; import useUrlParamState from '@/hooks/useUrlParamState'; import { css } from '@/lib/emotion'; import { useQuery } from '@apollo/client'; diff --git a/src/views/Submission/ClinicalData/components/ClinicalEntityDataTable.tsx b/src/views/Submission/ClinicalData/components/ClinicalEntityDataTable.tsx index e80d8712..d82c3db1 100644 --- a/src/views/Submission/ClinicalData/components/ClinicalEntityDataTable.tsx +++ b/src/views/Submission/ClinicalData/components/ClinicalEntityDataTable.tsx @@ -23,8 +23,8 @@ import { TableInfoHeaderContainer } from '@/components/Table/common'; import { PROGRAM_CLINICAL_SUBMISSION_PATH, PROGRAM_SHORT_NAME_PATH } from '@/global/constants'; import CLINICAL_ENTITY_DATA_QUERY from '@/gql/clinical/CLINICAL_ENTITY_DATA_QUERY'; import CLINICAL_SCHEMA_VERSION from '@/gql/clinical/CLINICAL_SCHEMA_VERSION'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; + +import { useAppConfigContext, useClinicalQuery } from '@/hooks'; import { ContentPlaceholder, DnaLoader, diff --git a/src/views/Submission/ClinicalData/components/DownloadButtons.tsx b/src/views/Submission/ClinicalData/components/DownloadButtons.tsx index c9939cc6..3eb51f86 100644 --- a/src/views/Submission/ClinicalData/components/DownloadButtons.tsx +++ b/src/views/Submission/ClinicalData/components/DownloadButtons.tsx @@ -17,8 +17,8 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useAuthContext } from '@/hooks/AuthProvider'; +import { useAppConfigContext, useAuthContext } from '@/hooks'; + import useCommonToasters from '@/hooks/useCommonToasters'; import usePageContext from '@/hooks/usePageContext'; import { Button, Icon, css } from '@icgc-argo/uikit'; diff --git a/src/views/Submission/ClinicalSubmission/ClinicalSubmission.tsx b/src/views/Submission/ClinicalSubmission/ClinicalSubmission.tsx index 6b776e67..b7569640 100644 --- a/src/views/Submission/ClinicalSubmission/ClinicalSubmission.tsx +++ b/src/views/Submission/ClinicalSubmission/ClinicalSubmission.tsx @@ -39,13 +39,15 @@ import CLEAR_CLINICAL_SUBMISSION from '@/gql/clinical/CLEAR_CLINICAL_SUBMISSION' import CLINICAL_SUBMISSION_QUERY from '@/gql/clinical/CLINICAL_SUBMISSION_QUERY'; import SIGN_OFF_SUBMISSION_MUTATION from '@/gql/clinical/SIGN_OFF_SUBMISSION_MUTATION'; import VALIDATE_SUBMISSION_MUTATION from '@/gql/clinical/VALIDATE_SUBMISSION_MUTATION'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useAuthContext } from '@/hooks/AuthProvider'; -import { useGlobalLoader } from '@/hooks/GlobalLoaderProvider'; -import { useToaster } from '@/hooks/ToastProvider'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import { + useAppConfigContext, + useAuthContext, + useClinicalQuery, + useGlobalLoader, + useSubmissionSystemStatus, + useToaster, +} from '@/hooks'; import useCommonToasters from '@/hooks/useCommonToasters'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; import useUrlQueryState from '@/hooks/useURLQueryState'; import useUserConfirmationModalState from '@/hooks/useUserConfirmationModalState'; import { css } from '@/lib/emotion'; diff --git a/src/views/Submission/ClinicalSubmission/components/FilesNavigator/FilePreview.tsx b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/FilePreview.tsx index 00a6026d..27e818ec 100644 --- a/src/views/Submission/ClinicalSubmission/components/FilesNavigator/FilePreview.tsx +++ b/src/views/Submission/ClinicalSubmission/components/FilesNavigator/FilePreview.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import { useSubmissionSystemStatus } from '@/hooks'; import { css } from '@/lib/emotion'; import { Button, Typography } from '@icgc-argo/uikit'; import { FC } from 'react'; diff --git a/src/views/Submission/ClinicalSubmission/components/Header.tsx b/src/views/Submission/ClinicalSubmission/components/Header.tsx index aa39d5ca..6db6c126 100644 --- a/src/views/Submission/ClinicalSubmission/components/Header.tsx +++ b/src/views/Submission/ClinicalSubmission/components/Header.tsx @@ -23,12 +23,14 @@ import { sleep } from '@/global/utils'; import CLEAR_CLINICAL_SUBMISSION from '@/gql/clinical/CLEAR_CLINICAL_SUBMISSION'; import APPROVE_SUBMISSION_MUTATION from '@/gql/gateway/APPROVE_SUBMISSION_MUTATION'; import REOPEN_SUBMISSION_MUTATION from '@/gql/gateway/REOPEN_SUBMISSION_MUTATION'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useAuthContext } from '@/hooks/AuthProvider'; -import { useGlobalLoader } from '@/hooks/GlobalLoaderProvider'; -import { useToaster } from '@/hooks/ToastProvider'; +import { + useAppConfigContext, + useAuthContext, + useGlobalLoader, + useSubmissionSystemStatus, + useToaster, +} from '@/hooks'; import useCommonToasters from '@/hooks/useCommonToasters'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; import useUserConfirmationModalState from '@/hooks/useUserConfirmationModalState'; import { css, useTheme } from '@/lib/emotion'; import { useMutation } from '@apollo/client'; diff --git a/src/views/Submission/ClinicalSubmission/components/Instructions.tsx b/src/views/Submission/ClinicalSubmission/components/Instructions.tsx index 6a91d3e4..821269b8 100644 --- a/src/views/Submission/ClinicalSubmission/components/Instructions.tsx +++ b/src/views/Submission/ClinicalSubmission/components/Instructions.tsx @@ -20,8 +20,7 @@ import { CLINICAL_TEMPLATE_PATH } from '@/global/constants'; import CLINICAL_SCHEMA_VERSION from '@/gql/clinical/CLINICAL_SCHEMA_VERSION'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import { useAppConfigContext, useClinicalQuery } from '@/hooks'; import { css, useTheme } from '@/lib/emotion'; import { BUTTON_SIZES, diff --git a/src/views/Submission/ClinicalSubmission/components/ProgressBar.tsx b/src/views/Submission/ClinicalSubmission/components/ProgressBar.tsx index 15d477f2..d87ecc01 100644 --- a/src/views/Submission/ClinicalSubmission/components/ProgressBar.tsx +++ b/src/views/Submission/ClinicalSubmission/components/ProgressBar.tsx @@ -19,7 +19,7 @@ 'use client'; import { ClinicalSubmissionQuery } from '@/__generated__/clinical/graphql'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import { useSubmissionSystemStatus } from '@/hooks'; import { css } from '@/lib/emotion'; import { Progress, ProgressStatus } from '@icgc-argo/uikit'; import { isEmpty } from 'lodash'; diff --git a/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx index 7f3f02e0..847ad0f7 100644 --- a/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx +++ b/src/views/Submission/Dashboard/components/DonorDataSummary/DonorSummaryTable.tsx @@ -22,7 +22,7 @@ import { CellContentCenter, DataTableStarIcon as StarIcon } from '@/components/T import { ContentError } from '@/components/placeholders'; import { displayDate, parseDonorIdString } from '@/global/utils'; import CLINICAL_ERRORS_QUERY from '@/gql/clinical/CLINICAL_ERRORS_QUERY'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import { useClinicalQuery } from '@/hooks'; import { ColumnDef, DEFAULT_TABLE_PAGE_SIZE, diff --git a/src/views/Submission/Dashboard/components/DonorDataSummary/DownloadButtons.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/DownloadButtons.tsx index 8f6ea6ba..4f446d9a 100644 --- a/src/views/Submission/Dashboard/components/DonorDataSummary/DownloadButtons.tsx +++ b/src/views/Submission/Dashboard/components/DonorDataSummary/DownloadButtons.tsx @@ -18,9 +18,8 @@ */ import { EGO_JWT_KEY } from '@/global/constants'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useToaster } from '@/hooks/ToastProvider'; -import { Button, css, Icon, TOAST_VARIANTS } from '@icgc-argo/uikit'; +import { useAppConfigContext, useToaster } from '@/hooks'; +import { Button, Icon, TOAST_VARIANTS, css } from '@icgc-argo/uikit'; import { format as formatDate } from 'date-fns'; import { saveAs } from 'file-saver'; import Cookies from 'js-cookie'; diff --git a/src/views/Submission/Dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx index b527a388..20af0a96 100644 --- a/src/views/Submission/Dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx +++ b/src/views/Submission/Dashboard/components/DonorDataSummary/EmptyDonorSummaryTable.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks'; import { ContentPlaceholder, css, Link, styled, Typography } from '@icgc-argo/uikit'; import urljoin from 'url-join'; diff --git a/src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx index dfdc0097..fb1ff06f 100644 --- a/src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx +++ b/src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx @@ -18,8 +18,8 @@ */ import PROGRAM_DONOR_SUMMARY_QUERY from '@/gql/gateway/PROGRAM_DONOR_SUMMARY_QUERY'; -import { useGatewayQuery } from '@/hooks/useApolloQuery'; -import { useTimeout } from '@/hooks/useTimeout'; + +import { useTimeout } from '@/hooks'; import { QueryHookOptions } from '@apollo/client'; import { POLL_INTERVAL_MILLISECONDS } from '../../common'; import { diff --git a/src/views/Submission/Dashboard/components/DonorReleaseSummary/index.tsx b/src/views/Submission/Dashboard/components/DonorReleaseSummary/index.tsx index d0e32bfe..f6ab58c0 100644 --- a/src/views/Submission/Dashboard/components/DonorReleaseSummary/index.tsx +++ b/src/views/Submission/Dashboard/components/DonorReleaseSummary/index.tsx @@ -18,7 +18,7 @@ */ import DASHBOARD_SUMMARY_QUERY from '@/gql/gateway/DASHBOARD_SUMMARY_QUERY'; -import { useGatewayQuery } from '@/hooks/useApolloQuery'; +import { useGatewayQuery } from '@/hooks'; import { css, Typography } from '@icgc-argo/uikit'; import { DashboardCard } from '../common'; diff --git a/src/views/Submission/Dashboard/components/ProgramWorkspaceStatus/index.tsx b/src/views/Submission/Dashboard/components/ProgramWorkspaceStatus/index.tsx index 057ad61c..bd488e42 100644 --- a/src/views/Submission/Dashboard/components/ProgramWorkspaceStatus/index.tsx +++ b/src/views/Submission/Dashboard/components/ProgramWorkspaceStatus/index.tsx @@ -17,7 +17,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import { useAuthContext } from '@/hooks/AuthProvider'; +import { useAuthContext } from '@/hooks'; import useUserRole from '@/hooks/useUserRole'; import { css, HyperLinkProps, Link, Typography } from '@icgc-argo/uikit'; diff --git a/src/views/Submission/Dashboard/components/StatsBar/index.tsx b/src/views/Submission/Dashboard/components/StatsBar/index.tsx index 17881928..685db1fd 100644 --- a/src/views/Submission/Dashboard/components/StatsBar/index.tsx +++ b/src/views/Submission/Dashboard/components/StatsBar/index.tsx @@ -18,9 +18,8 @@ */ import DASHBOARD_SUMMARY_QUERY from '@/gql/gateway/DASHBOARD_SUMMARY_QUERY'; -import { useGatewayQuery } from '@/hooks/useApolloQuery'; -import { useTimeout } from '@/hooks/useTimeout'; -import { Container, css, PercentBar, styled, Typography } from '@icgc-argo/uikit'; +import { useGatewayQuery, useTimeout } from '@/hooks'; +import { Container, PercentBar, Typography, css, styled } from '@icgc-argo/uikit'; import { ComponentType, ReactNode } from 'react'; import { Col, Row } from 'react-grid-system'; import { POLL_INTERVAL_MILLISECONDS } from '../common'; diff --git a/src/views/Submission/SampleRegistration/SampleRegistration.tsx b/src/views/Submission/SampleRegistration/SampleRegistration.tsx index bc31b36e..c121c35b 100644 --- a/src/views/Submission/SampleRegistration/SampleRegistration.tsx +++ b/src/views/Submission/SampleRegistration/SampleRegistration.tsx @@ -29,12 +29,14 @@ import { createFileFormData, uploadFileRequest } from '@/global/utils/form'; import CLEAR_CLINICAL_REGISTRATION_MUTATION from '@/gql/clinical/CLEAR_CLINICAL_REGISTRATION_MUTATION'; import CLINICAL_SCHEMA_VERSION from '@/gql/clinical/CLINICAL_SCHEMA_VERSION'; import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useAuthContext } from '@/hooks/AuthProvider'; -import { useToaster } from '@/hooks/ToastProvider'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; +import { + useAppConfigContext, + useAuthContext, + useClinicalQuery, + useSubmissionSystemStatus, + useToaster, +} from '@/hooks'; import useCommonToasters from '@/hooks/useCommonToasters'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; import { css } from '@/lib/emotion'; import Instructions from '@/views/Submission/SampleRegistration/components/Instructions'; import ProgressBar from '@/views/Submission/SampleRegistration/components/ProgressBar'; diff --git a/src/views/Submission/SampleRegistration/components/Instructions.tsx b/src/views/Submission/SampleRegistration/components/Instructions.tsx index 310402c9..34bbb9d5 100644 --- a/src/views/Submission/SampleRegistration/components/Instructions.tsx +++ b/src/views/Submission/SampleRegistration/components/Instructions.tsx @@ -20,7 +20,7 @@ 'use client'; import { CLINICAL_TEMPLATE_PATH, CONTACT_PAGE_PATH } from '@/global/constants'; -import { useAppConfigContext } from '@/hooks/AppProvider'; +import { useAppConfigContext } from '@/hooks'; import { css } from '@/lib/emotion'; import { BUTTON_SIZES, diff --git a/src/views/Submission/SampleRegistration/components/RegisterSampleModal.tsx b/src/views/Submission/SampleRegistration/components/RegisterSampleModal.tsx index b0223008..20a38688 100644 --- a/src/views/Submission/SampleRegistration/components/RegisterSampleModal.tsx +++ b/src/views/Submission/SampleRegistration/components/RegisterSampleModal.tsx @@ -26,8 +26,7 @@ import { import { sleep } from '@/global/utils'; import COMMIT_CLINICAL_REGISTRATION_MUTATION from '@/gql/clinical/COMMIT_CLINICAL_REGISTRATION_MUTATION'; import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; -import { useGlobalLoader } from '@/hooks/GlobalLoaderProvider'; -import { useToaster } from '@/hooks/ToastProvider'; +import { useGlobalLoader, useToaster } from '@/hooks'; import { useMutation } from '@apollo/client'; import { Modal, TOAST_VARIANTS, Typography, Link as UIKitLink } from '@icgc-argo/uikit'; import { get } from 'lodash'; diff --git a/src/views/Submission/components/ClinicalSubmissionProgressBar.tsx b/src/views/Submission/components/ClinicalSubmissionProgressBar.tsx index f90b01b3..b7f78c63 100644 --- a/src/views/Submission/components/ClinicalSubmissionProgressBar.tsx +++ b/src/views/Submission/components/ClinicalSubmissionProgressBar.tsx @@ -18,9 +18,8 @@ */ import CLINICAL_SUBMISSION_QUERY from '@/gql/clinical/CLINICAL_SUBMISSION_QUERY'; -import { useClinicalQuery } from '@/hooks/useApolloQuery'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; -import { css, Progress } from '@icgc-argo/uikit'; +import { useClinicalQuery, useSubmissionSystemStatus } from '@/hooks'; +import { Progress, css } from '@icgc-argo/uikit'; import { ComponentProps, ComponentType, useMemo, useState } from 'react'; const ClinicalSubmissionProgressBar: ComponentType<{ diff --git a/src/views/Submission/components/ProgramMenu.tsx b/src/views/Submission/components/ProgramMenu.tsx index 23090196..e589c273 100644 --- a/src/views/Submission/components/ProgramMenu.tsx +++ b/src/views/Submission/components/ProgramMenu.tsx @@ -30,10 +30,13 @@ import { import { getProgramPath, notNull } from '@/global/utils'; import SIDEMENU_PROGRAM_STATUS from '@/gql/clinical/SIDEMENU_PROGRAM_STATUS'; import SIDEMENU_PROGRAMS from '@/gql/gateway/SIDEMENU_PROGRAMS'; -import { useAppConfigContext } from '@/hooks/AppProvider'; -import { useAuthContext } from '@/hooks/AuthProvider'; -import { useClinicalQuery, useGatewayQuery } from '@/hooks/useApolloQuery'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import { + useAppConfigContext, + useAuthContext, + useClinicalQuery, + useGatewayQuery, + useSubmissionSystemStatus, +} from '@/hooks'; import useUserRole from '@/hooks/useUserRole'; import { css } from '@/lib/emotion'; import { Icon, MenuItem } from '@icgc-argo/uikit'; diff --git a/src/views/Submission/components/SampleRegistrationProgressBar.tsx b/src/views/Submission/components/SampleRegistrationProgressBar.tsx index 535bd121..d5101bbd 100644 --- a/src/views/Submission/components/SampleRegistrationProgressBar.tsx +++ b/src/views/Submission/components/SampleRegistrationProgressBar.tsx @@ -18,8 +18,7 @@ */ import GET_REGISTRATION_QUERY from '@/gql/clinical/GET_REGISTRATION_QUERY'; -import { useGatewayQuery } from '@/hooks/useApolloQuery'; -import { useSubmissionSystemStatus } from '@/hooks/useSubmissionSystemStatus'; +import { useGatewayQuery, useSubmissionSystemStatus } from '@/hooks'; import { Progress } from '@icgc-argo/uikit'; import get from 'lodash/get'; import { ComponentProps, ComponentType } from 'react'; From e3fd3e78e3cdd85e25ec1d3c362d07b7440408e3 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 02:36:39 -0500 Subject: [PATCH 18/19] imports --- src/App.tsx | 9 +++++++-- .../queries/useProgramDonorsSummaryQuery.tsx | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 0dacc1f2..06dfe3c9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -20,14 +20,19 @@ 'use client'; import { ThemeProvider, css } from '@/lib/emotion'; -import { ApolloProvider } from '@apollo/client'; import { loadDevMessages, loadErrorMessages } from '@apollo/client/dev'; import { ReactNode, forwardRef } from 'react'; import { QueryClient, QueryClientProvider } from 'react-query'; import Footer from './components/Footer'; import Header from './components/Header'; import { modalPortalRef } from './components/Modal'; -import { AppProvider, AuthProvider, GlobalLoaderProvider, loaderPortalRef } from './hooks'; +import { + ApolloProvider, + AppProvider, + AuthProvider, + GlobalLoaderProvider, + loaderPortalRef, +} from './hooks'; import ToastProvider from './hooks/ToastProvider'; // Apollo on app error messaging instead of error messages in webpages diff --git a/src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx b/src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx index fb1ff06f..516758c2 100644 --- a/src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx +++ b/src/views/Submission/Dashboard/components/DonorDataSummary/queries/useProgramDonorsSummaryQuery.tsx @@ -18,8 +18,7 @@ */ import PROGRAM_DONOR_SUMMARY_QUERY from '@/gql/gateway/PROGRAM_DONOR_SUMMARY_QUERY'; - -import { useTimeout } from '@/hooks'; +import { useGatewayQuery, useTimeout } from '@/hooks'; import { QueryHookOptions } from '@apollo/client'; import { POLL_INTERVAL_MILLISECONDS } from '../../common'; import { From c2b97f5024ed79bf772c0829efbce962b5e007e3 Mon Sep 17 00:00:00 2001 From: Ciaran Schutte Date: Wed, 31 Jan 2024 02:40:41 -0500 Subject: [PATCH 19/19] fix theme provider import --- src/App.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 06dfe3c9..0d288510 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,7 +19,7 @@ // all our context providers won't work server side, beacuse React.Context is client side 'use client'; -import { ThemeProvider, css } from '@/lib/emotion'; +import { css } from '@/lib/emotion'; import { loadDevMessages, loadErrorMessages } from '@apollo/client/dev'; import { ReactNode, forwardRef } from 'react'; import { QueryClient, QueryClientProvider } from 'react-query'; @@ -33,6 +33,7 @@ import { GlobalLoaderProvider, loaderPortalRef, } from './hooks'; +import ThemeProvider from './hooks/ThemeProvider'; import ToastProvider from './hooks/ToastProvider'; // Apollo on app error messaging instead of error messages in webpages