-
Notifications
You must be signed in to change notification settings - Fork 172
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 some parts of persons page to React #9184
base: main
Are you sure you want to change the base?
Conversation
I think the best way to split this migration up is likely to do:
So this will be first one of those |
Just as a short remark (haven't looked at your code in detail): Don't inject mutliple <% if new_design_toggled %>
<%= react_component('blabla') %>
<% else %>
<%= render 'show_legacy' %>
<% end %> ...where the new React component is its own standalone thing that is incomplete / WIP at the beginning of the migration process. |
I have finished migrating the static parts (plus map). What is left is the results for event table, and tying it together (as mentioned above) which will be a seperate pr. There is some logic in the view files such as in the |
In case anyone wants to see different features, I have been testing with various different people namely: 2012BEAH01 - Lots of records, but still some stuff on the profile missing. |
Can I haz screenshot plz? :D (I am thrilled to see the progress but I can't boot my computer right now) |
Also, why did you decide to glue smaller React components into all the different legacy views (patchwork-style) instead of one top-level "If flag, then show THE react page (which may be incomplete and still missing some sections entirely) or else show legacy"? I don't want to sound very strict or dictate your programming style, so if you feel comfortable with your current approach then okay. My thinking is just that by replacing bit by bit with smaller components (your current approach) limits you too much in terms of layout and design. It ties you to the exact layout of the legacy page. The alternative would be to have one global React component that is still "work-in-progress" (compared to the old legacy page) and grows as you go. This gives you more degrees of freedom, like a "blank canvas" to freely think about the best approach for arranging the individual sub-sections |
I didn't really think about having it in one big page with missing parts (sorry if I misunderstood what you meant in your message last week), but happy to do so. In terms of the layout, its almost the exact same as before but with semantic ui. I don't have any ideas specifically about ways it could be made different, but its basically the same work to make those changes down the line vs now. If you have any suggestions in this department I would definitly like to hear them. |
I think the most important point is to find an approach that works well for you. Don't sink several hours into this refactor if it's inconvenient for you to work with and slows down your progress significantly. In my opinion, having one big page has the following advantages:
But again, this is just my perspective and you are totally free to disagree. I won't block the merge with your current "bite-sized components" approach and the emphasis is for you to work in a way that feels most efficient to you.
I don't have any specific directions or reference material that I would like you to implement. But there are so many small ideas that immediately come to my mind.
As previously stated, none of these are requirements or binding directives. They are really just random ideas and my point is to "free your mind" from the restraints of the previous layout (which I think is the easiest when you have one big work-in-progress React component that you can freely play around with). Are you fully happy with the page layout of the current page? Is there really nothing you had always wished would be laid out differently / more convenient? Now is the chance to change it! |
{person.name + (canEditUser ? ' ' : '')} | ||
{canEditUser && ( | ||
<a href={editUrl}> |
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.
{person.name + (canEditUser ? ' ' : '')} | |
{canEditUser && ( | |
<a href={editUrl}> | |
{person.name} | |
{canEditUser && ( | |
{' '}<a href={editUrl}> |
import { events } from '../../lib/wca-data.js.erb'; | ||
import { AttemptItem } from './TableComponents'; | ||
|
||
function groupByEvent(results) { |
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.
lodash has a groupBy
function; it's used in OfficersAndBoard
for example.
const allEvents = events.official.map((event) => event.id); | ||
Object.entries(events.byId).forEach((entry) => { | ||
if (allEvents.find((e) => e === entry[1].id)) return; | ||
allEvents.push(entry[1].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.
It should be possible to do this with filters/maps, which I think would be better than modifying const
arrays.
As a bit of an update, Hopefully I will have a nice demo image to show in a few days |
315bfe4
to
70b31d8
Compare
70b31d8
to
c4327d4
Compare
c4327d4
to
b285618
Compare
This will use react to display the Records and soon the Championship Podiums also when react is among the url params