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

Use tanstack table for Competitors #10778

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kr-matthews
Copy link
Contributor

See slack discussion about my concerns.

@kr-matthews kr-matthews requested a review from gregorbg February 6, 2025 05:12
@kr-matthews kr-matthews self-assigned this Feb 6, 2025
Copy link
Member

@gregorbg gregorbg left a 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.

Comment on lines +30 to +32
) : (
info.getValue()
),
Copy link
Member

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 },
Copy link
Member

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,
Copy link
Member

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

Comment on lines +60 to +63
const { countryCount } = getTotals(
info.table.getCoreRowModel().rows.map((row) => row.original),
eventIds,
);
Copy link
Member

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,
Copy link
Member

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 => (
Copy link
Member

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 ? (
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants