-
-
Notifications
You must be signed in to change notification settings - Fork 17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
const socialGroups = get(siteSettings, [ | ||
'social_group_roles', | ||
'value', | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have a default value of an empty array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.... fixed this for regions as well. 78f9926.
const emptyRoleLabels = roleLabels.filter(label => !label); | ||
if (emptyRoleLabels.length > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified with some
https://lodash.com/docs/4.17.15#some or https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 78f9926.
<div | ||
style={{ | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
width: 500, | ||
}} | ||
> | ||
<Text | ||
variant="caption" | ||
id="CONFIGURATION_SOCIAL_GROUP_ROLES_DESCRIPTION" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wrapper div
is unnecessary if you change Text to a block element, for example:
<Text
style={{ maxWidth: 500 }}
variant="caption"
component="p" // "caption" uses a span, so you would have to explicitly specify "p"
id="CONFIGURATION_SOCIAL_GROUP_ROLES_DESCRIPTION"
/>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Add Role button was shunted to the next line with this change, so I kept it as-it -was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is below that one. It is the description, not the label and button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my bad. Fixed in af9447e.
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
width: 500, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxWidth
instead of width
will display better on smaller screen sizes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 78f9926
roles, | ||
role => ( | ||
<SocialGroupRole | ||
key={role?.guid} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The key cannot be guaranteed to be unique if multiple keys may be set to
undefined
- For the UI, we should not be including roles that don't exist. These should be filtered before the map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think fixed in 78f9926?
onChange={setRoles} | ||
/> | ||
), | ||
[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my defense, this is not a mistake I have made since re-learning this lesson last time (for maybe the fifth time).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 78f9926
{fromErrors && ( | ||
<Alert severity="error" titleId="AN_ERROR_OCCURRED"> | ||
{fromErrors.map(error => ( | ||
<Text key={error} variant="body2"> | ||
{error} | ||
</Text> | ||
))} | ||
</Alert> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConfigureDefaultField
includes an error display. If you think it is easier to read, I think you can remove this and instead add the map earlier.
<ConfigureDefaultField
error={
fromErrors?.map(error => (
<Text key={error} variant="body2">
{error}
</Text>
))}
// the rest of the props that you already have defined
>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 78f9926
function deleteRole(roles, roleGuid) { | ||
const focalRole = find(roles, role => role?.guid === roleGuid); | ||
if (focalRole) { | ||
const remainingRoles = filter( | ||
roles, | ||
role => role?.guid !== roleGuid, | ||
); | ||
return remainingRoles; | ||
} | ||
return roles; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be simpler to just
function deleteRole(roles, roleGuid) {
return filter(roles, role => role?.guid !== roleGuid)
}
If the roleGuid does not exist, the entire array will still be returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 78f9926
const checked = get(currentRole, 'multipleInGroup', false); | ||
|
||
return ( | ||
<div style={{ marginLeft: 32, marginTop: 10 }} key={roleGuid}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key
shouldn't be necessary here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 78f9926
onChange, | ||
}) { | ||
const intl = useIntl(); | ||
const roleGuid = currentRole?.guid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no currentRole
, should we be returning null
or an error message instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just confirmed that the migrated roles will all have guids. And our newly-created ones will all have guids.
If we are only rendering this components on roles that pass the criterion from your other comment:
For the UI, we should not be including roles that don't exist. These should be filtered before the map.
, will this check be necessary?
What if I change what I currently have:
const safeRoles = filter(roles, role => Boolean(role));
to this:
const safeRoles = filter(roles, role => Boolean(role?.guid));
?
* Automatic Docker builds on tagged releases and PRs with multi-platform support * Remove nightly action, which was merged into build * Allow all files to be copied in * Dex 761 social group site settings (#419) * DEX-761 flesh out social group form except for multipleInGroup * DEX-761 begin fleshing out the switch * DEX-761 continue with fleshing out the switch * DEX-761 add useEffect * DEX-761 rename the role component, clean up, and remove the unnecessary useState * DEX-761 internationalize and add description as caption * DEX-761 respond to code review feedback * DEX-761 remove unecessary flexbox div * DEX-761 handle the case where a guidless role makes it into the SocialGroupRole component * move server status components to siteStatus directory * Change server status text to site status * Add server status SuperText keys, prevent 'hide' prop from passing to Text * Internationalize aria labels in site status components * dex 1117 - Replace progress with pipeline_status in Asset Group (#420) * Replace asset group progress with pipeline_status * Change px to number and abstract showAlert in AssetGroup * Add public AGS page (#416) * Add public AGS page * Remove unused property * Fixes * Rename things * Remove unused translation key * use new terms (#418) * begin release procedure (#424) * begin release procedure * clarify about merge conflicts * respond to feedback * respond to code review feedback * Update release procedure doc * Run on sentence Co-authored-by: Ben Scheiner <[email protected]> * DEX-922 implement stickyHeader and add a meaningful maxHeight to ever… (#430) * DEX-922 implement stickyHeader and add a meaningful maxHeight to every DataDisplay. Also add horizontalScroll * DEX-922 remove seemingly unnecessary horizontal scroll prop * DEX-922 respond to code review feedback. Remove default maxHeight for Card component and replaced with optional styles, which was then implemented for ImageCard and StatusCard. Remove maxHeight from Card in relationshipCard, remove unused paperStyles from DataDisplay. * DEX-922 respond to code review feedback pt 2 * DEX-922 add tableContainerStyles to DataDisplay and remove maxHeight * DEX-922 remove tableContainerStyles from SightingsDisplay and fix a few little things * DEX-922 final little fixes * Compute new form state from previous state in Settings (#433) * 922 follow up (#435) * DEX-922 print the collaboration data to make the stackBlitz question easier * DEX-922 I do not understand why tableData was undefined, but cool, codex, I can play this game with you * DEX-922 try disablePortal * DEX-922 change the z-index * DEX-922 clean up * DEX-922 respond to code review feedback * Update version to 1.0.2 (#436) Co-authored-by: Jason Parham <[email protected]> Co-authored-by: Mark <[email protected]> Co-authored-by: Ben Scheiner <[email protected]>
Pull request checklist:
develop
branch, notmain
Thanks for keeping it clean! Feel free to merge your own pull request after it has been approved - just use the "squash & merge" option.
QA Notes
Users should be able to add and remove new social group roles.
Users should not be able to save if any roles are empty strings or if there are any duplicates.
Users should be able to designate whether or not a particular role is usable by multiple individuals within a social group.