Repository navigation
feat(pathways): add pathway detail page - #181
navinkarkera wants to merge 38 commits into
Conversation
|
Thanks for the pull request, @navinkarkera! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Update the status of your PRYour PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #181 +/- ##
==========================================
+ Coverage 99.56% 99.70% +0.14%
==========================================
Files 101 119 +18
Lines 682 1014 +332
Branches 165 272 +107
==========================================
+ Hits 679 1011 +332
Misses 2 2
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6ce1a11 to
a046ee2
Compare
306e15c to
ac7c699
Compare
The builder now returns only the rendered links; no host read the resolved href, so the field and its rationale are gone and the barrel no longer re-exports the result type. Adds a SidebarSocial render/rerender test that fails if the destinations are cached instead of rebuilt from the live location.
ac7c699 to
ba35c0e
Compare
| <span className="d-inline-flex align-items-center">{course.pace}</span> | ||
| <span className="d-inline-flex align-items-center"> | ||
| <Icon src={isBadge ? WorkspacePremium : CourseContentIcon} size="sm" className="text-info-800" /> | ||
| {intl.formatMessage(isBadge ? messages.badgeCount : messages.certificateCount, { count })} |
There was a problem hiding this comment.
Is it possible to use <FormattedMessage> here?
There was a problem hiding this comment.
Changed the count to use FormattedMessage.
| <Card | ||
| key={credential.id} | ||
| className={`pathway-detail-credential-card justify-content-center border-0 ${isBadge | ||
| ? 'bg-primary-100' | ||
| : 'bg-light-100'}`} | ||
| > | ||
| <Card.Body className="d-flex flex-column align-items-center text-center p-4"> | ||
| {isBadge | ||
| ? <Icon src={WorkspacePremium} size="lg" className="text-info-800 mb-3" /> | ||
| : <CertificateIcon aria-hidden className="mb-3" />} | ||
| <strong> | ||
| {intl.formatMessage( | ||
| isBadge ? messages.earnBadgeTitle : messages.earnCertificateTitle, | ||
| { rule: credential.rule }, | ||
| )} | ||
| </strong> | ||
| <span className="small"> | ||
| {intl.formatMessage(messages.credentialCourseTitle, { title: credential.courseTitle })} | ||
| </span> | ||
| </Card.Body> |
There was a problem hiding this comment.
Could you extract this Card into a separate component? That way, it would look cleaner.
There was a problem hiding this comment.
Moved the card into PathwayCredentialCard.
| } | ||
|
|
||
| export const PathwayHero = ({ pathway, isNavSticky }: PathwayHeroProps) => { | ||
| const intl = useIntl(); |
There was a problem hiding this comment.
I think you can use <FormattedMessage> here and simplify this component
There was a problem hiding this comment.
Changed the hero text to use FormattedMessage.
| * The screenshots' course summaries disagreed there ("1 badge" for a course | ||
| * whose credential is a certificate, and vice versa); the list is authoritative. | ||
| */ | ||
| export const DATA_ENGINEERING_PATHWAY: PathwayDetailData = { |
There was a problem hiding this comment.
Can we convert these fixtures into mocks and use them in tests, as well as for test data in the UI, without a backend? I think we should follow the convention that @rpenido proposed. If so, this PR would need the API and API hooks layer.
There was a problem hiding this comment.
Moved the sample data to the shared mocks. The page now gets it through an API function and a query hook.
|
|
||
| const messages = defineMessages({ | ||
| notFound: { | ||
| id: 'category.not-found-page.title', |
There was a problem hiding this comment.
Nit
| id: 'category.not-found-page.title', | |
| id: 'category.pathway-detail.not-found-page.title', |
There was a problem hiding this comment.
Changed it to catalog.pathway-detail.not-found-page.title to match the other messages.
| description: 'Email body for sharing the pathway.', | ||
| }, | ||
| pageTitle: { | ||
| id: 'pathway.page.title', |
There was a problem hiding this comment.
| id: 'pathway.page.title', | |
| id: 'catalog.pathway-detail.page.title', |
There was a problem hiding this comment.
Changed it to catalog.pathway-detail.page.title.
| const visibleCourses = pathway.courses.slice(0, showAllCourses ? undefined : INITIAL_VISIBLE_COUNT); | ||
|
|
||
| return ( | ||
| <> |
| const visibleCourses = pathway.courses.slice(0, showAllCourses ? undefined : INITIAL_VISIBLE_COUNT); | ||
|
|
||
| return ( | ||
| <> |
| <section id="about" className="pathway-detail-section d-flex flex-column gap-3"> | ||
| <h2 className="h3 mb-2">{intl.formatMessage(messages.aboutHeading)}</h2> | ||
| {pathway.about.map(paragraph => ( | ||
| <p key={paragraph}>{paragraph}</p> |
There was a problem hiding this comment.
Nit: Using paragraph as a key can be volatile; at some point, two identical paragraph entries could exist.
There was a problem hiding this comment.
Changed this to use the index as the key. These are plain text paragraphs, so I added a small lint exception.
|
@navinkarkera, could you also add screenshots to the PR description? |
Only the LMS /static/images/ and /asset paths are resolved to the LMS base URL; data:, blob:, protocol-relative and other sources stay as authored. Drop the unused exports on the local body props and intro actions.
A query that is no longer pending but has no data, including a successful null payload, now renders the existing support alert instead of nothing. Loaded content is still shown when a background refetch fails.
The scrollspy can move the address to a section that is already active, and a tab click lets the anchor update the hash after the click render. Both left the sidebar's share destinations on the previous address. Track the address's section hash in state and derive the active section from it, so synchronizing '' -> '#about' re-renders even though the active tab does not change. Scrollspy still uses replaceState; a click performs the fragment navigation before the state update, so the anchor's default finds the address unchanged and the page keeps one history entry, fragment scrolling and modified-click behaviour. Rendering no longer mutates history, so routes with no pathway keep their address. Select credential cards by their visible course line and drop the unused credential-kind class names, which had no style rules.
The page reads the bundled sample record through React Query until a pathway endpoint exists, with explicit loading, error and missing-record states. The navigation hook now mounts with the loaded view so its observers attach, and the loaded view is keyed by record.
A failed pathway request is a support problem, not a bad URL, so the danger alert uses the shared error copy with the configured INFO_EMAIL. The sidebar shares through the shared current-page target constant, and a cached pathway switch resets each expanded list through the keyed loaded view.
No content change: the sample mock ends with a single newline.
b6040ce to
896aa27
Compare
|
@ChrisChV Done. |
ChrisChV
left a comment
There was a problem hiding this comment.
@navinkarkera Looks good 👍
- I tested this: I followed the testing instructions and verified the new page
- I read through the code and considered the security, stability and performance implications of the changes.
- I tested that the UI can be used with a keyboard only (tab order, keyboard controls).
- Includes tests for bugfixes and/or features added.
- Includes documentation
- Includes fixtures that create objects required for manual testing.
Branch:
navin/fal-4380/pathway-detail(896aa27)Base:
navin/fal-4380/embeddable-course-about(936b6db)Description:
src/__mocks__/pathway.tsand is loaded through an API function and a React Query hook; there is no real backend endpoint yet. Loading, request failures and a missing record each show their own state, and a failed refresh keeps the loaded record. The Enroll button is intentionally disabled and there is no Learn more button or modal yet.Screenshots
Testing instructions:
/catalog/pathways/data-engineering-fundamentals: the title uses the pathway and site names; the hero shows facts and the disabled Enroll button.#credentialsstarts with Credentials active.AI Disclosure: Co-authored by GPT 6.1 Sol