-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: add registered conditions of access + consistent copy NIAID-Da…
- Loading branch information
Showing
10 changed files
with
148 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { AccessTypes } from '../api/types'; | ||
|
||
/* | ||
Stardized conditions of access value. Feedback provided by NIAID proposes "controlled" access instead of "closed" or "restricted". | ||
See issue #59 for more information. | ||
*/ | ||
|
||
export const formatConditionsOfAccess = ( | ||
access: string | null, | ||
): AccessTypes | null => { | ||
if (!access || access === undefined) { | ||
return null; | ||
} else { | ||
let label = access; | ||
|
||
if (access === 'Closed' || access.toLowerCase().includes('closed')) { | ||
/* | ||
Group "closed" access types as "registered". | ||
https://github.com/NIAID-Data-Ecosystem/niaid-feedback/issues/169#issuecomment-2546339216 | ||
*/ | ||
label = 'Registered'; | ||
} else if ( | ||
access === 'Restricted' || | ||
access.toLowerCase().includes('restricted') | ||
) { | ||
/* | ||
Group "restricted" access types as "controlled". | ||
https://github.com/NIAID-Data-Ecosystem/nde-portal/issues/59 | ||
*/ | ||
label = 'Controlled'; | ||
} | ||
return (label.charAt(0).toUpperCase() + label.slice(1)) as AccessTypes; | ||
} | ||
}; | ||
|
||
export const transformConditionsOfAccessLabel = ( | ||
conditionsOfAccess: AccessTypes | null, | ||
) => { | ||
if (!conditionsOfAccess) { | ||
return ''; | ||
} | ||
return ( | ||
conditionsOfAccess.charAt(0) + | ||
conditionsOfAccess.slice(1).toLowerCase() + | ||
' ' + | ||
'Access' | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters