-
Notifications
You must be signed in to change notification settings - Fork 3
learning resource drawer v2 run comparison table #1782
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
3c8e756
to
2c9c5da
Compare
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.
Looks good. Veery small changes are to remove decimals from exact dollar amounts and a new line for the location display.
frontends/ol-components/src/components/LearningResourceExpanded/InfoSectionV2.tsx
Outdated
Show resolved
Hide resolved
distinctLocations.length > 1 | ||
) { | ||
return ( | ||
<DifferingRuns data-testid="differing-runs-table"> |
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.
Would this work better as an html table? Thinking in terms of Voiceover / accessibility.
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 just looked into this a little bit. My impression is that real HTML tables are nice because screenreaders read row and column headers pretty logically and support arrow key navigation more naturally. (Example: with VoiceOver, VO = voiceover modifier combo... VO + down = navigate down, and VO reads header for new row but not for column, since it's the same).
But with the current layout of this table, it's hard to actually implement as a real HTML table:

We can make it look right by using colspan, but then "Location" loses its association with its row, which defeats the a lot of the purpose of using a real table.
I could be wrong, but I don't see a good way to make this a real table.
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.
Also, the current navigation, at least in voiceover, seems pretty fine to me.
VO reads
"November 11, 1250 dollars, in person, location: Cambridge, MA, February 10, ..."
which seems ok.
frontends/ol-components/src/components/LearningResourceExpanded/InfoSectionV2.tsx
Outdated
Show resolved
Hide resolved
frontends/ol-components/src/components/LearningResourceExpanded/InfoSectionV2.tsx
Show resolved
Hide resolved
It's from a previous PR, but is the title section intended to be fixed/sticky? @steven-hatch @mbilalmughal Thought it looked a bit odd - could just be me and not an issue on touchscreen. ![]() |
The header is meant to be sticky, but what seems to be happening here is that the image is having z-index precedence over it. |
@jonkafton Thanks for your review. This is ready for another look. @ChristopherChudzicki and I chatted about this some more and we think it's best to not change this to an actual |
4d35704
to
2723143
Compare
<span>{run.delivery?.map((dm) => dm?.name).join(", ")}</span> | ||
</DifferingRunData> | ||
)} | ||
{run.delivery.filter((d) => d.code === "in_person").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.
Is run.delivery
always an array here as there are conditionals on it above?
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.
Yea, according to the API spec it should always be an array. I've also seen it return an array with a single element:
delivery: Array<CourseResourceDeliveryInner>
@@ -88,6 +88,7 @@ const Image = styled(NextImage)({ | |||
borderRadius: "8px", | |||
width: "100%", | |||
objectFit: "cover", | |||
zIndex: -1, |
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.
Yay
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.
🙃
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.
Looking good. Approving with potential change needed for optional chaining on https://github.com/mitodl/mit-learn/pull/1782/files#diff-612b73fc63762015de6077e1ac1b79ec8489f6adf644241585eba9bcfe39adc3R123
.sort( | ||
(a: LearningResourcePrice, b: LearningResourcePrice) => | ||
Number(a.amount) - Number(b.amount), | ||
) |
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.
Duplicate?
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.
Good catch
2723143
to
7f0e85f
Compare
* add first draft of run comparison table * hide labels on mobile * update differing run table styles * add tests * display table if location is different * move DifferingRunsTable to its own file * use getDisplayPrice * fix CTA image z-index issue * remove errant console.log * fix location display * remove duplicate sort
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/5681#issuecomment-2450078182
Description (What does it do?)
This PR adds a table to the new learning resource drawer comparing the price and format between runs of a course, if they are different.
Screenshots (if appropriate):
How can this be tested?
lr_drawer_v2
flagdrawerV2
to betrue
inLearningResourceDrawer.tsx
mit-learn