Skip to content

Commit

Permalink
UI Development
Browse files Browse the repository at this point in the history
  • Loading branch information
jeznorth committed Aug 25, 2023
1 parent 9e417df commit befd1e5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 49 deletions.
3 changes: 1 addition & 2 deletions app/src/components/alert/AlertBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface IAlertBarProps {

const AlertBar: React.FC<IAlertBarProps> = (props) => {
const { severity, variant, title, text } = props;
const [forceAlertClose, setForceAlertClose] = useState(false);
const [forceAlertClose] = useState(false);

if (forceAlertClose) {
// User has manually closed the banner
Expand All @@ -24,7 +24,6 @@ const AlertBar: React.FC<IAlertBarProps> = (props) => {
<Alert
variant={variant}
severity={severity}
onClose={() => setForceAlertClose(true)}
// action={
// <IconButton color="inherit" onClick={() => setForceAlertClose(false)}>
// <Icon path={mdiClose} size={1} />
Expand Down
94 changes: 51 additions & 43 deletions app/src/features/projects/components/ProjectUserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,35 @@ const ProjectUserForm: React.FC<IProjectUser> = (props) => {
return (
<form onSubmit={handleSubmit}>
<Box component="fieldset">
<Typography component="legend">Add Team Members</Typography>
<Typography component="legend">Manage Team Members</Typography>
<Typography variant="body1" color="textSecondary"

Check warning on line 160 in app/src/features/projects/components/ProjectUserForm.tsx

View workflow job for this annotation

GitHub Actions / Running Linter and Formatter

Replace `·variant="body1"` with `⏎··········variant="body1"⏎·········`
sx={{
maxWidth: '72ch'
}}

Check warning on line 163 in app/src/features/projects/components/ProjectUserForm.tsx

View workflow job for this annotation

GitHub Actions / Running Linter and Formatter

Delete `⏎········`
>
A minimum of one team member must be assigned the coordinator role.
</Typography>
{errors && errors['participants'] && !selectedUsers.length && (
<AlertBar
severity="error"
variant="standard"
title={'Missing Team Member'}
text={'At least 1 member needs to be added to manage a project.'}
/>
<Box mt={3}>
<AlertBar
severity="error"
variant="standard"
title={'No team members added'}
text={'At least one team member needs to be added to this project.'}
/>
</Box>
)}
{errors && errors['participants'] && selectedUsers.length > 0 && (
<Box mt={3}>
<AlertBar severity="error" variant="standard" title={alertBarText().title} text={alertBarText().text} />
</Box>
)}
<Typography variant="body1" color="textSecondary" style={{ maxWidth: '90ch' }}>
Select team members and assign each member a role for this project.
</Typography>
<Box mt={3}>
<Autocomplete
id={'autocomplete-user-role-search'}
data-testid={'autocomplete-user-role-search'}
filterSelectedOptions
noOptionsText="No records found"
options={filterSearchOptions(searchUserDataLoader.data, selectedUsers)}
getOptionLabel={(option) => option.display_name}
onChange={(_, option) => {
Expand All @@ -184,11 +196,11 @@ const ProjectUserForm: React.FC<IProjectUser> = (props) => {
<TextField
{...params}
variant="outlined"
placeholder={'Find Team Members'}
placeholder={'Find team members'}
fullWidth
InputProps={{
...params.InputProps,
startAdornment: <Icon path={mdiMagnify} size={1}></Icon>
startAdornment: <Box mx={1} mt="6px"><Icon path={mdiMagnify} size={1}></Icon></Box>

Check warning on line 203 in app/src/features/projects/components/ProjectUserForm.tsx

View workflow job for this annotation

GitHub Actions / Running Linter and Formatter

Replace `<Box·mx={1}·mt="6px"><Icon·path={mdiMagnify}·size={1}></Icon></Box>` with `(⏎····················<Box·mx={1}·mt="6px">⏎······················<Icon·path={mdiMagnify}·size={1}></Icon>⏎····················</Box>⏎··················)`
}}
/>
)}
Expand All @@ -206,40 +218,36 @@ const ProjectUserForm: React.FC<IProjectUser> = (props) => {
}}
/>
</Box>
</Box>
<Box component="fieldset" mt={4}>
{selectedUsers.length > 0 && (
<Typography component={'legend'} variant="h5">
Assign Roles ({selectedUsers.length})
</Typography>
)}
{errors && errors['participants'] && selectedUsers.length > 0 && (
<AlertBar severity="error" variant="standard" title={alertBarText().title} text={alertBarText().text} />
<Box mt={2}>
<Box
sx={{
'& .userRoleItemContainer + .userRoleItemContainer': {
mt: 1
}
}}>
{selectedUsers.map((user: ISystemUser | IGetProjectParticipant, index: number) => {
const error = rowItemError(index);

console.log('selected user: ', user);
return (
<UserRoleSelector
index={index}
user={user}
roles={props.roles}
error={error}
selectedRole={getSelectedRole(index)}
handleAdd={handleAddUserRole}
handleRemove={handleRemoveUser}
key={user.system_user_id}
/>
);
})}
</Box>
</Box>
)}
<Box
sx={{
'& .userRoleItemContainer + .userRoleItemContainer': {
mt: 1
}
}}>
{selectedUsers.map((user: ISystemUser | IGetProjectParticipant, index: number) => {
const error = rowItemError(index);

return (
<UserRoleSelector
index={index}
user={user}
roles={props.roles}
error={error}
selectedRole={getSelectedRole(index)}
handleAdd={handleAddUserRole}
handleRemove={handleRemoveUser}
key={user.system_user_id}
/>
);
})}
</Box>
</Box>

Check warning on line 249 in app/src/features/projects/components/ProjectUserForm.tsx

View workflow job for this annotation

GitHub Actions / Running Linter and Formatter

Delete `⏎`

</form>
);
};
Expand Down
4 changes: 2 additions & 2 deletions app/src/features/projects/create/CreateProjectForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ const CreateProjectForm: React.FC<ICreateProjectForm> = (props) => {
<Divider className={classes.sectionDivider} />

<HorizontalSplitFormComponent
title="Project Users"
summary="Add some users"
title="Team Members"
summary="Specify team members and their associated role for this project."
component={<ProjectUserForm users={[getLoggedInUserAsParticipant()]} roles={codes.project_roles} />}
/>

Expand Down
4 changes: 2 additions & 2 deletions app/src/features/projects/edit/EditProjectForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ const EditProjectForm: React.FC<IEditProjectForm> = (props) => {
<Divider className={classes.sectionDivider} />

<HorizontalSplitFormComponent
title="Project Users"
summary="Add some users"
title="Team Members"
summary="Specify team members and their associated role for this project."
component={<ProjectUserForm users={props.projectData.participants || []} roles={codes.project_roles} />}
/>

Expand Down

0 comments on commit befd1e5

Please sign in to comment.