Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
export collaboration
Browse files Browse the repository at this point in the history
remove duplicate keys

add export

export collaboration

remove duplicate keys

edit access modal

debug with houston

buggy day

lots of new components

restore editMetadata

sweep out logs

update key

sweep out
  • Loading branch information
erinz2020 committed Jan 26, 2024
1 parent 5dc1dc1 commit cfd3e54
Show file tree
Hide file tree
Showing 31 changed files with 979 additions and 332 deletions.
21 changes: 20 additions & 1 deletion locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@
"COLLABORATION_VIEW_REQUEST_BRIEF": "{userName} has requested to collaborate with you",
"COLLABORATION_VIEW_REQUEST_DESCRIPTION": "{userName} has requested to collaborate with you. If you grant access to {userName}, you will be able to view each other's data.",
"COLLABORATION_EDIT_REQUEST_BRIEF": "{userName} has requested an edit collaboration with you",
"COLLABORATION_EXPORT_REQUEST_BRIEF": "{userName} has requested an export collaboration with you",
"COLLABORATION_EDIT_REQUEST_DESCRIPTION": "{userName} has requested an edit collaboration with you. If you grant access to {userName}, you will be able to edit each other's data.",
"COLLABORATION_EXPORT_REQUEST_DESCRIPTION": "{userName} has requested an export collaboration with you. If you grant access to {userName}, you will be able to export each other's data.",
"VIEW_USER_PROFILE": "View user profile",
"SEARCH_RADIUS_LABEL": "Search radius (kilometers)",
"SEARCH_CENTER_POINT": "Search center point",
Expand Down Expand Up @@ -1049,7 +1051,9 @@
"COLLABORATION_APPROVED_TITLE": "Collaboration approved",
"COLLABORATION_REVOKE_BRIEF": "{userName} revoked your collaboration request",
"EDIT_COLLABORATION_APPROVED": "{userName} approved your collaboration edit request",
"EXPORT_COLLABORATION_APPROVED": "{userName} approved your collaboration export request",
"EDIT_COLLABORATION_REVOKED": "{userName} revoked edit privileges for your collaboration with them",
"EXPORT_COLLABORATION_REVOKED": "{userName} revoked export privileges for your collaboration with them",
"COLLABORATION_REVOKED_BY_MANAGER": "A collaboration was revoked by a user manager.",
"INDIVIDUAL_MERGE_REQUEST_MESSAGE_DETAILED": "{userName} requested that {yourIndividualName} be merged with {theirIndividualName}. You have until {formattedDeadline} to respond.",
"INDIVIDUAL_MERGE_REQUEST_MESSAGE": "{userName} wants to merge {yourIndividualName} with {theirIndividualName}",
Expand All @@ -1060,8 +1064,11 @@
"COLLABORATION_ESTABLISHED_BY_USER_MANAGER": "Collaboration established by a user manager",
"COLLABORATION_REVOKE_TITLE": "Revoke collaboration",
"COLLABORATION_EDIT_REQUEST_TITLE": "Edit collaboration request",
"COLLABORATION_EXPORT_REQUEST_TITLE": "Export collaboration request",
"COLLABORATION_EDIT_APPROVED_TITLE": "Collaboration edit approved",
"COLLABORATION_EXPORT_APPROVED_TITLE": "Collaboration export approved",
"COLLABORATION_EDIT_REVOKE_TITLE": "Revoke edit privileges",
"COLLABORATION_EXPORT_REVOKE_TITLE": "Revoke export privileges",
"COLLABORATION_MANAGER_REVOKE_TITLE": "Revoke manager-assigned collaboration",
"INDIVIDUAL_MERGE_REQUEST_TITLE": "Individual merge request",
"INDIVIDUAL_MERGE_COMPLETE_TITLE": "Individual merge completed",
Expand Down Expand Up @@ -1206,15 +1213,23 @@
"ADD_COLLABORATION": "Add collaboration",
"EMAIL": "Email",
"EDIT_COLLABORATION_REVOKED_BY_USER_MANAGER": "Edit collaboration revoked by a user manager.",
"EXPORT_COLLABORATION_REVOKED_BY_USER_MANAGER": "Export collaboration revoked by a user manager.",
"EDIT_COLLABORATION_WAS_REVOKED_BY_A_USER_MANAGER": "An edit-level collaboration with {otherUserNameForManagerNotifications} was revoked by a user manager {managerName}.",
"EXPORT_COLLABORATION_WAS_REVOKED_BY_A_USER_MANAGER": "An export-level collaboration with {otherUserNameForManagerNotifications} was revoked by a user manager {managerName}.",
"COLLABORATION_EDIT_DENIED": "Collaboration edit denied",
"COLLABORATION_EXPORT_DENIED": "Collaboration export denied",
"EDIT_COLLABORATION_DENIED_MESSAGE": "{userName} denied your collaboration edit request",
"EXPORT_COLLABORATION_DENIED_MESSAGE": "{userName} denied your collaboration export request",
"COLLABORATION_DENIED_BY_USER_MANAGER": "Collaboration denied by a user manager",
"COLLABORATION_DENIED_BY_USER_MANAGER_MESSAGE": "Your collaboration with {otherUserNameForManagerNotifications} was denied by a user manager {managerName}.",
"EDIT_COLLABORATION_DENIED_BY_USER_MANAGER": "Edit-level collaboration denied by a user manager",
"EXPORT_COLLABORATION_DENIED_BY_USER_MANAGER": "Export-level collaboration denied by a user manager",
"EDIT_COLLABORATION_DENIED_BY_USER_MANAGER_MESSAGE": "An edit-level collaboration with {otherUserNameForManagerNotifications} was denied by a user manager {managerName}.",
"EXPORT_COLLABORATION_DENIED_BY_USER_MANAGER_MESSAGE": "An export-level collaboration with {otherUserNameForManagerNotifications} was denied by a user manager {managerName}.",
"EDIT_COLLABORATION_APPROVED_BY_USER_MANAGER": "Edit collaboration approved by a user manager",
"EXPORT_COLLABORATION_APPROVED_BY_USER_MANAGER": "Export collaboration approved by a user manager",
"EDIT_COLLABORATION_WAS_APPROVED_BY_A_USER_MANAGER": "An edit-level collaboration with {otherUserNameForManagerNotifications} was approved by a user manager {managerName}.",
"EXPORT_COLLABORATION_WAS_APPROVED_BY_A_USER_MANAGER": "An export-level collaboration with {otherUserNameForManagerNotifications} was approved by a user manager {managerName}.",
"UNNAMED_MANAGER": "Unnamed manager",
"STILL_GENERATING_LIST": "Still generating list; this can take up to one minute.",
"SEARCH_TIMED_OUT_WHILE_TRYING_TO_CONNECT_TO_ITIS": "Search timed out while trying to connect to ITIS database. Try again later.",
Expand Down Expand Up @@ -1290,5 +1305,9 @@
"MANAGE_REGIONS" : "Manage Regions",
"EXPORT_RESULT" : "Export result",
"EXPORT_ACCESS_RESTRICTED_WARNING" : "No results meet export criteria. Consider adjusting your search or requesting export collaborations.",
"OK" : "Ok"
"OK" : "Ok",
"EXPORT" : "Export",
"ACCESS" : "Access",
"COLLABORATE" : "Collaborate",
"COLLABORATION_STATE_EXPORT" : "Export"
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function NotificationsPane({
const defaultButtonPath = get(
currentNotificationSchema,
'buttonPath',
'/#collab-card',
'/user-profile/#collab-card',
);
const buttonPath = deriveButtonPath
? deriveButtonPath(mergedIndividualGuid)
Expand Down
236 changes: 118 additions & 118 deletions src/components/EditUserMetadata.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import { get, map, omit, find } from 'lodash-es';
import DialogContent from '@material-ui/core/DialogContent';
import DialogActions from '@material-ui/core/DialogActions';

import Typography from '@material-ui/core/Typography';
import { useTheme } from '@material-ui/core/styles';
import Chip from '@material-ui/core/Chip';
import { MailOutline } from '@material-ui/icons';
import AccountCircleOutlinedIcon from '@material-ui/icons/AccountCircleOutlined';
import ForumOutlinedIcon from '@material-ui/icons/ForumOutlined';
import AccountBalanceOutlined from '@material-ui/icons/AccountBalanceOutlined';
import PlaceOutlined from '@material-ui/icons/PlaceOutlined';
import CustomAlert from './Alert';
import { useReplaceUserProperties } from '../models/users/usePatchUser';
import { sanitizeTwitterHandle } from '../utils/formatters';
Expand All @@ -12,21 +20,11 @@ import InputRow from './fields/edit/InputRow';
import Button from './Button';
import PasswordVerificationAlert from './PasswordVerificationAlert';
import StandardDialog from './StandardDialog';
import Typography from '@material-ui/core/Typography';
import { useTheme } from '@material-ui/core/styles';
import EntityHeader from './EntityHeader';
import BigAvatar from './profilePhotos/BigAvatar';
import RequestCollaborationButton from './RequestCollaborationButton';
import Text from './Text';
import Chip from '@material-ui/core/Chip';
import { MailOutline } from '@material-ui/icons';
import UserProfileMetadataWrap from './UserProfileMetadataWrap';
import AccountCircleOutlinedIcon from '@material-ui/icons/AccountCircleOutlined';
import ForumOutlinedIcon from '@material-ui/icons/ForumOutlined';
import AccountBalanceOutlined from '@material-ui/icons/AccountBalanceOutlined';
import PlaceOutlined from '@material-ui/icons/PlaceOutlined';



function getInitialFormValues(schema) {
return schema.reduce((memo, field) => {
Expand Down Expand Up @@ -74,7 +72,6 @@ export default function EditUserMetadata({
setFieldValues(getInitialFormValues(metadata));
}, [metadata]);


return (
<StandardDialog
PaperProps={{ style: { width: 900 } }}
Expand All @@ -83,76 +80,64 @@ export default function EditUserMetadata({
onClose={onClose}
>
<DialogContent style={{ minWidth: 200 }}>
<EntityHeader
name={name}
editable
noDivider
renderAvatar={
<BigAvatar
editable
userId={userId}
imageGuid={imageGuid}
imageSrc={imageSrc}
name={name}
refreshUserData={refreshUserData}
userDataLoading={userDataLoading}
/>
}

<EntityHeader
name={name}
editable
noDivider
renderAvatar={
<BigAvatar
editable
userId={userId}
imageGuid={imageGuid}
imageSrc={imageSrc}
name={name}
refreshUserData={refreshUserData}
userDataLoading={userDataLoading}
/>
}
renderOptions={

<RequestCollaborationButton
otherUserId={userId}
/>

}
>
<div
style={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
}}
>
>
<div
style={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
}}
>
<div style={{ display: 'flex', flexDirection: 'row' }}>
{communityUsername && (
<>
<Typography variant="body2">
{`@${communityUsername}`}
</Typography>
<div
style={{ display: 'flex', flexDirection: 'row' }}
>
{communityUsername && <>
<Typography
variant="body2"
>
{`@${communityUsername}`}
</Typography>
<div
style={{
height: '20px',
width: '2px',
backgroundColor: 'gray',
margin: '0 10px',
}}
/>
</>}

<Text
variant="body2"
domId="selenium-user-since"
id="USER_SINCE"
values={{ date: dateCreated }}
/>
</div>

</div>
<Chip
label={highestRoleLabelId}
style={{
marginTop: 14,
color: theme.palette.common.black,
backgroundColor:
theme.palette.primary.main + '26',
}}
/>
</EntityHeader>
style={{
height: '20px',
width: '2px',
backgroundColor: 'gray',
margin: '0 10px',
}}
/>
</>
)}

<Text
variant="body2"
domId="selenium-user-since"
id="USER_SINCE"
values={{ date: dateCreated }}
/>
</div>
</div>
<Chip
label={highestRoleLabelId}
style={{
marginTop: 14,
color: theme.palette.common.black,
backgroundColor: theme.palette.primary.main + '26',
}}
/>
</EntityHeader>

{metadata.map(field => {
if (!field.editable) return null;
Expand All @@ -163,46 +148,61 @@ export default function EditUserMetadata({
const labelId = get(field, 'labelId');

return (
<div key = {"metadata_input_row"} style = {{display: 'flex', flexDirection: 'row'}}>
{labelId === 'FULL_NAME' &&
<UserProfileMetadataWrap key={'FULL_NAME'}>
<AccountCircleOutlinedIcon fontSize="small" color="inherit" />
</UserProfileMetadataWrap>}
{labelId === 'PROFILE_LABEL_EMAIL' &&
<UserProfileMetadataWrap key={"EMAIL"}>
<MailOutline fontSize="small" color="inherit" />
</UserProfileMetadataWrap>}
{labelId === 'PROFILE_LABEL_FORUM_ID' &&
<UserProfileMetadataWrap key={"FORUM_ID"}>
<ForumOutlinedIcon fontSize="small" color="inherit" />
</UserProfileMetadataWrap>}
{labelId === 'PROFILE_LABEL_AFFILIATION' &&
<UserProfileMetadataWrap key={"AFFILIATION"}>
<AccountBalanceOutlined fontSize="small" color="inherit" />
</UserProfileMetadataWrap>}
{labelId === 'PROFILE_LABEL_LOCATION' &&
<UserProfileMetadataWrap key={"LOCATION"}>
<PlaceOutlined fontSize="small" color="inherit" />
</UserProfileMetadataWrap>}

<>
<InputRow schema={field} key={field.id || field.name}>
<field.editComponent
schema={field}
{...fieldProps}
value={value}
minimalLabels
onChange={newValue => {
const newFormValues = {
...fieldValues,
[field.name]: newValue,
};
setFieldValues(newFormValues);
}}
/>
</InputRow>
</>
</div>
<div
key="metadata_input_row"
style={{ display: 'flex', flexDirection: 'row' }}
>
{labelId === 'FULL_NAME' && (
<UserProfileMetadataWrap key="FULL_NAME">
<AccountCircleOutlinedIcon
fontSize="small"
color="inherit"
/>
</UserProfileMetadataWrap>
)}
{labelId === 'PROFILE_LABEL_EMAIL' && (
<UserProfileMetadataWrap key="EMAIL">
<MailOutline fontSize="small" color="inherit" />
</UserProfileMetadataWrap>
)}
{labelId === 'PROFILE_LABEL_FORUM_ID' && (
<UserProfileMetadataWrap key="FORUM_ID">
<ForumOutlinedIcon
fontSize="small"
color="inherit"
/>
</UserProfileMetadataWrap>
)}
{labelId === 'PROFILE_LABEL_AFFILIATION' && (
<UserProfileMetadataWrap key="AFFILIATION">
<AccountBalanceOutlined
fontSize="small"
color="inherit"
/>
</UserProfileMetadataWrap>
)}
{labelId === 'PROFILE_LABEL_LOCATION' && (
<UserProfileMetadataWrap key="LOCATION">
<PlaceOutlined fontSize="small" color="inherit" />
</UserProfileMetadataWrap>
)}

<InputRow schema={field} key={field.id || field.name}>
<field.editComponent
schema={field}
{...fieldProps}
value={value}
minimalLabels
onChange={newValue => {
const newFormValues = {
...fieldValues,
[field.name]: newValue,
};
setFieldValues(newFormValues);
}}
/>
</InputRow>
</div>
);
})}

Expand Down
Loading

0 comments on commit cfd3e54

Please sign in to comment.