Skip to content

enrollment dashboard mobile layout #2187

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

Merged
merged 10 commits into from
Apr 9, 2025
Merged

Conversation

gumaerc
Copy link
Contributor

@gumaerc gumaerc commented Apr 8, 2025

What are the relevant tickets?

https://github.com/mitodl/hq/issues/7042

Description (What does it do?)

This PR implements mobile designs on the enrollments display in the dashboard home page.

Screenshots (if appropriate):

image
image
image

How can this be tested?

  • Ensure you have Posthog connected to your local instance of mit-learn
  • In your connected Posthog project, make sure you have added and enabled the enrollment-dashboard feature flag
  • Visit http://open.odl.local:8062/dashboard and log in (if you are not already logged in)
  • Ensure nothing has changed with the desktop view of the enrollments display
  • View the site using your browser's mobile simulator and ensure that it looks and behaves properly

Copy link

github-actions bot commented Apr 8, 2025

OpenAPI Changes

Show/hide No detectable change.

@gumaerc gumaerc changed the title enrollment dashboard mobile layut enrollment dashboard mobile layout Apr 8, 2025
@gumaerc gumaerc force-pushed the cg/enrollment-dashboard-mobile branch from cf4eca8 to b987055 Compare April 8, 2025 15:29
Copy link

github-actions bot commented Apr 8, 2025

OpenAPI Changes

Show/hide No detectable change.

1 similar comment
Copy link

github-actions bot commented Apr 8, 2025

OpenAPI Changes

Show/hide No detectable change.

@odlbot odlbot temporarily deployed to mitopen-cg-enrollment-d-dnx0qa April 8, 2025 15:30 Inactive
Copy link

github-actions bot commented Apr 8, 2025

OpenAPI Changes

Show/hide No detectable change.

1 similar comment
Copy link

github-actions bot commented Apr 8, 2025

OpenAPI Changes

Show/hide No detectable change.

@gumaerc gumaerc force-pushed the cg/enrollment-dashboard-mobile branch from d96dcdf to b503241 Compare April 8, 2025 18:20
Copy link

github-actions bot commented Apr 8, 2025

OpenAPI Changes

Show/hide No detectable change.

1 similar comment
Copy link

github-actions bot commented Apr 8, 2025

OpenAPI Changes

Show/hide No detectable change.

@gumaerc gumaerc added Needs Review An open Pull Request that is ready for review and removed Work in Progress labels Apr 8, 2025
@ChristopherChudzicki ChristopherChudzicki mentioned this pull request Apr 9, 2025
1 task
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

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

Looks great. One minor suggestion, and one request about tests.

</Stack>
{run.startDate ? (
<CourseStartCountdown startDate={run.startDate} />
) : null}
</Stack>
</CardRoot>
)

const mobileLayout = (
<CardRoot data-testid="enrollment-card">
Copy link
Contributor

Choose a reason for hiding this comment

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

Request: I think we should use separate testids for the desktop/mobile versions, and one of them (doesn't matter which) should just be enrolment-card. (Or I guess maybe we should change it to dashboard-card).

The current structure has a few disadvantages, imo:

  • makes the DashboardCard.test.tsx file awkward. You had change a bunch of things like courseLink to courseLinks, and it's not clear how many courseLinks there are.
  • The tests for a component that renders a list of dashboard cards now feels weird, too. If the test renders 7 resources, you get 14 cards.

If we use separate testids, then both these problems go away:

  • the DashboardCard.test.tsx can make all the assertions it wants about both variations,and it's clear there is only one courseLink (per variation).
  • Other tests see 1 enrollment-card per resource. (And also 1 enrollment-card-mobile per resource, but other tests can ignore that...the equivalence of desktop/mobile versions in terms of logic / meaning is thoroughly tested in Dashboard.test.tsx

I took a quick stab at this in https://github.com/mitodl/mit-learn/compare/cg/enrollment-dashboard-mobile...cg/enrollment-dashboard-mobile-cc-edits?expand=1 (The DashboardCard.test.tsx file passes; some other test file fails because it is expecting 2 cards per resource. I didn't change that one.)

Copy link
Contributor

Choose a reason for hiding this comment

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

If you look at https://github.com/mitodl/mit-learn/compare/cg/enrollment-dashboard-mobile...cg/enrollment-dashboard-mobile-cc-edits?expand=1 you can see my old man bias against mobile... Could have called them enrollment-card and enrollment-card-desktop 😛

width="100%"
>
<Stack direction="column" gap="8px">
<Link size="medium" color="black" href={marketingUrl}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Might be worth styling the Link so that it has a max width slightly less than 100% (Maybe something like calc(100% - 4px).

Else this happens:
Screenshot 2025-04-09 at 9 02 48 AM

Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide No detectable change.

1 similar comment
Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide No detectable change.

@gumaerc
Copy link
Contributor Author

gumaerc commented Apr 9, 2025

@ChristopherChudzicki Thanks, this is ready for another look.

Comment on lines 104 to 105
const upgradeRootDesktop = screen.queryByTestId("upgrade-root-desktop")
const upgradeRootMobile = screen.queryByTestId("upgrade-root-mobile")
Copy link
Contributor

Choose a reason for hiding this comment

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

My preference would be to reduce the number of places we append desktop and mobile and use within instead:

const upgradeRootDesktop = within(scree.getByTestId("enrollment-card-desktop")).queryByTestId("upgrade-root")
const upgradeRootMobile = within(scree.getByTestId("enrollment-card-mobile")).queryByTestId("upgrade-root")

@gumaerc gumaerc force-pushed the cg/enrollment-dashboard-mobile branch from 93f1b24 to 81f2ae6 Compare April 9, 2025 18:18
Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide No detectable change.

Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

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

👍

Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide No detectable change.

@gumaerc gumaerc merged commit 9b6a0c8 into main Apr 9, 2025
12 checks passed
@gumaerc gumaerc deleted the cg/enrollment-dashboard-mobile branch April 9, 2025 18:45
@odlbot odlbot mentioned this pull request Apr 10, 2025
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review An open Pull Request that is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants