diff --git a/src/lib/workspace/DownloadTab/index.tsx b/src/lib/workspace/DownloadTab/index.tsx index 023fd4a3f..4fe5a0715 100644 --- a/src/lib/workspace/DownloadTab/index.tsx +++ b/src/lib/workspace/DownloadTab/index.tsx @@ -27,6 +27,7 @@ import { useWdkService } from '@veupathdb/wdk-client/lib/Hooks/WdkServiceHook'; import { Action } from '@veupathdb/study-data-access/lib/data-restriction/DataRestrictionUiActions'; import { getStudyRequestNeedsApproval } from '@veupathdb/study-data-access/lib/shared/studies'; import { useLocalBackedState } from '@veupathdb/wdk-client/lib/Hooks/LocalBackedState'; +import { H5, Paragraph } from '@veupathdb/coreui'; type DownloadsTabProps = { downloadClient: DownloadClient; @@ -121,7 +122,7 @@ export default function DownloadTab({ ?.actionAuthorization['resultsAll']; const requestElement = ( ); @@ -146,17 +147,13 @@ export default function DownloadTab({ > )} {/* End temporary solution section */} - - {getDataAccessDeclaration( - studyAccess, - requestNeedsApproval, - user.isGuest, - hasPermission ?? false - )} - {studyAccess !== 'Public' && - (user.isGuest || !hasPermission) && - requestElement} - + {getDataAccessDeclaration( + studyAccess, + requestNeedsApproval, + user.isGuest, + hasPermission ?? false, + requestElement + )} ); }, [ @@ -282,32 +279,44 @@ function getDataAccessDeclaration( studyAccess: string, requestNeedsApproval: boolean, isGuest: boolean, - hasPermission: boolean = false -): string { - const DATA_ACCESS_STUB = `Data downloads for this study are ${studyAccess.toLowerCase()}. `; - const PUBLIC_ACCESS_STUB = 'You can download the data without logging in.'; - const LOGIN_REQUEST_STUB = - 'You must register or log in and request access to download data;'; + hasPermission: boolean = false, + requestElement: JSX.Element +): JSX.Element { + const PUBLIC_ACCESS_STUB = + 'Data downloads for this study are public. Data is available without logging in.'; + const LOGIN_REQUEST_STUB = ( + + To download data please register or log in and {requestElement}. + + ); const CONTROLLED_ACCESS_STUB = - ' data can be downloaded immediately following request submission. '; + ' Data will be available immediately following request submission.'; const PROTECTED_ACCESS_STUB = - ' data can be downloaded after the study team reviews your request and grants you access. '; + ' Data will be available upon study team review and approval.'; const ACCESS_GRANTED_STUB = - 'You have been granted access to download the data.'; + ' You have been granted access to download the data.'; // const ACCESS_PENDING_STUB = 'Your data access request is pending.'; - let dataAccessDeclaration = DATA_ACCESS_STUB; - if (studyAccess === 'Public') { - return (dataAccessDeclaration += PUBLIC_ACCESS_STUB); - } else if (isGuest || !hasPermission) { - dataAccessDeclaration += LOGIN_REQUEST_STUB; - return (dataAccessDeclaration += !requestNeedsApproval - ? CONTROLLED_ACCESS_STUB - : PROTECTED_ACCESS_STUB); - } else if (!isGuest && hasPermission) { - return (dataAccessDeclaration += ACCESS_GRANTED_STUB); - } else { - // dataAccessDeclaration += ACCESS_PENDING_STUB; - return dataAccessDeclaration; - } + return ( +