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

[Enhancement] - Replace existing Contact List with MUI Data Grid #457

Merged
merged 29 commits into from
Oct 26, 2023

Conversation

leekahung
Copy link
Contributor

@leekahung leekahung commented Oct 14, 2023

This PR:

Updates existing table used for our Contact List with MUI Data Grid. The module for MUI Data Grid has been included to package.json. The column with originally with the link to the contact profile has been split up into the original text and a button icon in order to allow for filtering via MUI Data Grid. Other than that, the grid should function similarly to our previous table.

The unused ContactListTableRow.jsx is removed and a new component ContactProfileIcon.jsx is created for the React Router Link to the contact profile page.

The PR also includes a minor correction for contactProfile.profileImage in src/components/Profile/ProfileImageField.jsx. Before the profileImage would be incorrectly rendered because of the incorrect variable name, profileImg, which doesn't exist as part of contactProfile.

The column with pinning has been removed (UX team believes if there's already a filter + sorting capability with MUI Data Grid, this might not be necessary; it'll be better to have this moved as a type of status instead). The name from Person has been split up into "First Name" and "Last Name" for a better sorting experience.


The files this PR effects:

Components

  • src/components/Contacts/ContactListTable.jsx
  • src/components/Contacts/ContactListTableRow.jsx (file removed)
  • src/components/Contacts/ContactProfileIcon.jsx (file added)
  • src/components/Profile/ProfileImageField.jsx

Test Files

  • test/components/Contacts/ContactsListTable.test.jsx
  • test/components/Profile/ProfileImageField.test.jsx
  • test/pages/Contacts.test.jsx

Other Files

  • src/components/Contacts/index.js
  • package.json
  • package-lock.json

Screenshots (if applicable):

Screen.Recording.2023-10-19.at.10.30.59.mov

Future Considerations:

  • Implement accessibility improvements with MUI Data Grid after merger

@leekahung leekahung added the enhancement Enhancement of existing features label Oct 14, 2023
@leekahung leekahung self-assigned this Oct 14, 2023
Copy link
Contributor

@milofultz milofultz left a comment

Choose a reason for hiding this comment

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

If we could resolve the button nested in an a tag, that would be great. Thank you!

test/components/Contacts/ContactsListTable.test.jsx Outdated Show resolved Hide resolved
src/components/Contacts/ContactProfileIcon.jsx Outdated Show resolved Hide resolved
src/components/Contacts/ContactListTable.jsx Show resolved Hide resolved
@leekahung
Copy link
Contributor Author

If we could resolve the button nested in an a tag, that would be great. Thank you!

Thanks for the review @milofultz! I'll have the changes made in a bit.

@andycwilliams
Copy link
Member

Is there an associated issue for this?

@milofultz This is valuable feedback, at least for my own understanding. More insight into accessibility is really helpful for the project.

@leekahung
Copy link
Contributor Author

Is there an associated issue for this?

I was looking around the issues. There doesn't seem to be one for this or the ones that were there was closed.

@leekahung leekahung requested a review from milofultz October 15, 2023 20:59
@timbot1789
Copy link
Contributor

I think the data grid is a good enhancement over the current view. I especially like how we can easily add sorting to it (which may eliminate the need for pinning / favoriting).

How would you say it relates to this ticket, where I talk about converting the contacts list into a series of cards?
I based that off of one of the figma designs UX submitted.
image

@leekahung
Copy link
Contributor Author

leekahung commented Oct 15, 2023

How would you say it relates to this ticket, where I talk about converting the contacts list into a series of cards? I based that off of one of the figma designs UX submitted.

I think we could certainly have this link this to that issue since it does update the UI.

If we want to, think we could also separate out different fields from contact (like first name, last name) in a follow-up PR to make better use of Data Grid's innate sorting capabilities instead of our existing sorting scheme.

@andycwilliams
Copy link
Member

andycwilliams commented Oct 15, 2023

