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

Migrate Records Page to React #10623

Open
wants to merge 76 commits into
base: main
Choose a base branch
from
Open

Conversation

FinnIckler
Copy link
Member

@FinnIckler FinnIckler commented Jan 14, 2025

Still need to do some of the other table types, but it's very similar to the rankings page
image

@FinnIckler
Copy link
Member Author

image
Here is the slim Table (events are currently not links because the URL is in the other PR)

@FinnIckler
Copy link
Member Author

image
Separate View

@FinnIckler
Copy link
Member Author

Added mixed history and history
image
image

This means this is now feature complete, but there is definitely possibilities of refactors as there is a lot of code reuse

@FinnIckler
Copy link
Member Author

Did a lot of refactoring to reduce code reuse

<Button.Group id="state" size="small" compact primary>
<Button.Group id="state" size="large" primary>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intentional? It's unrelated to the records page.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a change that Gregor did in the other PR and it affects the styling of the filter box. I will remove it when the other PR is merged

Copy link
Member

Choose a reason for hiding this comment

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

I did? 😇 Please point me in the right direction, or at least explain when you want to undo it

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this file should have any changes at this point?

app/webpacker/components/wca/EventSelector.jsx Outdated Show resolved Hide resolved
app/webpacker/components/Results/Records/index.jsx Outdated Show resolved Hide resolved
app/webpacker/components/Results/Records/index.jsx Outdated Show resolved Hide resolved
import { Table } from 'semantic-ui-react';
import I18n from '../../lib/i18n';

const headerConfig = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Slightly confused why there are 4 configs and 4 header components but 5 'show categories'. Probably mixed-history re-uses either mixed or history, but it's not immediate to trace down.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, history and mixed history have the same headers, just with one more column for events so it has the conditional rendering

Copy link
Member

Choose a reason for hiding this comment

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

Chiming in to note that I'd be happy to see a short comment explaining the Array(4).fill('')s. (Probably one comment to explain all of them is enough)

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we instead do a single header cell of width 5 (or 3 when appropriate)? FM results don't look nice:

image

app/webpacker/components/Results/Records/index.jsx Outdated Show resolved Hide resolved
app/controllers/results_controller.rb Outdated Show resolved Hide resolved
app/controllers/results_controller.rb Show resolved Hide resolved
<Button.Group id="state" size="small" compact primary>
<Button.Group id="state" size="large" primary>
Copy link
Member

Choose a reason for hiding this comment

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

I did? 😇 Please point me in the right direction, or at least explain when you want to undo it

app/webpacker/components/Results/Records/RecordsTable.jsx Outdated Show resolved Hide resolved
app/webpacker/components/Results/Records/RecordsTable.jsx Outdated Show resolved Hide resolved
import { Table } from 'semantic-ui-react';
import I18n from '../../lib/i18n';

const headerConfig = {
Copy link
Member

Choose a reason for hiding this comment

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

Chiming in to note that I'd be happy to see a short comment explaining the Array(4).fill('')s. (Probably one comment to explain all of them is enough)

app/webpacker/components/wca/EventSelector.jsx Outdated Show resolved Hide resolved
app/webpacker/components/wca/EventSelector.jsx Outdated Show resolved Hide resolved
Comment on lines +333 to +347
if (region !== 'world') {
queryParams.append('region', region);
}

if (gender !== 'All') {
queryParams.append('gender', gender);
}

if (eventId){
queryParams.append('event_id', eventId)
}

if (show){
queryParams.append('show', show)
}
Copy link
Member

Choose a reason for hiding this comment

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

See my comment on the Rankings PR about redundant-but-not-redundant parameters ;)

Copy link
Contributor

@kr-matthews kr-matthews left a comment

Choose a reason for hiding this comment

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

I can/will make some improvements to my recent Competitors tanstack table PR based on what I've seen here.

<Button.Group id="state" size="small" compact primary>
<Button.Group id="state" size="large" primary>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this file should have any changes at this point?

app/webpacker/components/Results/ResultsFilter.jsx Outdated Show resolved Hide resolved
}

export default function ResultsFilter({
filterState, filterActions, showCategories, isRecords,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the prop names should be declarative rather than assuming information about the parent. So I'd rename isRecords to selectAllEventsIsAllowed or allowSelectingAllEvents. But then the logic is kind of mixed between this prop and the filterActions, which feels a bit off. And that might change based on the outcome of my previous comment.

app/webpacker/components/Results/ResultsFilter.jsx Outdated Show resolved Hide resolved
app/webpacker/components/Results/TableColumns.jsx Outdated Show resolved Hide resolved
Comment on lines +32 to +34
cell.column.columnDef.isMultiAttemptsHack
? (
<React.Fragment key={cell.id}>
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering how this was going to work - and seems the answer is 'not well'.

I also thought this was some kind of exception for mbf for a long time.

Copy link
Member

Choose a reason for hiding this comment

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

Hm... I could play around with trying to align it using a sub-header, but if the answer is not forthcoming after ~30 minutes I will just let it be.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, it is easy to specify but cumbersome to style. If you have a definition similar to

[
  { accessorKey: 'competitionName' },
  { accessorKey: 'personName' },
  { header: 'Successful solves', columns: [
    { accessorKey: 'value1' },
    { accessorKey: 'value2' },
    { accessorKey: 'value3' },
  ] }
]

then Tanstack pushes the competition name and person name header down to be on the same level as the header for value1, value2, etc.
image

In other words, it always pushes down individual column headings as far down as possible. If we could instead set this to pull them up as far as possible, I can adjust the rowSpan to make it look nice.

Copy link
Member

Choose a reason for hiding this comment

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

Couldn't find anything in their documentation, so I will go ahead and raise an Issue / discussion

Copy link
Member

Choose a reason for hiding this comment

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

Seems there is TanStack/table#5051 but no official word on whether or when this will be officially supported.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, I managed to implement something based on the discussion linked above:
image

Copy link
Member

Choose a reason for hiding this comment

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

I think the header margins make this look a bit bloated... Also, it's gonna be tricky figuring out which results to wrap

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.

3 participants