-
Notifications
You must be signed in to change notification settings - Fork 3
Program Page basic layout #2556
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
@@ -1,5 +1,3 @@ | |||
"use client" |
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.
Marking all of ol-utilities
with "use client"
means that none of it can be used in server components. In particular, DEFAULT_RESOURCE_IMG constant couldn't be used in server components.
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.
An excellent addition to the site! I left some questions/observations.
<Component | ||
className={classnames("raw-html", className)} | ||
data-testid="raw" | ||
dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(html) }} |
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.
Not in this PR directly, but I notice the mitxonline API / Wagtail escapes html, including the list tags we're styling for.
<h2>Key Points</h2>
<ul>
<li>Ut enim ad minim veniam</li>
<li>Quis nostrud exercitation ullamco laboris</li>
<li><strong>Nisi ut aliquip ex ea commodo consequat</strong></li>
</ul>
is sanitized/escaped to:
<p data-block-key="6pl3h"><h2>Key Points</h2></p><p data-block-key="cjts8"> <ul></p><p data-block-key="133r9"> <li>Ut enim ad minim veniam</li></p><p data-block-key="9163i"> <li>Quis nostrud exercitation ullamco laboris</li></p><p data-block-key="4pdjt"> <li><strong>Nisi ut aliquip ex ea commodo consequat</strong></li></p><p data-block-key="bn25k"> </ul></p>
and rendered:

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.
This file now deserving of a rename, ProductSummary.tsx?
<BottomContainer> | ||
<SidebarCol> | ||
<SidebarImageWrapper> | ||
<SidebarImage width={410} height={230} src={imageSrc} alt="" /> |
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.
Observation that locally this image (page.program_details.page.feature_image_src
) does not load. We get a URL for the Learn backend on the programs list API:
http://open.odl.local:8065/media/original_images/IMG_20250928_135213707.jpg
The image loads correctly from:
http://mitxonline.odl.local:8065/media/original_images/IMG_20250928_135213707.jpg
I'm not sure if this is an issue with my local environment setup / API gateway routing or if it's something we need to handle.
Same issue for the instructor image from the programs detail, items[0].faculty[0].feature_image_src
.
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 think this should be fixed on a more recent version of mitxonline (after mitodl/mitxonline#2946 + mitodl/mitxonline#2950). I shouldve mentioned to up-to-date main branch of that...should fix some potential permission issues, too.
.then((res) => res.data) | ||
}, | ||
}), | ||
programsDetail: (readableId: string) => |
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 we rename this programPageDetail
to match the key. I had some moments of confusion as to why neighboring programsQueries.programDetail()
was not being called. Same for courseDetail
from previous.
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 decided to change the keys and the queries to coursePages
and programPages
. They are listing endpoints, though we only use them to fetch 1 entry.
I considered originally trying to fake the detail endpoint and returning only a single object from the query, but decided to leave it as explicitly returning the list—I thought a proper detail endpoint should return 404 for missing objects, and trying to simulate a 404 with an AxiosError seemed like too much shenanigans.
So, since they are listings, coursePages
and programPages
seemed more accurate
Just confirming: this is a product page for a program, suitable as a landing page for marketing campaigns? Can you give me an example of the route? |
Yep (once it's done). Example routes:
|
d43abb5
to
e29d758
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.
👍
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/8715
Description (What does it do?)
Adds program pages at
/program/{readable_id}
.Screenshots (if appropriate):
Desktop:

Mobile:


How can this be tested?
Prerequisites:
product-page-course
.Setting up course data: To set up mock data:
programsList.queryFn
infrontends/api/src/mitxonline/hooks/programs/queries.ts
; e.g., use a response from https://api.learn.mit.edu/mitxonline/api/v2/programs/?readable_id=program-v1%3AMITx%2BDEDPprogramPageDetail.queryFn
infrontends/api/src/mitxonline/hooks/pages/queries.ts
, e.g., use a response from https://api.learn.mit.edu/mitxonline/api/v2/pages/?fields=*&type=cms.ProgramPage&readable_id=program-v1%3AMITx%2BDEDPTo set up real local data:
./manage.py create_courseware
; Use--help
for details.program-
./manage.py create_courseware_page
; use--help
option for details.Testing Steps:
http://learn.odl.local:8062/programs/readable-id
, where readable_id is likeprogram-v1:MITx+DEDP
.