How would you say it relates to this ticket, where I talk about converting the contacts list into a series of cards? I based that off of one of the figma designs UX submitted.

I think we could certainly have this link this to that issue since it does update the UI.

If we want to, think we could also separate out different fields from contact (like first name, last name) in a follow-up PR to make better use of Data Grid's innate sorting capabilities instead of our existing sorting scheme.

When I last talked to UX about this, they said they were still working on the desktop version of these cards. So that combined with temporarily focusing on documentation recently, I haven't done a ton with #343 lately (and should really have moved that to the backlog).

I'm still willing to complete that, it would just mean waiting until this is merged before continuing.

Also, I would likely focus on #414 before moving onto #343.

@timbot1789
Copy link
Contributor

When I last talked to UX about this, they said they were still working on the desktop version of these cards. So that combined with temporarily focusing on documentation recently, I haven't done a ton with #343 lately (and should really have moved that to the backlog).

I'm still willing to complete that, it would just mean waiting until this is merged before continuing.

Also, I would likely focus on #414 before moving onto #343.

That sounds good to me. I personally like the card look more than the table. IMO it's more humanizing, and shows the data in a more familiar way. And I think it will work well in a desktop environment. The table view is good when you have several rows worth of data you need to look at all at once, but I don't know how often that will be the case here.

@@ -34,6 +34,7 @@
"@mui/material": "^5.12.2",
"@mui/styled-engine-sc": "^5.12.0",
"@mui/system": "^5.12.1",
"@mui/x-data-grid": "^6.16.2",
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this data grid what we used months back when creating the original table and implementing MUI? I don't recall why we decided not to go with it at that time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it was the same one as before. I think at the time we didn't went with it was because there were still a few thing we wish to discuss, although I don't remember which things.

@milofultz
Copy link
Contributor

milofultz commented Oct 16, 2023

Is there an associated issue for this?

I was looking around the issues. There doesn't seem to be one for this or the ones that were there was closed.

@andycwilliams @leekahung The issues I had when using VoiceOver on the data grid (which I'll admit isn't technically super proficient) were just basic navigation. In comparison to a data grid like this one from W3 which was super easy to navigate and interact with, the MUI one on their site was almost unusable.

I don't quite have to technical know how with grid yet to understand why this is the case, but I saw similar complaints in their backlog (mui/mui-x#4749, mui/mui-x#4658, mui/mui-x#4282).

Again, don't know how much of this is them, us, or me, but I saw a little bit of signal confirming my suspicions in their backlog so thought I'd bring it up.

edit: oop misread the original post, but leaving this here for clarity anyway, sorry for the erroneous tag now :)

Copy link
Contributor

@milofultz milofultz left a comment

Choose a reason for hiding this comment

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

Just one small thing, but not a blocker

test/components/Contacts/ContactsListTable.test.jsx Outdated Show resolved Hide resolved
@leekahung
Copy link
Contributor Author

Got everything updated from the suggestions. Let me know if there's still anything that needs to be reviewed for this PR.

@leekahung
Copy link
Contributor Author

Hey @xscottxbrownx @andycwilliams. Think I've manage to touch on the things you guys mentioned. Let me know if there's still other things you guys need to review or it's good to go?

Copy link
Member

@andycwilliams andycwilliams left a comment

Choose a reason for hiding this comment

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

Overall, it looks really nice. It's strange seeing the data grid again after all these months.

I think it would have been good to first create an issue before opening a PR as we normally do.

Curious, is the grid also intended to be implemented with the documents table?

