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

[MPDX-7853] Add contact details designation account column #871

Merged
merged 12 commits into from
Apr 30, 2024

Conversation

canac
Copy link
Contributor

@canac canac commented Feb 12, 2024

Description

  • Reuse the donation table from the reports page in the contact donations tab.
  • Make the donation table remember which columns have been hidden by the user (to hide/show columns, hover over a header column, click the triple dots, then click Show columns).

https://jira.cru.org/browse/MPDX-7853

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels. (Add the label "On Staging" to get the branch automatically merged into staging.)
  • I have requested a review from another person on the project

@canac canac added the On Staging Will be merged to the staging branch by Github Actions label Feb 12, 2024
@canac canac requested a review from dr-bizz February 12, 2024 15:56
@@ -29,30 +29,20 @@ export const ContactHeaderPartnerSection: React.FC<Props> = ({
<TextSkeleton variant="text" />
</ContactHeaderSection>
);
} else {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No functionality is changed here, I just reduced some nesting and removed the unnecessary <Fragment> and <span>.

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-871.d3dytjb8adxkk5.amplifyapp.com

@canac canac removed the request for review from dr-bizz February 13, 2024 01:25
@canac
Copy link
Contributor Author

canac commented Feb 13, 2024

@dr-bizz You can hold off on reviewing this. Scott wants the visibility of this column to be user-configurable instead of automatic.

@canac canac force-pushed the 7853-designation-column branch from 6dd838a to 1d5f7d6 Compare February 16, 2024 21:25
@canac
Copy link
Contributor Author

canac commented Feb 16, 2024

@caleballdrin @dr-bizz Let me know if you have any UX suggestions. One thing I noticed is that it's hard to get the totals columns to line up with the data grid columns when the user hides columns. I added explicit Amount and Foreign Amount columns just in case they don't line up so that it's still obvious what the totals numbers are. I think it's an overall improvement though because the old version didn't show the totals at all.

Also, I cherry-picked the commit that adds support for expect.toHaveGqlOperation() so that I could use it here, but I'll rebase it out if #868 lands before this.

src/theme.ts Show resolved Hide resolved
@canac canac force-pushed the 7853-designation-column branch 3 times, most recently from 3b33149 to 795cac0 Compare February 19, 2024 14:34
@wrandall22
Copy link
Contributor

@j2trumpet might also have UX suggestions

@canac canac requested a review from j2trumpet February 19, 2024 21:46
@dr-bizz
Copy link
Contributor

dr-bizz commented Feb 20, 2024

One thing I spotted when testing is that, the columns are too close together and cause the UX not to be as good. Also the column popup is cut off by the screen.
Screenshot 2024-02-20 at 3 10 13 PM

@dr-bizz
Copy link
Contributor

dr-bizz commented Feb 20, 2024

Also when viewing it on responsive at 700px, I would make the donation table be full-width of the drawer.
Screenshot 2024-02-20 at 3 12 41 PM

Copy link
Contributor

@dr-bizz dr-bizz 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 on this! This is 95% done, just some finishing touches to make it look better.

package.json Show resolved Hide resolved
src/theme.ts Show resolved Hide resolved

export const useLocalStorage = <T>(
key: string,
initialValue: T,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the initialValue be optional? or default to undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

initialValue provides the value if the item is not currently saved in localStorage. If you want the initialValue to be undefined, I would think you would make that explicit with useLocalStorage<Value | undefined>('key', undefined).

Right now, there is only one place that uses useLocalStorage. Are you OK with considering making initialValue optional if/when we have a need for that in the app? I'd rather not make this hook support use cases that we aren't using right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be stored in the database so that if people log in on different computers their configuration remains?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@caleballdrin Ultimately, probably so. Adding a new preference will require a server-side change. I was trying to get an MVP working that I could get feedback on from Scott.

__tests__/extensions/toHaveGraphqlOperation.ts Outdated Show resolved Hide resolved
@canac
Copy link
Contributor Author

canac commented Feb 20, 2024

One thing I spotted when testing is that, the columns are too close together and cause the UX not to be as good.

Yeah, that's the problem. Most people don't need all the columns, but a few people are asking for all the original columns, which is more than fits on smaller screens. I'm honestly not sure how to satisfy both constraints.

Also the column popup is cut off by the screen.

Can you scroll to show the rest of it? I was able to.

Copy link
Contributor

@j2trumpet j2trumpet left a comment

Choose a reason for hiding this comment

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

I haven't touched MPDX for a while, so I'm not sure what the exact requirements or scope are for this ticket, but a few things stood out to me.

This is a little nit-picky, but when you hover over a column header, the sorting arrow fades in but the three dots pop in immediately. Could those be synced?

Do we really need the "hide column" functionality in both the column header dropdown and through the "Show columns" menu toggles? I feel like we could get rid of the "Hide" menu option and run everything through "Show columns" which I might rename to "Manage columns".

After opening a column header menu, should the three dots close the menu on a second click?

I thought date sorting wasn't working, but then I noticed that every entry on the report I'm looking at was logged on the same date.

The gray tone difference for the sorting arrow is so minimal between descending and unsorted that I didn't realize what was happening. It looked like there were two different sorts that showed an up arrow. Maybe we could find a more obvious difference for the states?

@j2trumpet
Copy link
Contributor

To the concern about not having enough horizontal room for all the columns, maybe we could add a note somewhere that says "Not seeing all your data columns? Double check that the desired column is set to show or try scrolling/swiping right."

@canac
Copy link
Contributor Author

canac commented Feb 20, 2024

@dr-bizz What do you think about setting a minimum width on all of the columns to keep them from getting too small and then if there isn't enough space, they will just have to scroll horizontally to view all the columns?

@canac
Copy link
Contributor Author

canac commented Feb 20, 2024

@j2trumpet All of the header functionality is provided by MUI X Data Grid.

This is a little nit-picky, but when you hover over a column header, the sorting arrow fades in but the three dots pop in immediately. Could those be synced?

I believe this is possible.

Do we really need the "hide column" functionality in both the column header dropdown and through the "Show columns" menu toggles? I feel like we could get rid of the "Hide" menu option and run everything through "Show columns" which I might rename to "Manage columns".

I believe that removing the "Hide" menu option will require upgrading to MUI X v6.

After opening a column header menu, should the three dots close the menu on a second click?

I don't think that this is configurable.

The gray tone difference for the sorting arrow is so minimal between descending and unsorted that I didn't realize what was happening. It looked like there were two different sorts that showed an up arrow. Maybe we could find a more obvious difference for the states?

That's a valid point, at least if applying a sort order doesn't change the order of the items much. I believe the arrow can be styled. What kind of a different state would you recommend?

Copy link
Contributor

@j2trumpet j2trumpet left a comment

Choose a reason for hiding this comment

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

I'm approving this because none of my thoughts are deal-breaking for approval.

@dr-bizz
Copy link
Contributor

dr-bizz commented Mar 14, 2024

@dr-bizz What do you think about setting a minimum width on all of the columns to keep them from getting too small and then if there isn't enough space, they will just have to scroll horizontally to view all the columns?

I think that's a good idea.

@canac canac removed the On Staging Will be merged to the staging branch by Github Actions label Mar 15, 2024
@canac canac force-pushed the 7853-designation-column branch from 795cac0 to 165f309 Compare March 15, 2024 17:22
@@ -115,7 +115,7 @@ export const SidePanelsLayout: FC<SidePanelsLayoutProps> = ({
headerHeight = '0px',
}) => {
const isMobile = useMediaQuery((theme: Theme) =>
theme.breakpoints.down('sm'),
theme.breakpoints.down('md'),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This breakpoint made the detail pretty small on small screens, like ones around 700px. I increased the breakpoint to hide the list and just show the panel on those small screens.

@canac
Copy link
Contributor Author

canac commented Mar 15, 2024

@dr-bizz I finally got around to updating this based on your feedback.

@canac canac requested a review from dr-bizz March 15, 2024 17:28
Copy link
Contributor

@dr-bizz dr-bizz left a comment

Choose a reason for hiding this comment

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

I spotted some issues (donations flashing onLoad), but overall it looked good.

What is the need for the MUI patch?

@canac
Copy link
Contributor Author

canac commented Mar 19, 2024

What is the need for the MUI patch?

@dr-bizz By default, the data grid preferences popup opens down, which causes the weird scrolling and clipping issues I believe you were seeing when you said "Also the column popup is cut off by the screen." I couldn't find a way to fix it because of how our layout is designed, so I patched MUI to open the popup up instead.

@canac canac requested a review from dr-bizz March 19, 2024 21:24
Copy link
Contributor

@dr-bizz dr-bizz left a comment

Choose a reason for hiding this comment

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

I left one comment, but it's looking good so I'm approving it

@canac canac added the Preview Environment Add this label to create an Amplify Preview label Apr 26, 2024
Copy link
Contributor

github-actions bot commented Apr 26, 2024

Bundle sizes [mpdx-react]

Compared against aad2df0

Dynamic import Size (gzipped) Diff
../src/components/Contacts/ContactDetails/ContactDonationsTab/DynamicContactDonationsTab.tsx -> ./ContactDonationsTab 181.95 KB +80.07 KB

@canac canac force-pushed the 7853-designation-column branch from 2bdfa98 to ebcba43 Compare April 30, 2024 19:43
@canac canac merged commit 427565b into main Apr 30, 2024
18 checks passed
@canac canac deleted the 7853-designation-column branch April 30, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Preview Environment Add this label to create an Amplify Preview
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants