-
Notifications
You must be signed in to change notification settings - Fork 187
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
Use tanstack table for Competitors #10778
base: main
Are you sure you want to change the base?
Use tanstack table for Competitors #10778
Conversation
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, I see your point much more clearly now. The configuration is indeed cumbersome, and especially in terms of footer counts the setup is much more complicated than I anticipated.
I'll leave it up to you whether you want to use it and merge this PR or if you prefer to discard it.
) : ( | ||
info.getValue() | ||
), |
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.
I don't get this with regards to the ternary condition. If getValue
is truthy, you return an <a>
link, but if it's falsey you just return... that falsey value explicitly? Why not just info.getValue() && (<a>)
?
} ${ | ||
I18n.t( | ||
'registrations.registration_info_people.person', | ||
{ count: info.table.getCoreRowModel().rows.length }, |
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.
You can just pass registrationCount
here.
{ | ||
id: 'country', | ||
header: I18n.t('activerecord.attributes.user.country_iso2'), | ||
accessorFn: (row) => countries.byIso2[row.user.country.iso2].name, |
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.
Clever, I think I should copy that in my Records PR :D
const { countryCount } = getTotals( | ||
info.table.getCoreRowModel().rows.map((row) => row.original), | ||
eventIds, | ||
); |
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.
Hm, this is indeed quite unintuitive.
} | ||
}, | ||
...eventIds.map((id) => ({ | ||
id, |
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.
Maybe something like event-${id}
?
<Table.Footer> | ||
{table.getFooterGroups().map(footerGroup => ( | ||
<Table.Row key={footerGroup.id}> | ||
{footerGroup.headers.map(header => ( |
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.
Do they really call this footerGroup.headers
?!
))} | ||
</Table.Header> | ||
<Table.Body> | ||
{table.getSortedRowModel().rows.length > 0 ? ( |
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.
Can you return early if no columns are found?
See slack discussion about my concerns.