@@ -44,31 +50,74 @@ const ContactListTable = ({ contacts, deleteContact }) => {
const contactsCopy = [...contacts];
const sortedContacts = contactsCopy.sort(comparePerson);
Copy link
Member

Choose a reason for hiding this comment

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

With the new data grid, is a custom sorting function still necessary? Unless I'm mistaken, it should be possible to use initialState in DataGrid for the same results.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could certainly drop the custom sort and leave it as an initial state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got the custom sort dropped for sorting from initialState

const columnTitlesArray = [
{
field: 'First Name',
width: 120,
Copy link
Member

Choose a reason for hiding this comment

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

Could we possibly expand the table a bit when in desktop views? The quickest way would be by widening the columns.

I know there isn't a ton of data to display at the moment, but it'd help to use up some of all the empty space. Plus, in case anyone has a longer name, it'd prevent that from being cut off.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would like to keep the minimum width of the overall grid to 300px for mobile, but I'll play around with the column widths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made text columns flexible. If we get more columns included in between them in the future, we could make them flexible as well.

Screen.Recording.2023-10-22.at.22.27.06.mov

field: 'actions',
type: 'actions',
width: 70,
getActions: (contactData) => [
Copy link
Member

@andycwilliams andycwilliams Oct 23, 2023

Choose a reason for hiding this comment

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

Although it's not essential, I think it'd be nicer to have a title for the delete column. If only because it's a bit odd to have one nameless column. The same kind of column in the documents is named, so this'd make it more consistent.

Adding headerName: 'Delete', here would accomplish this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add one. I'll expand the width of this too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got this included.

@leekahung
Copy link
Contributor Author

leekahung commented Oct 23, 2023

Curious, is the grid also intended to be implemented with the documents table?

Yeah, I think the grid would work well for the document list as well. Think we could have an issue created for that.

@xscottxbrownx
Copy link
Contributor

Issue with rendering size on skinny mobile devices (like Galaxy Fold and similar), but not too worried about for MVP.

@leekahung
Copy link
Contributor Author

Issue with rendering size on skinny mobile devices (like Galaxy Fold and similar), but not too worried about for MVP.

Yeah, I believe those screen sizes are at around 280px width? At an earlier discussion, I believe we've talked about limiting the lower screen limit to about 300px. Think I could adjust it to make it fit the smaller size using vw for the width size on the box surrounding the grid.

Screen.Recording.2023-10-23.at.12.35.01.mov

Copy link
Member

@andycwilliams andycwilliams left a comment

Choose a reason for hiding this comment

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

Looking better. There's a plan to add at least one more column (an icon button to allow for direct messaging), so that will help fill out the table.

I'm seeing some large gaps between the navbar and table (see screenshot) when using larger viewports. Looks to be caused by justifyContent: 'center' on line 58 in Contacts.jsx

Capture

Is this the desired effect? It might be nicer to have it consistent on all viewports and make the table always close to the navbar. Just want to be sure.

I'd really like to hear from case workers about how small the screens they actually use are. It may not even be an issue to set a 300px limit. But it may take time to get feedback.

@leekahung
Copy link
Contributor Author

leekahung commented Oct 24, 2023

I'm seeing some large gaps between the navbar and table (see screenshot) when using larger viewports. Looks to be caused by justifyContent: 'center' on line 58 in Contacts.jsx

I could certainly pull the Data Grid back up closer the the Navbar without the justifyContent. I'll also make the grid use a set height to fill out the the spacing in the "Contacts" page. It would not affect the mobile view.

Screen.Recording.2023-10-23.at.17.33.35.mov

I'd really like to hear from case workers about how small the screens they actually use are. It may not even be an issue to set a 300px limit. But it may take time to get feedback.

With regards to the mobile width limit, what we're making here should be quite flexible down to 280px and lower, so I don't think we need to worry about that point now. (As you can see below, the grid content stretches out to 380px, but the grid itself can remain small (around ~210px in the example clip) thanks to the horizontal scrolling implemented with the grid.)

Screen.Recording.2023-10-23.at.17.37.52.mov

@leekahung
Copy link
Contributor Author

I believe the changes here are now adequate?

@leekahung leekahung merged commit 1d1581c into Development Oct 26, 2023
3 checks passed
@leekahung leekahung deleted the add-mui-data-grid branch October 26, 2023 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Update Contacts View to display Contact Cards instead of Table
5 participants