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

Add finish button to last level of a lab2 progression #58493

Merged
merged 8 commits into from
May 10, 2024

Conversation

fisher-alice
Copy link
Contributor

@fisher-alice fisher-alice commented May 9, 2024

This PR adds a 'Finish' button to the last level (lab2) of a lesson. After a user clicks on the 'Finish' button, we post to milestone so that the level bubble turns green (or purple for an assessment level). Then a message is displayed below the disabled button.

Before clicking:

Screenshot 2024-05-09 at 10 41 37 PM

After clicking:

Screenshot 2024-05-09 at 10 41 25 PM

Note that currently, validation has not been added to aichat levels. Also, for music lab levels, the 'Continue' or 'Finish' buttons appear after validation conditions are satisfied.
When the 'Continue'/'Finish' button is clicked, we post to milestone with idealPassResult so that we will always pass or attain a green (or purple for assessment levels) bubble after clicking the button.

Future work includes sending accurate data to the backend and consuming the server response, i.e., the redirect url.

Scrreencast videos AFTER update:

aichat-finish.mp4
music-finish.mp4

Links

jira

Testing story

Tested locally in both music lab and aichat progressions.

Deployment strategy

Follow-up work

Currently, an assessment level does not turn 'bubble' after 'Continue' or 'Finish' button is clicked until the page reloads. Investigate and resolve if possible.
Update: this is existing behavior but not noticeable in legacy labs since page always reloads on level change. Here's an example in a CSP progression. Note that bubble turns green immediately for an app lab level even before page reload but not for an assessment level - at 0:25 in video.

legacy.mp4

I see in ProgressBubble.jsx that assessment levels render a progress bubble differently.

const displayAssessmentBadge =
isLevelAssessment(level) && !hideAssessmentBadge;
if ((displayAssessmentBadge || hasKeepWorkingFeedback) && !smallBubble) {
return (
<BubbleBadge
badgeType={
hasKeepWorkingFeedback
? BadgeType.keepWorking
: BadgeType.assessment
}
bubbleSize={bubbleSize}
bubbleShape={bubbleShape}
/>
);
}

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

@fisher-alice fisher-alice marked this pull request as ready for review May 9, 2024 23:28
@fisher-alice fisher-alice requested a review from a team May 9, 2024 23:29
Copy link
Contributor

@sanchitmalhotra126 sanchitmalhotra126 left a comment

Choose a reason for hiding this comment

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

Nice! This seems like a solid temp solution for now, and we can revisit in more depth once we have a better understanding of what we want to do across all Lab2 labs. Just a few minor comments.

apps/src/lab2/views/components/Instructions.tsx Outdated Show resolved Hide resolved
apps/src/lab2/views/components/Instructions.tsx Outdated Show resolved Hide resolved
apps/src/lab2/views/components/Instructions.tsx Outdated Show resolved Hide resolved
.button {
width: 100%;
margin-bottom: 10px !important;
&:disabled, &[aria-disabled="true"] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, do the default DSCO button styles not work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this! I added this back when I was using <button> and added this before deciding to use the DSCO button. Will remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI - After discussing with @breville , we're going to keep the style as is to not making any changes, even if subtle, before the music lab launch. After the two launches, we can make a lab2-wide decision on what buttons to use for common components. Thanks!

@@ -106,8 +115,12 @@ interface InstructionsPanelProps {
messageIndex?: number;
/** Optional image URL to display. */
imageUrl?: string;
/** If the next button should be shown. */
showNextButton?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: optional suggestion for this interface & in general - IMO it's preferrable to give a variable/param a more descriptive name rather than a short name with extra description in a comment. That way you know the full meaning wherever that var is used as you're reading the code, and it's less likely to get out of date as the code changes (easier to forget to update the comment than the var name).

some examples:
text -> primaryDisplayText
showContinueButton -> shouldShowContinueButton
showFinishButton -> shouldShowFinishButton
beforeNextLevel -> onBeforeNextLevelNavigation
onNextPanel -> onNextButtonClick

These name changes would cause the extra comments to be redundant and they could be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I probably lean towards longer descriptive names, but I've gotten feedback in the past to shorten variable names. So I think I'll keep as is for now, but definitely worth a team discussion!

};

const finalMessage =
'<strong>You finished this lesson! Check in with your teacher for the next activity.</strong>';
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be translated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a temporary UI solution and will most likely be iterated on in the next couple weeks. We wanted something in place for the pilot so I think maybe for now, keeping as a constant makes sense until we land on a more permanent solution. Thanks for bring up!

}, [beforeFinish]);

// When the level changes, the Finish button is active again if user returns to last level.
useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sanchitmalhotra126 @cnbrenci - since you reviewed, I added this so that 'Finish' button is no longer disabled when user leaves the last level.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not blocking but does it work if you use canShowFinishButton as the dependency for this useEffect? i.e. reset the finish button state whenever we go from showing the finish button to not showing the finish button? Asking only because I'd like to avoid using redux in this inner component if possible (the idea was this inner component could be used standalone outside of the lab2/progress redux framework, but currently it's only used by the parent Instructions component, so not a big deal).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh no! I didn't see this until after I merged. Sorry about that! I can do a fast folllow-up for this. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fisher-alice fisher-alice merged commit 5f65222 into staging May 10, 2024
2 checks passed
@fisher-alice fisher-alice deleted the alice/add-finish-button branch May 10, 2024 16:53
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.

None yet

3 participants