From aa1e56b736eb8595f50df59cf04615c496879b41 Mon Sep 17 00:00:00 2001 From: Hamsini Malli Sivakumar Date: Thu, 30 Nov 2023 10:54:33 -0500 Subject: [PATCH 1/3] created request lc page --- src/Routes.js | 5 +-- src/pages/user_profile/LibraryCard.js | 6 ++-- .../{RequestRole.js => RequestForm.js} | 31 +++++++++++++++---- src/pages/user_profile/ResearcherStatus.js | 2 +- 4 files changed, 32 insertions(+), 12 deletions(-) rename src/pages/user_profile/{RequestRole.js => RequestForm.js} (84%) diff --git a/src/Routes.js b/src/Routes.js index b3a7bfddf..86bf996f8 100644 --- a/src/Routes.js +++ b/src/Routes.js @@ -15,7 +15,7 @@ import NIHICWebform from './pages/NIHicWebform'; import PrivacyPolicy from './pages/PrivacyPolicy'; import ResearcherConsole from './pages/researcher_console/ResearcherConsole'; import UserProfile from './pages/user_profile/UserProfile'; -import RequestRole from './pages/user_profile/RequestRole'; +import RequestForm from './pages/user_profile/RequestForm'; import SigningOfficialResearchers from './pages/signing_official_console/SigningOfficialResearchers'; import SigningOfficialDarRequests from './pages/signing_official_console/SigningOfficialDarRequests'; import SigningOfficialDataSubmitters from './pages/signing_official_console/SigningOfficialDataSubmitters'; @@ -66,7 +66,8 @@ const Routes = (props) => ( - + + diff --git a/src/pages/user_profile/LibraryCard.js b/src/pages/user_profile/LibraryCard.js index e3b0b26f6..0eeba91b5 100644 --- a/src/pages/user_profile/LibraryCard.js +++ b/src/pages/user_profile/LibraryCard.js @@ -9,8 +9,8 @@ export default function LibraryCard(props) { return
{ event.preventDefault(); @@ -119,7 +136,7 @@ export default function RequestRole(props) { fontWeight: '600', marginTop: 10 }}> - Request a New Role in DUOS + {props.isRequestRolePage ? 'Request a New Role' : (props.isRequestLCPage ? 'Request Library Card' : '')}

{ return { pageProps.history.push({ - pathname: '/request_role', + pathname: '/request_lc', state: { data: profile } }); }; From cf5bf4dc1cd60882960d62cd17db719f184b885b Mon Sep 17 00:00:00 2001 From: Hamsini Malli Sivakumar Date: Thu, 30 Nov 2023 14:59:52 -0500 Subject: [PATCH 2/3] made changes according to comment + rubber ducking --- src/pages/user_profile/RequestForm.js | 89 +++++++++++++++------------ 1 file changed, 49 insertions(+), 40 deletions(-) diff --git a/src/pages/user_profile/RequestForm.js b/src/pages/user_profile/RequestForm.js index 8857208b1..e07161ed2 100644 --- a/src/pages/user_profile/RequestForm.js +++ b/src/pages/user_profile/RequestForm.js @@ -16,46 +16,55 @@ export default function SupportRequestsPage(props) { marginBottom: '1rem' }; - const possibleRoleRequests = [ - { - key: 'checkRegisterDataset', - label: 'Register a dataset' - }, - { - key: 'checkSOPermissions', - label: `I am a Signing Official and I want to issue permissions to my institution's users` - }, - { - key: 'checkJoinDac', - label: 'I am looking to join a DAC' - } - ]; - - const possibleLCRequests = [ - { - key: 'requestNewLC', - label: 'Request a new library card', - isDefaultOption: true, - } - ]; - - const possibleSupportRequests = props.isRequestRolePage ? possibleRoleRequests : (props.isRequestLCPage ? possibleLCRequests : []); - - const [hasSupportRequests, setHasSupportRequests] = useState(props.isRequestLCPage); - - const roleSupportRequests = { - checkRegisterDataset: false, - checkRequestDataAccess: false, - checkSOPermissions: false, - checkJoinDac: false, - extraRequest: undefined - }; - - const lcSupportRequests = { - requestNewLC: true, - }; - - const [supportRequests, setSupportRequests] = useState(props.isRequestRolePage ? roleSupportRequests : (props.isRequestLCPage ? lcSupportRequests : {})); + var possibleSupportRequests; + var hasSupportRequestsCond; + var supportRequestsCond; + + if (props.isRequestRolePage) { + possibleSupportRequests = [ + { + key: 'checkRegisterDataset', + label: 'Register a dataset' + }, + { + key: 'checkSOPermissions', + label: `I am a Signing Official and I want to issue permissions to my institution's users` + }, + { + key: 'checkJoinDac', + label: 'I am looking to join a DAC' + } + ]; + hasSupportRequestsCond = false; + supportRequestsCond = { + checkRegisterDataset: false, + checkRequestDataAccess: false, + checkSOPermissions: false, + checkJoinDac: false, + extraRequest: undefined + }; + } + else if (props.isRequestLCPage) { + possibleSupportRequests = [ + { + key: 'requestNewLC', + label: 'Request a new library card', + isDefaultOption: true, + } + ]; + hasSupportRequestsCond = true; + supportRequestsCond = { + requestNewLC: true, + }; + } + else { + possibleSupportRequests = []; + hasSupportRequestsCond = false; + supportRequestsCond = {}; + } + + const [hasSupportRequests, setHasSupportRequests] = useState(hasSupportRequestsCond); + const [supportRequests, setSupportRequests] = useState(supportRequestsCond); const goToPrevPage = async (event) => { event.preventDefault(); From e9543b45a3a2892904d9cf3812e27c447847e470 Mon Sep 17 00:00:00 2001 From: Hamsini Malli Date: Thu, 30 Nov 2023 15:35:02 -0500 Subject: [PATCH 3/3] Update src/Routes.js Co-authored-by: Gregory Rushton --- src/Routes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Routes.js b/src/Routes.js index 86bf996f8..6382533fe 100644 --- a/src/Routes.js +++ b/src/Routes.js @@ -66,8 +66,8 @@ const Routes = (props) => ( - - + +