diff --git a/frontend/src/entry/model/settings/EntryRolesInfo.tsx b/frontend/src/entry/model/settings/EntryRolesInfo.tsx index 4007d271a..f89e9d89a 100644 --- a/frontend/src/entry/model/settings/EntryRolesInfo.tsx +++ b/frontend/src/entry/model/settings/EntryRolesInfo.tsx @@ -52,32 +52,30 @@ export default function EntryRolesInfo({ entry }: EntryRolesInfoProps) { const schemaRolesList = useMemo(() => getFilteredRoles(RoleKind.SCHEMA), [getFilteredRoles]) - const showPopover = (row: Row) => { - if (row.helpText) { - return {row.helpText} - } - } - - const canRoleDoAction = (role: RoleValue, roles: RoleValue[]) => { - if (roles.includes(role)) { - return - } - } - const permissionTableRows = useMemo(() => { return rows.map((row) => ( {row.permission} - {showPopover(row)} + - {canRoleDoAction(RoleValue.OWNER, row.roles)} - {canRoleDoAction(RoleValue.CONTRIBUTOR, row.roles)} - {canRoleDoAction(RoleValue.CONSUMER, row.roles)} - {canRoleDoAction(RoleValue.RELEASE_REVIEWER, row.roles)} - {canRoleDoAction(RoleValue.ACCESS_REVIEWER, row.roles)} + + + + + + + + + + + + + + + )) }, []) @@ -180,7 +178,7 @@ const rows: Row[] = [ { permission: 'Edit or delete any access request', roles: [RoleValue.OWNER], - helpText: 'You can also edit/delete an access request if you an Additional Contact', + helpText: 'You can also edit/delete an access request if you are an Additional Contact', }, { permission: 'Update model settings', @@ -195,3 +193,28 @@ const rows: Row[] = [ roles: [RoleValue.ACCESS_REVIEWER], }, ] + +type RowHelpTextProps = { + row: Row +} + +function RowHelpText({ row }: RowHelpTextProps) { + if (!row.helpText) { + return null + } + + return {row.helpText} +} + +type RoleActionIconProps = { + role: RoleValue + roles: RoleValue[] +} + +function RoleActionIcon({ role, roles }: RoleActionIconProps) { + if (!roles.includes(role)) { + return null + } + + return +}