Skip to content

feat: Paginated Tables for Resource List Views#602

Merged
maxgurewitz merged 25 commits intodittofeed:mainfrom
Wr4th100:Wr4th100/paginated-tables
Mar 6, 2024
Merged

feat: Paginated Tables for Resource List Views#602
maxgurewitz merged 25 commits intodittofeed:mainfrom
Wr4th100:Wr4th100/paginated-tables

Conversation

@Wr4th100
Copy link
Copy Markdown
Contributor

Added 5 Paginated Tables.

Fixes #583
/claim #583

@Wr4th100
Copy link
Copy Markdown
Contributor Author

Wr4th100 commented Jan 23, 2024

Hi!
I still have some issues regarding how to get and display "Journeys Used By" and "Last Re-Computed" in the tables. I request some clarification that would help me correct it!

@maxgurewitz
Copy link
Copy Markdown
Member

Hi @Wr4th100! Congrats on the PR! Excited to start digging into it.

Hi!
I still have some issues regarding how to get and display "Journeys Used By" and "Last Re-Computed" in the tables. I request some clarification that would help me correct it!

  • Last Re-Computed: check the ComputedPropertyPeriod table, where the segment, or user property id is equal to the computedPropertyId.
  • Journeys Used By: get all Journey definitions, then iterate through the nodes, finding MessageNode's and checking their templateId values.

@Wr4th100
Copy link
Copy Markdown
Contributor Author

Hi @maxgurewitz! I have made the respective changes. Please have a look.

@maxgurewitz
Copy link
Copy Markdown
Member

@Wr4th100 looking!

Comment thread packages/backend-lib/src/messageTemplates.ts Outdated
Comment thread packages/dashboard/src/components/broadcastsTable.tsx Outdated
Comment thread packages/dashboard/src/components/resourceList.tsx Outdated
Comment thread packages/dashboard/src/components/broadcastsTable.tsx Outdated
Comment thread packages/dashboard/src/components/journeysTable.tsx Outdated
Comment thread packages/dashboard/src/pages/segments/index.page.tsx Outdated
Comment thread packages/dashboard/src/pages/segments/index.page.tsx
@Wr4th100
Copy link
Copy Markdown
Contributor Author

I have made the requested changes @maxgurewitz, please have a look!

@maxgurewitz
Copy link
Copy Markdown
Member

@Wr4th100 looking!

Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz left a comment

Choose a reason for hiding this comment

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

Can you fix linting by running yarn workspace dashboard lint --fix and yarn workspace backend-lib lint --fix.

@Wr4th100
Copy link
Copy Markdown
Contributor Author

Can you fix linting by running yarn workspace dashboard lint --fix and yarn workspace backend-lib lint --fix.

Yeah sure, done!

@Wr4th100 Wr4th100 requested a review from maxgurewitz January 29, 2024 12:22
Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz left a comment

Choose a reason for hiding this comment

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

Borders

Apologies for the late response! It looks like several of the paginated tables have black borders, but the templates do not. I prefer the look of the table without those borders, if you could please remove them!

Screen Shot 2024-02-01 at 2 26 04 PM Screen Shot 2024-02-01 at 2 26 14 PM Screen Shot 2024-02-01 at 2 26 29 PM

Table Row Count

Can you make use of the autoPageSize option to ensure that the table expands to full height of the page?

https://mui.com/x/react-data-grid/pagination/#automatic-page-size

Recording Reminder

Finally, a reminder to post a screen recording of the tables' UX! Thank you!

Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz left a comment

Choose a reason for hiding this comment

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

A few more requested changes!

Comment thread packages/dashboard/src/components/journeysTable.tsx
Comment thread packages/dashboard/src/components/journeysTable.tsx Outdated
Comment thread packages/dashboard/src/components/segmentsTable.tsx
Comment thread packages/dashboard/src/components/templatesTable.tsx
Comment thread packages/dashboard/src/components/userPropertiesTable.tsx Outdated
@Wr4th100
Copy link
Copy Markdown
Contributor Author

Wr4th100 commented Feb 3, 2024

I prefer the look of the table without those borders, if you could please remove them!

Yeah sure!

Can you make use of the autoPageSize option to ensure that the table expands to full height of the page?

I have tried this, but it results in this error.
WhatsApp Image 2024-02-03 at 12 00 19_b50360a7
So worked it out by just removing the maxHeight property. The table automatically resizes to screen size.

Also, should I make the tables expand up to the screen width?

@Wr4th100
Copy link
Copy Markdown
Contributor Author

Wr4th100 commented Feb 3, 2024

I have made the requested changes. Please have a look!

Also, the video for the tables' UX:

DittofeedVid.mp4

Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz left a comment

Choose a reason for hiding this comment

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

@Wr4th100

So worked it out by just removing the maxHeight property. The table automatically resizes to screen size.

To clarify, the goal is to have the number of rows also adjust to fit the screen size so if the screen is larger, more rows are rendered. However, looking at timestamp 1:04 of your recording above, I see that the page size is 5, despite there being 9 results, and room to show more.

Also, should I make the tables expand up to the screen width?

Yes please!

Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz left a comment

Choose a reason for hiding this comment

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

Hi @Wr4th100 a few more changes are required.

