Skip to content
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

UI updates/ Launch Lessons page #12647

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open

Conversation

eadams17
Copy link
Member

WHAT

design overhaul for the Launch Lessons page

WHY

this is a very old page and was due for a UI makeover

HOW

a lot of React and CSS refactoring

Screenshots

(If applicable. Also, please censor any sensitive data)
Screen Shot 2024-12-10 at 6 55 47 PM

Notion Card Links

(Please provide links to any relevant Notion card(s) relevant to this PR.)
https://www.notion.so/quill/Update-UI-Launch-Lessons-ba7388f4d749439ab8c1ce22c09a5dc2

What have you done to QA this feature?

checked on staging that lessons data render as expected and various states are represented as expected

PR Checklist Your Answer
Have you added and/or updated tests? yes
Have you deployed to Staging? yes
Self-Review: Have you done an initial self-review of the code below on Github? yes

Copy link
Member

@emilia-friedberg emilia-friedberg left a comment

Choose a reason for hiding this comment

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

The CSS here looks great and the React clean-up and tests are much appreciated. I left some comments in places where I think we could take it a little further or make small changes to get us in line with best practices, but no need to review again. This page really needed a facelift and looks great now!

font-weight: 600;
}
a {
color: #027360;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could substitute this for a color variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch! with the refactoring, I was in a bit of autopilot for some parts of copy and pasting 😅

Comment on lines 153 to 154
font-size: 14px;
font-weight: 400;
Copy link
Member

Choose a reason for hiding this comment

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

I think this could be replaced with @include text-s.

@@ -19,6 +20,14 @@ export const DataTableChip = ({ color, icon, label, link }: DataTableChipProps)
</a>
)
}
if (onClick) {
return (
<button className={`data-table-chip ${color} focus-on-light`} onClick={onClick}>
Copy link
Member

Choose a reason for hiding this comment

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

Probably need a button type declaration here for the linter, right?

return (
<button className={`data-table-chip ${color} focus-on-light`} onClick={onClick}>
{icon && <img alt={icon.alt} src={icon.src} />}
<p>{label}</p>
Copy link
Member

Choose a reason for hiding this comment

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

I think a span is the more appropriate semantic element here -- I've been getting a lot of console errors about nesting block elements inside inline elements, which I think is technically not allowed under the HTML5 specification. There are some cases where it's tricky to avoid (like nesting elements in tables), but I think we should try where we can.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok! I'll make that change. Thank you for the context

it('renders the unit name and assigned information', () => {
render(<Unit data={mockData} />);

expect(screen.getByText('Sample Unit')).toBeInTheDocument();
Copy link
Member

Choose a reason for hiding this comment

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

This is something @anathomical often calls out, but I think that where something is a reference to a variable (as opposed to static text on the page), we should try to refer to it that way instead of just as a string, so it's clear what it should be testing.

Copy link
Member Author

Choose a reason for hiding this comment

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

so something like this?

const unitNameSpan = screen.getByText('Sample Unit')
expect(screen.getByText(unitNameSpan)).toBeInTheDocument();

Comment on lines +103 to +108
if (Object.keys(classroomActivities)) {
return classroomActivities
}
if (Object.keys(classroom_activities)) {
return classroom_activities
}
Copy link
Member

Choose a reason for hiding this comment

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

Oy vey. My guess is you tried, but is it worth trying to track down why these are both sometimes present? Ideally, we'd only have one.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it has something to do with the DB values for this data sometimes having different shapes (it's lessons so I didn't want to dive too deep into that hole)

Comment on lines +111 to +119
function getActivityId(lessonActivity) {
const { activityId, activityUid, activity } = lessonActivity
return activityId || activityUid || activity?.uid
}

function getClassroomUnitId(lessonActivity) {
const { cuId, classroom_unit_id } = lessonActivity
return cuId || classroom_unit_id
}
Copy link
Member

Choose a reason for hiding this comment

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

Same here. If it's just too complicated to deal with for this project that's fine, but might be worth noting in the PR description.


function renderCustomizeCell(id) {
return(
<a className="customize-link focus-on-light" href={`/customize/${id}`} rel="noopener noreferrer" target="_blank">
Copy link
Member

Choose a reason for hiding this comment

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

We should add an aria-label to these tags, because it won't be clear to a screenreader user what clicking that icon will do. Then, I'd test for the presence of an element with that aria label in the specs, instead of the alt text, which is less relevant for functionality.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add, thanks for the context!


function renderDownloadCell(id) {
return(
<a className="download-link focus-on-light" href={`/activities/${id}/supporting_info`} rel="noopener noreferrer" target="_blank">
Copy link
Member

Choose a reason for hiding this comment

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

See note above about aria labels.

Comment on lines +189 to +191
const rows = [];
const activities = getClassroomActivities()
activities.forEach((lessonActivity) => {
Copy link
Member

Choose a reason for hiding this comment

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

You could clean this up a little by doing const rows = getClassroomActivities().map(lessonActivity => { instead of pushing to the empty rows array.

Copy link
Member Author

Choose a reason for hiding this comment

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

so this data actually comes through as a Map, so we have to use forEach to iterate through it and then push that relevant data into the array (I added a comment in the code for better context)

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.

2 participants