Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated User Management Section #1557

Conversation

freaky4wrld
Copy link
Member

@freaky4wrld freaky4wrld commented Dec 23, 2023

Fixes #1478

What changes did you make and why did you make them ?

  • Refractored the current version of code in accordance to the MUI component, these changes are made as per the issue
  • Added a Add a New User button as per the design
  • There are changes to be made for styling and positioning purposes

Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)

Visuals before changes are applied

image

Visuals after changes are applied

image

@freaky4wrld freaky4wrld requested a review from trillium December 23, 2023 11:11
Copy link

Want to review this pull request? Take a look at this documentation for a step by step guide!

From your project repository, check out a new branch and test the changes.

git checkout -b freaky4wrld-updating-user-management-section-according-figma-design-1478 development
git pull https://github.com/freaky4wrld/VRMS.git updating-user-management-section-according-figma-design-1478

@freaky4wrld
Copy link
Member Author

@spiteless just want to know your views on the recent changes, also if you can direct me to some examples for styling those Button, ButtonGroup and Textfield or should I use the sx property

@trillium trillium added the draft Not ready for prioritization yet label Dec 23, 2023
Copy link
Member

@trillium trillium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this going!

Use sx or MUI system properties to style the boxes/buttons/button groups. I've added inline suggestions to help with some of the changes :)

import '../../sass/UserAdmin.scss';

const h3sx = {
Copy link
Member

@trillium trillium Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to bring in this object, the default styling is fine for this page

@@ -44,64 +55,77 @@ const UserManagement = ({ users, setUserToEdit }) => {
return (
<div className="container--usermanagement">
<div>
<h3>User Management</h3>
<input
<Typography variant='h3' sx={h3sx}>User Management</Typography>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to h1


<div className="tab-buttons">
<ButtonGroup>
<div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change nesting of elements to:

<ButtonGroup>
    <Button> etc... </Button>
    <Button> etc... </Button>
</ButtonGroup>

From

<ButtonGroup>
    <div>
        <Button> etc... </Button>
    </div>
    <div>
        <Button> etc... </Button>
    </div>
</ButtonGroup>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the nesting will allow the buttons to display in a pill shape as per the figma file

}
variant='secondary'
onClick={buttonSwap}
disabled={searchResultType === 'name'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop disable prop, it's okay if these are clicked even if one is already selected

? 'select-button selected'
: 'select-button'
}
variant='secondary'
Copy link
Member

@trillium trillium Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change variant prop to secondary or contained based on the same ternamery in className:

                variant={
                  searchResultType === 'name'
                    ? 'contained'
                    : 'secondary'
                }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contained is the active button state, secondary is the inactive button state

type="text"
placeholder="Search by name and email..."
value={searchTerm}
onChange={handleChange}
/>
<div className="tab-buttons">
<Box>
Copy link
Member

@trillium trillium Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to steal from other components in the project already:

This section with rendered users is similar to the results from the Project Management page:
( this is actully pulled from the return of ValidatedTextField, but its styling can be viewed from the Project Management page )

        <Box sx={{ bgcolor: '#F5F5F5', my: 3 }}>
            <Box sx={{ py: 2, px: 4, ...childrenBoxSx }}>
                {children} {/* This is where searchRuslts.map() would go /*}
            </Box>
        </Box>

@freaky4wrld
Copy link
Member Author

freaky4wrld commented Dec 26, 2023

@spiteless please check the recent styling changes, and the screenshots are updated as well.
I've slacked some blockers do check them as well, Thanks !!!!

@freaky4wrld
Copy link
Member Author

@spiteless tried adding breakpoints to the button element, I guess the branch UI is close to the issue UI. Please provide your feedback.

@freaky4wrld freaky4wrld removed the draft Not ready for prioritization yet label Jan 9, 2024
Copy link
Member

@trillium trillium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is coming together nicely!

Please update a few things:

  • Change all div to Box
  • Remove any width statement that is greater than 100%
    • Give those elements margin or padding instead
      (This is because a larger width than 100% will mess with the box model making maintenence down the line more complicated)
  • Remove commented out objects or objects that aren't bening used
    • the h3sx object
    • the empty sx prop in the Box

Great work! I'm stoked to get this merged.

client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
width: '75%',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a few other comments in here about width being used. This is another case where I'd prefer to see the boundaries of the box maintained by margin or padding eg:

sx={{
  mx: 2 // This is just an example value
        // mx being mui's system for marginLeft and marginRight
}}

If we do need to limit the width of this Box, I'd prefer we go with a maxWidth property so that the size is properly restrained on wider screens.

client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
Copy link
Member

@trillium trillium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested some changes to help out with width and spacing.

There's a few occurances of things like px: "0.5rem" that would be better served using MUI's spacing system and numerical units. Would you mind updating those? My appologies if this is getting tedious.

Also requested a few width: 1/1 or width: "100%s to make sure a Box or two are inhereting the width properly from their parent element. Thanks for removing the non-100% values!

client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
client/src/components/user-admin/UserManagement.js Outdated Show resolved Hide resolved
@freaky4wrld
Copy link
Member Author

@spiteless hope you aren't asleep, review whenever you want

Copy link
Member

@trillium trillium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, looks good to me!

@trillium trillium merged commit 3405552 into hackforla:development Jan 13, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update User Management section to use new Figma design
2 participants