Skip to content

Show cards on curriculum catalog page - #51249

Merged
megcrenshaw merged 15 commits into
stagingfrom
meg/show-cards-on-curriculum-catalog-page
Apr 12, 2023
Merged

Show cards on curriculum catalog page#51249
megcrenshaw merged 15 commits into
stagingfrom
meg/show-cards-on-curriculum-catalog-page

Conversation

@megcrenshaw

@megcrenshaw megcrenshaw commented Apr 10, 2023

Copy link
Copy Markdown

Puts the curriculum cards onto the Curriculum Catalog page. See it at http://localhost-studio.code.org:3000/catalog

image

Responsive (minus the banner –– see comment):
https://user-images.githubusercontent.com/9142121/231229618-53de77e5-2b7a-4a71-8e15-b7a0cb3265c6.mov

There are several todo's added as comments in the code –– syncing up with Turner and Dani to figure out what's already tracked and what needs a ticket.

A couple of design improvements were part of this work:

  1. Truncates the title to be maximum two lines. This is part of the design spec

image

  1. Makes the non-English card a little bit longer to accommodate the possible two-line title.

image

  1. Finally manually looked at the RTL version by going into the developers console and manually changing the "direction" tag to rtl. Some styling adjustments were made to ensure the RTL looks normal.

image

Links

The creator of the React Testing Library suggests testing the parent component only (so I'd remove the tests from Curriculum Catalog Card and put them into the Curriculum Catalog). However, by the time we test all the logic for the filtering and the assign and quick view logic, they'd become super large files. I'm keeping it as-is for now (keeping them separate), but open to more conversation about this.

Testing story

For testing, used React Testing Library. Added Redux Toolkit to our repo because createStore is deprecated:
image

Deployment strategy

Follow-up work

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@megcrenshaw

Copy link
Copy Markdown
Author

Some follow-ups:

  1. The banner is not responsive –– @TurnerRiley and @dmcavoy is this tracked?

image

  1. We need to calculate the duration of a curriculum on the backend. Is this tracked or should I make a ticket for it?

  2. I believe we already have functionality to see if a course is translated or not. Will sync up with @davidsbailey about this and make a separate ticket for it.

  3. We also need to get the non-English page loading using locale. I'm going to do that as part of this same ticket.

  4. Dani is figuring out what should happen with grade levels (do we require at least 0, 1, or 2 grades)? Should I make a ticket for that too?

  5. Dani is getting remaining images in.

@megcrenshaw
megcrenshaw requested a review from a team April 11, 2023 16:41
@megcrenshaw
megcrenshaw marked this pull request as ready for review April 11, 2023 16:41
@davidsbailey

Copy link
Copy Markdown
Member

I believe we already have functionality to see if a course is translated or not. Will sync up with davidsbailey about this and make a separate ticket for it.

yeah, we'll need to decide how exactly to compute this because we'll be using the supported_locales field on the Unit model. this is easy when there is one unit in the course offering. when there are multiple units, I would imagine we want to mark it as supported only if all units are supported in that language. I think that would be a product question in the end though.

@TurnerRiley

Copy link
Copy Markdown
Contributor

Some follow-ups:

  1. The banner is not responsive –– @TurnerRiley and @dmcavoy is this tracked?
image

I think the component I had used for it is not as responsive I guess, I'll look into what Kelby was using and switch over to that so it'll have better responsiveness! Thank you for catching this!

@megcrenshaw

Copy link
Copy Markdown
Author

I believe we already have functionality to see if a course is translated or not. Will sync up with davidsbailey about this and make a separate ticket for it.

yeah, we'll need to decide how exactly to compute this because we'll be using the supported_locales field on the Unit model. this is easy when there is one unit in the course offering. when there are multiple units, I would imagine we want to mark it as supported only if all units are supported in that language. I think that would be a product question in the end though.

Got it, thanks! Ticket for this work is here https://codedotorg.atlassian.net/browse/ACQ-514

@davidsbailey

Copy link
Copy Markdown
Member

Makes the non-English card a little bit longer to accommodate the possible two-line title.

Italian and German are my go-to's for testing long text :-)

@davidsbailey davidsbailey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks great Meg!

display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

all supported browsers now recognizing a -webkit style! what a time to be alive 😁

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ha! Amen. I had to read that documentation over and over to make sure I was reading it right ...

oldestGrade={gradeLevelArray[gradeLevelArray.length - 1]}
subjects={school_subject?.split(',')}
topics={cs_topic?.split(',')}
isTranslated={!!Math.round(Math.random())} // TODO [MEG]: actually pass in this data

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is this here so you can test both ways? this could be a little confusing to someone trying to repro a bug, so I'd prob recommend hard-coding it, and just using the react browser tool to toggle the prop value if you want to be able to see it change in the browser. no need to go back through drone just for this, though.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That's a good point –– I'll update this in the next PR

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It was more for "easy" screenshots that would include the various options. But yes, I'll remove this in the next PR.

.map(curriculum => curriculum.display_name)
.forEach(courseName => screen.getByRole('heading', {name: courseName}));
});
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

these look like a good start and a good stopping point 👍

@dmcavoy

dmcavoy commented Apr 12, 2023

Copy link
Copy Markdown
Contributor

@megcrenshaw Following up on the grade question. I think we need to support cards with both 1 grade and 2 or more grades as CSF Course F has just one grade right now.

@megcrenshaw

Copy link
Copy Markdown
Author

@megcrenshaw Following up on the grade question. I think we need to support cards with both 1 grade and 2 or more grades as CSF Course F has just one grade right now.

Got it, will update in the next PR!

@megcrenshaw
megcrenshaw merged commit a997e63 into staging Apr 12, 2023
@megcrenshaw
megcrenshaw deleted the meg/show-cards-on-curriculum-catalog-page branch April 12, 2023 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants