-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix: Issues with actions table pagination and refactor table component #3935
Conversation
53ad3b6
to
4dc09b0
Compare
4dc09b0
to
0f8a145
Compare
Fix tables page size issue and refactor table component
0f8a145
to
db380ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mmioana really great work on this one! I've half reviewed it, and I remember looking at it when it was in draft mode and you had some questions about it, so I roughly already know what the code is like. I'll do a full review soon, but wanted to first point out an issue that I'm seeing on mobile. It's a problem with the table overflowing the screen when I scroll down (making an advanced payment), it's easiest to just take a look at the video :)
Screen.Recording.2025-01-06.at.13.58.32.mov
On desktop everything is looking great though! 👏
@@ -23,13 +24,20 @@ const RecentActivityTable: FC<ColonyActionsTableProps> = ({ | |||
domainId: nativeDomainId, | |||
}); | |||
|
|||
const pageCount = Math.ceil(totalActions / (props.pageSize ?? 10)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this is such a small little tidy up thing, and it has no right to make me as happy as it does, but it's these tiny type of things that just add up over time to make a wayyyy more readable and clean codebase 🧹
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just finished reviewing the code. Looking really good, and I think it's a lot easier to read and simpler to use / reuse. It is still quite a complicated table but I think that's unavoidable at the moment! You've done a really nice job with it, wasn't a fun refactor I'm sure 👍
Still just keeping this review as request changes
purely because of the errors I found while testing (in my last review) but code-wise it's all good. The comments I've made in the code are super minor. Nice one! 🎉
}} | ||
layout={isMobile ? 'vertical' : 'horizontal'} | ||
// sizeUnit={isMobile ? undefined : '%'} | ||
// meatBallMenuSize={isMobile ? undefined : 10} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover comments?
@@ -113,11 +129,11 @@ export const useArbitraryTxsTableColumns = ({ | |||
} | |||
return <CellDescription data={data} />; | |||
}, | |||
size: isMobile ? 100 : 67, | |||
staticSize: isMobile ? '100px' : '67%', | |||
}), | |||
], | |||
[columnHelper, isMobile, openTransactionModal, isError], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to fix this dependency array warning while we're here! 😄
pageSize?: number; // Number of rows per page | ||
canNextPage?: boolean; // Enable "next page" | ||
canPreviousPage?: boolean; // Enable "previous page" | ||
onPageChange?: (direction: PaginationDirection) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being pedantic, but ideally onPageChange
should also have a comment if all the other properties do 😆
export interface BaseTableProps<T> extends BaseTableOptions<T> { | ||
table: Table<T>; // React Table instance | ||
rows?: TableRowOptions<T>; // Row-specific options | ||
moreActions?: MoreActionsOptions<T>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, a comment would be nice for moreActions
just to keep it consistent
Fix: Virtualised row overflowing
Chore: Changes after review
@davecreaser I have fixed the bug with the overflowing rows, which was reproducible also on master. It was caused by the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, the issue is fixed! Thanks for the code changes too. 🎉
Screen.Recording.2025-01-06.at.16.54.35.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sheeeeeeesh now this is a lot of changes, legit stuff 💪
Props for untangling all the props, it's a major step in the right direction, but sadly the lib itself isn't that JSX friendly, so we gotta rely on a ton of JSX in hooks, but hey, can't have everything 🤷
I love the overrides approach, and overall the table now seems more sane to use, even if it's still quite complicated due to all the different variations 🔥
I've tried the meatball menu actions too, but I'm not gonna drop 1 GB of videos onto this review :D
Manage tokens ✔️
Advanced payments ✔️
WITH 400 ROWS 😎
(we really should fix this to not take ages to load :D )
Split payments ⚠️
On mobile, the total number overlaps the Total
text
Manage reputation ✔️
This one doesn't even need to be a table, but we can might as well use the styles it provides 🤷
Manage permissions ✔️
Edit colony details ✔️
Manage verified members ✔️
From this point onwards I'll just drop some weird bits so I don't spam this too much
src/components/v5/common/ActionSidebar/partials/BatchPaymentsTable/BatchPaymentsTable.tsx
Show resolved
Hide resolved
Fix: Update colSpan for split payments table
@bassgeta I fixed the And regarding the pagination bug, I didn't manage to reproduce it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome awesome updates @mmioana ! 🙌
Found some tiny UI issues here and there but Ioana will deal with them separately 🔧
Merge it!!!
Description
This PR started off by addressing the broken pagination shown on the tables from the
Manage verified members
andManage tokens
actions and ended with a big refactoring of theTable
component for a better separation of concerns in the supported table features/layouts etc.Testing
TODO: Unfortunately for a throughout testing we'll have to go thorough all the tables we have in our app.
However, before we do this, let's check the issues for the
Manage verified members
andManage tokens
actions were solved.Manage tokens
node scripts/create-data.js --timeout 100 --coloniesCount 12
Manage tokens
actionScreen.Recording.2024-12-19.at.17.41.44.mov
Manage verified members
Manage verified members
actionAdd members
- this is needed only for having a higher number of rows in the tableScreen.Recording.2024-12-19.at.17.44.14.mov
Important
Ok, now let's move to the remaining actions that include tables.
I will kindly ask you to check both desktop and mobile screen sizes.
Also for each action, please complete the action and check the table on the completed action sidebar
Advanced payments action
Split payment action
Staged payments action
First enable the extension here http://localhost:9091/planex/extensions/StagedExpenditure
Manage reputation
Manage permissions
Edit colony details - the social links table
Arbitrary transactions
In order to test with a locally deployed contract, please add at
line 21
insrc/components/v5/common/ActionSidebar/partials/forms/ArbitraryTxsForm/partials/AddTransactionModal/useGenerateABI.ts
return;
Add a new transaction using the following values
Contract address:
0xeF841fe1611ce41bFCf0265097EFaf50486F5111
ABI/JSON:
And select any method - probably
mint(uint256)
it's the simplestEnter a value for the method parameters, confirm the modal and check the table
Important
Now on to the other pages having tables.
I will kindly ask you to check both desktop and mobile screen sizes.
Dashboard
Go to http://localhost:9091/planex
Activity
Go to http://localhost:9091/planex/activity
Balances
Go to http://localhost:9091/planex/balances
Incoming
Go to http://localhost:9091/planex/incoming
Verified members
Go to http://localhost:9091/planex/verified
Crypto to fiat
Go to http://localhost:9091/account/crypto-to-fiat
Given we don't actually have data to test the table, please add the following at
line 47
insrc/components/frame/v5/pages/UserCryptoToFiatPage/partials/FiatTransfersTable/FiatTransfersTable.tsx
That's hopefully all folks ✨ but please let your creativity loose when testing these changes 🦾
Diffs
Changes 🏗
Table
componentResolves #3404
Resolves #3467