key={journey}
onClick={(e) => {
e.stopPropagation();
router.push({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few things need here:

  1. Rather than a button that uses the router to navigate, can you use a nextjs link?
  2. Can you style the link so that it has max character limit for journeys with long names, with a "..." appended to the end, and wrapped in a <Tooltip> with the full name.
  3. Can you style the link so that it has a light grey background color, so that it's clearly distinguishable from neighboring links?

This feedback is applicable to the other page's related resources columns as well.

Comment thread packages/dashboard/src/pages/segments/index.page.tsx Outdated
Comment thread packages/dashboard/src/pages/segments/index.page.tsx Outdated
Comment thread packages/dashboard/src/pages/templates/index.page.tsx Outdated
Comment thread packages/dashboard/src/pages/templates/index.page.tsx Outdated
Comment thread packages/dashboard/src/components/userPropertiesTable.tsx Outdated
@Wr4th100
Copy link
Copy Markdown
Contributor Author

Wr4th100 commented Feb 8, 2024

Apologies for the late updates. I have made the required changes. Please have a look!

Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz left a comment

Choose a reason for hiding this comment

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

Some questions.

Comment thread packages/dashboard/src/components/userPropertiesTable.tsx Outdated
Comment thread packages/isomorphic-lib/src/types.ts Outdated
@maxgurewitz
Copy link
Copy Markdown
Member

Hi apologies @Wr4th100 I totally missed that you had made additional changes, will re-review today!

Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz left a comment

Choose a reason for hiding this comment

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

@Wr4th100
Copy link
Copy Markdown
Contributor Author

@Wr4th100 here's a video recording with some additional feedback.

https://www.loom.com/share/0f63abbb8dd04c34af1cbfad7709e271?sid=5948fa65-faf8-4b35-bc25-3e8ac1bf384a

Sorry went offline for a few days, will be looking into it!

@maxgurewitz
Copy link
Copy Markdown
Member

@Wr4th100 this is rising in priority, if you're not able to work on this, I'm going to have to ask someone else to take it over!

@Wr4th100
Copy link
Copy Markdown
Contributor Author

@Wr4th100 this is rising in priority, if you're not able to work on this, I'm going to have to ask someone else to take it over!

Apologies @maxgurewitz, I have had some health issues in the past few weeks.

I have made the required changes but there are some few issues...

Regarding that table scroll, autoPageSize does not work correctly when the rows have variable height. This has been highlighted in the issue mui/mui-x#5697.

So, I have changed the "Used By" columns to dropdowns which displays the templates/journeys concisely.

DrppDownVideo.mp4

Please let me know if this is ok. If not, I would love to have some guidance on how to use that old UI itself.

@maxgurewitz
Copy link
Copy Markdown
Member

Apologies @maxgurewitz, I have had some health issues in the past few weeks.

I'm sorry to hear that! Please let me know if there's anything I can do to help.

So, I have changed the "Used By" columns to dropdowns which displays the templates/journeys concisely.

Great idea! I love it.

Looks like you still have some linting errors here. Beyond that, I will try to give a full re-review by EOD!

Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz left a comment

Choose a reason for hiding this comment

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

A few comments! Also linting is failing to the open-api check. If you merge main back in, they should be fixed!

}}
getRowId={(row) => row.id}
onRowClick={(params) => {
router.push({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use <Link>'s here instead of router.push!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is no direct way to wrap the entire row inside a <Link> tag. I would need to put the Link tag in every cell's renderCell property. Is that the right way to do it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hey @Wr4th100 yah, you can put it inside of the renderCell of the baseColumn. apologies for not responding sooner. I missed this comment!

}}
getRowId={(row) => row.id}
onRowClick={(params) => {
router.push({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

<Link>

}}
getRowId={(row) => row.id}
onRowClick={(params) => {
router.push({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use <Link/> instead of router.push

}}
getRowId={(row) => row.id}
onRowClick={(params) => {
router.push({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use <Link> instead of router.push

}}
getRowId={(row) => row.id}
onRowClick={(params) => {
router.push({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use <Link/> instead of router.push.

sx={{
height: "100%",
width: "100%",
".MuiDataGrid-row:first-child": {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You seem to be re-using the same styles over and over. Can you deduplicate this code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok sure, shall I use this code to override the theme for DataGrid in themeCustomization?

Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz Mar 1, 2024

Choose a reason for hiding this comment

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

How about you just export a value from a shared components/resourceTable.tsx file

const RESOURCE_TABLE_STYLE: SxProps<Theme> = {
...
}

and then use it

<DataGrid sx={{...RESOURCE_TABLE_STYLE, myStyle1: 1 }} >

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok sure, will do it!

@maxgurewitz
Copy link
Copy Markdown
Member

Other than small fixes requested, looks amazing! Just ran it locally on my machine and its working great! Thanks for your patience @Wr4th100

@Wr4th100
Copy link
Copy Markdown
Contributor Author

Wr4th100 commented Mar 5, 2024

@maxgurewitz I have made the changes. Please have a look!

@maxgurewitz
Copy link
Copy Markdown
Member

@Wr4th100 looking!

Copy link
Copy Markdown
Member

@maxgurewitz maxgurewitz left a comment

Choose a reason for hiding this comment

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

Amazing looks good to me!

Please fix the api test error and it's ready to merge!

https://docs.dittofeed.com/contributing/updating-api-docs

@Wr4th100
Copy link
Copy Markdown
Contributor Author

Wr4th100 commented Mar 6, 2024

Amazing looks good to me!

Please fix the api test error and it's ready to merge!

https://docs.dittofeed.com/contributing/updating-api-docs

Done. Please have a look!

@maxgurewitz maxgurewitz merged commit d05ba15 into dittofeed:main Mar 6, 2024
@maxgurewitz
Copy link
Copy Markdown
Member

/tip $50

@algora-pbc
Copy link
Copy Markdown

algora-pbc bot commented Mar 6, 2024

@algora-pbc
Copy link
Copy Markdown

algora-pbc bot commented Mar 6, 2024

🎉🎈 @Wr4th100 has been awarded $50! 🎈🎊

@maxgurewitz
Copy link
Copy Markdown
Member

@Wr4th100 you should join our discord, I'd like to give you a shoutout!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DF-415] create paginated table for resource list views

2 participants