-
-
Notifications
You must be signed in to change notification settings - Fork 10
[Review Entries] Refactor table with material-react-table
#2881
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
Conversation
This comment has been minimized.
This comment has been minimized.
|
Consider if we can or want to use i18next getResource here just to keep our localizations all in one place and usable by crowdin. |
imnasnainaec
left a comment
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.
Reviewable status: 0 of 86 files reviewed, all discussions resolved (waiting on @jasonleenaylor)
src/goals/ReviewEntries/ReviewEntriesTable/index.tsx line 36 at r4 (raw file):
Previously, jasonleenaylor (Jason Naylor) wrote…
Consider if we can or want to use i18next getResource here just to keep our localizations all in one place and usable by crowdin.
The way material-react-table uses localization data (e.g., https://github.com/KevinVandy/material-react-table/blob/v2/packages/material-react-table/src/components/menus/MRT_RowActionMenu.tsx#L62), it seems that if we did load their localizations into i18n, we'd then have to extract them from i18n to manually feed into the table's localization prop.
jasonleenaylor
left a comment
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.
Reviewed 56 of 85 files at r1, 15 of 22 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: 71 of 86 files reviewed, all discussions resolved (waiting on @imnasnainaec)
src/goals/ReviewEntries/ReviewEntriesTable/Cells/EditCell/EditDialog.tsx line 135 at r4 (raw file):
const [showSenses, setShowSenses] = useState(true); useEffect(() => {
There are some pros and cons to doing this here, I think I like it though. The con is a possible delay between the user change and the state updating, make sure there is no race condition on a keyboard change and accept.
|
Previously, imnasnainaec (D. Ror.) wrote…
Yes, that is what I was seeing as well. It seems that what you have here is probably the cleanest choice. |
|
I'm not sure I like the multiple return type approach. There are probably others. The current choice has us checking conditions twice, checking the state to choose a return type and checking the return type to determine the action. |
jasonleenaylor
left a comment
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.
Reviewed 7 of 85 files at r1, 7 of 22 files at r2, 1 of 1 files at r4.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @imnasnainaec)
src/goals/ReviewEntries/ReviewEntriesTable/Cells/EditCell/index.tsx line 10 at r4 (raw file):
const buttonId = (wordId: string): string => `row-${wordId}-edit`; export default function DeleteCell(props: CellProps): ReactElement {
So, DeleteCell returns an Edit cell...
imnasnainaec
left a comment
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.
Reviewable status: 85 of 86 files reviewed, 2 unresolved discussions (waiting on @jasonleenaylor)
src/goals/ReviewEntries/ReviewEntriesTable/Cells/EditCell/EditSenseDialog.tsx line 143 at r4 (raw file):
Previously, jasonleenaylor (Jason Naylor) wrote…
I'm not sure I like the multiple return type approach.
Another option is to have cleanSense take two functions, one to execute on error and one to execute on success.There are probably others. The current choice has us checking conditions twice, checking the state to choose a return type and checking the return type to determine the action.
This logic was carried over from the old functions, but I'll look into updating it.
src/goals/ReviewEntries/ReviewEntriesTable/Cells/EditCell/index.tsx line 10 at r4 (raw file):
Previously, jasonleenaylor (Jason Naylor) wrote…
So, DeleteCell returns an Edit cell...
Done.
imnasnainaec
left a comment
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.
Reviewable status: 85 of 86 files reviewed, 2 unresolved discussions (waiting on @jasonleenaylor)
src/goals/ReviewEntries/ReviewEntriesTable/Cells/EditCell/EditDialog.tsx line 135 at r4 (raw file):
Previously, jasonleenaylor (Jason Naylor) wrote…
There are some pros and cons to doing this here, I think I like it though. The con is a possible delay between the user change and the state updating, make sure there is no race condition on a keyboard change and accept.
Oh, good consideration! To accept changes with the keyboard, one has to tab to the check button and then press Enter. With no async updates in this dialog, I don't see keyboard race conditions as an issue.
jasonleenaylor
left a comment
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.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec)
src/goals/ReviewEntries/ReviewEntriesTable/Cells/EditCell/EditSenseDialog.tsx line 143 at r4 (raw file):
Previously, imnasnainaec (D. Ror.) wrote…
This logic was carried over from the old functions, but I'll look into updating it.
This can be handled in a follow up PR since it was pre-existing code.
Resolves #2875
Requires #2876
This change is