Skip to content

feat(client,api): add a per module reset - #62547

Merged
raisedadead merged 3 commits into
freeCodeCamp:mainfrom
raisedadead:feat/reset-modules
May 28, 2026
Merged

raisedadead merged 3 commits into
freeCodeCamp:mainfrom
raisedadead:feat/reset-modules

Conversation

@raisedadead

@raisedadead raisedadead commented Oct 6, 2025 •

Copy link
Copy Markdown
Member

Closes #47464

Note: One of the things that is not handled yet is what do we do if a block etc qualifies for a certification, and the certification has been claimed. I think we could explore than in future PRs.

Screenshots and Demo

Enabled (section has progress) - Superblock:

image

Enabled (section has progress) - Chapter:

image

Disabled (section doesn't have progress:

image

Warning Modal

image

Progress Modal for larger sections (Superblocks or Chapters)

image

Screencap:

Reset-Progress.mp4

@github-actions github-actions Bot added platform: api Server application that needs familiarity with Express, Fastify, MongoDB etc. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: i18n language translation/internationalization. Often combined with language type label labels Oct 6, 2025
@raisedadead

This comment was marked as outdated.

@raisedadead
raisedadead requested a review from SaintPeter October 6, 2025 08:18
@raisedadead
raisedadead marked this pull request as ready for review October 7, 2025 02:48
@raisedadead
raisedadead requested a review from a team October 7, 2025 02:48
@raisedadead raisedadead added status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. and removed status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. labels Oct 7, 2025
@raisedadead
raisedadead marked this pull request as draft October 13, 2025 10:01
@majestic-owl448 majestic-owl448 added the MERGE CONFLICT! To be applied to PR's that have a merge conflict and need updating label Nov 3, 2025
@raisedadead raisedadead removed the MERGE CONFLICT! To be applied to PR's that have a merge conflict and need updating label Feb 1, 2026
@raisedadead
raisedadead force-pushed the feat/reset-modules branch 4 times, most recently from 9c247f9 to 2930020 Compare February 2, 2026 06:57
@github-actions github-actions Bot added the scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. label Feb 2, 2026
@raisedadead
raisedadead force-pushed the feat/reset-modules branch 2 times, most recently from 91b317a to aba052d Compare February 2, 2026 11:46
@raisedadead
raisedadead marked this pull request as ready for review February 2, 2026 12:08
@raisedadead
raisedadead requested review from a team as code owners February 2, 2026 12:08
@SaintPeter

Copy link
Copy Markdown
Member

I'm not set up for testing, but this UI looks amazing. This is very much what I had in mind and I think it's pretty clear.

I'm not 100% on using the "refresh" icon "↻" for the reset, if only because it sort of implies that you are "refreshing" the content. Maybe something like a "recycle" ♻ icon? That has the advantage of being sort of triangular which is also associated with warning.

Other thoughts:

  1. Should we disallow cutting and pasting into the "I agree to reset my progress" box? We want them to really take an active view.
  2. What does the UI look like on mobile? There is no on-hover event on mobile, so discoverability might suffer. I don't know to what degree we're supporting mobile vs the app, but it is something we should consider from a usability aspect.
  3. Will we have an accessibility audit on these as well? The rests will have aria-hidden I'm presuming, but then how are they accessed for a screen reader.

@raisedadead raisedadead added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Feb 3, 2026
@raisedadead

raisedadead commented Feb 3, 2026 •

Copy link
Copy Markdown
Member Author

Thanks for the feedback, appreciate it.

Yeah - the review setup is bad, and I am working on something to hopefully make it better. On to your questions:

..Maybe something like a "recycle" ♻ icon?

It is the same icon we already use in the editor:

image

But I see what you mean. We could do the eraser everywhere. We use FA, so other options are the trash can or the rotate arrow, but to the left (instead of right, like now).

image

Should we disallow cutting and pasting into the "I agree to reset my progress" box?

Actually, it is standard pattern on most sites like GitHub (delete repo, change visibility, etc)

I see that our audience is different. Originally, I went with keeping the text in the placeholder, so it can't be copied.

But that meant the text would disappear, and it would be harder to make a note of what needs to be typed. Disallowing copy/paste would need client side event handling - which is more buggy to deal with. I think the multiple-levels of friction we have is a fair balance. It's all red, red, red. If a user is missing that, there is little to be done.

What does the UI look like on mobile?

It is not the best actually. You will see the icon when selecting the section.

But the issue is larger because the web-based UI is not designed well for the smaller view-ports. I think we should strongly consider dropping support for many features on smaller viewports and promote the native apps instead.

cc @freeCodeCamp/dev-team

Will we have an accessibility audit on these as well?

I think I covered it, but I will double check and update the PR in case I missed something.

@raisedadead

Copy link
Copy Markdown
Member Author

Updates:

  • I dropped the support for the feature from the mobile web.

    The thing is the narrow viewports are already cause issues with the button being misplaced (even if we showed it always instead of on hover). It's better to not have it on mobile web than have a bad UX.

    Screenshot image
  • Update the icons (which replaces all the reset icons), which I think is better.

    Icons.mp4

@ShaunSHamilton ShaunSHamilton 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.

Some suggestions open for discussion, and some code changes that require more changes than the diff UI allows.

Comment thread api/src/routes/protected/user.ts Resolved
Comment thread api/src/routes/protected/user.ts Resolved
Comment thread api/src/routes/protected/user.ts Resolved
Comment thread api/src/routes/protected/user.ts Resolved
Comment thread api/src/routes/protected/user.ts Resolved
@SaintPeter

Copy link
Copy Markdown
Member

I like the eraser icon.

I guess we can live with it being desktop only for now. Perhaps we can find a better home for it in the future. If there were more block-wide actions, a three dot menu might be a good place for it, to the right of the counts.

In terms of functionality, this looks good to me.

@raisedadead

Copy link
Copy Markdown
Member Author

Thanks.

a three dot menu might be a good place for it

I considered it.

The problem is the hit area is same as a any other icon, so it takes up same physical space (to maintain a11y). We could consider collapsing the counts into an icon (which shows counts when clicked??). But that is a broader refactor, beyond this PR.

@ojeytonwilliams ojeytonwilliams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @raisedadead I don't want to get too deep into the weeds, but my high level recommendations are just:

  1. Use { blockIds: [] } as the account/reset-module body, rather than having the client send one request at a time and having to space them out. It's more efficient for the api and faster for the user.
  2. send something back from the api so that the client has enough data to update it's state. The changed parts of the user object could work.

It's not really a recommendation, but the reset-modal is getting unmounted and then attempting to update its state (you can check the console for errors, it happens every time). I didn't dig too deeply into it, because it might go away if you change things, but it's something to keep an eye on.

I also, while thinking about this, noticed a few details along the way. They're less important, particularly if the above recommendations make sense. I'll just review again from scratch.

Comment thread api/src/routes/protected/user.ts Resolved
Comment thread api/src/routes/protected/user.ts Resolved
Comment thread api/src/routes/protected/user.ts Resolved
Comment thread api/src/routes/protected/user.ts Resolved
Comment thread api/src/routes/protected/user.ts Resolved

handleResetConfirm = (): void => {
const { fetchUser } = this.props;
fetchUser();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So, this works, but it's a bit at odds with how we typically do things and results in more api requests. Normally we make a single api call (i.e. the one to /account/reset-module), send some data as a response and use that to update the client's state.

Calling fetchUser is a blunt instrument and is a call we don't have to make.

@majestic-owl448

Copy link
Copy Markdown
Contributor

One of the things that is not handled yet is what do we do if a block etc qualifies for a certification, and the certification has been claimed. I think we could explore than in future PRs.

maybe the completion can't be removed? various certifications save the code of a certification project and show it together with the claimed cert

alternatively, the certification could be revoked

@majestic-owl448 majestic-owl448 added the MERGE CONFLICT! To be applied to PR's that have a merge conflict and need updating label Feb 12, 2026
@raisedadead raisedadead removed the MERGE CONFLICT! To be applied to PR's that have a merge conflict and need updating label Feb 18, 2026
@raisedadead

Copy link
Copy Markdown
Member Author

maybe the completion can't be removed? various certifications save the code of a certification project and show it together with the claimed cert

alternatively, the certification could be revoked

We discussed this in a platform meeting and the abuse vector is not worth adding the complexity. We will leave it as is for now.

@raisedadead

raisedadead commented Feb 18, 2026 •

Copy link
Copy Markdown
Member Author
  • Use { blockIds: [] } as the account/reset-module body, rather than having the client send one request at a time and having to space them out. It's more efficient for the api and faster for the user.
  • send something back from the api so that the client has enough data to update it's state. The changed parts of the user object could work.

The artificial slowed requests is a design element to be honest. The modal (with the progress) has two functions:

  1. I feel that this feature is going to be used way more than say a profile reset—just because it is so accessible. The queries can become heavy on the API as a whole at scale.
  2. The progress gives the user a sense of "reset" of a lot of work. So the next time they use the option, they are more mindful of the decision.

We can always "optimize" it to one call and then update the client in the same request like you recommend in future if we see the feature not getting used as much. I think this is an opportunity to experiment.

Also I feel the "module" is an atomic enough unit, so delegating some computation to the client should be fine.

I will address some of the other points that you have brought up though.

@ahmaxed ahmaxed 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.

Thanks for working on this feature. Here are a few suggestions:

The UI looks legit. The only thing I would change in upcoming prs is finding a solution that would work for mobile as well.

The easiest thing I could think of would be exposing the reset buttons on demand.
For instance, moving the 'Courses' subtitle to the left and adding a button to the right that exposes a column of delete icon could be a viable option for desktop and mobile.

Comment thread client/src/utils/ajax.ts Outdated

export function deleteResetModule(body: {
blockId: string;
}): Promise<ResponseWithData<void>> {

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.

This would throw an error since combineDataWithResponse tries to parse an empty response to a JSON.


handleResetConfirm = (): void => {
const { fetchUser } = this.props;
fetchUser();

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.

I understand that you are trying to show the latest updates to the completed challenges here. If you don't want to return data from a 204 to update the store, I suggest moving the store state modification and api request logic to a saga, send the to be deleted blocks here and handle it accordingly.

Comment thread client/src/assets/icons/reset.tsx Outdated
</svg>
);
function Reset(): JSX.Element {
return <FontAwesomeIcon icon={faEraser} aria-hidden='true' />;

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.

I know this have been discussed, but the circular arrow is more common and versatile.
There is a pr in works to bring the recover saved code to the lower jaw which would use a variation of this icon either with a cloud or a disk.

The best rule of thumb for choosing an icon is searching for the action + icon on the web.

@majestic-owl448 majestic-owl448 added the MERGE CONFLICT! To be applied to PR's that have a merge conflict and need updating label Mar 3, 2026
@Jeevankumar-s Jeevankumar-s removed the MERGE CONFLICT! To be applied to PR's that have a merge conflict and need updating label Mar 26, 2026
@raisedadead
raisedadead force-pushed the feat/reset-modules branch 2 times, most recently from 70f958a to 7df4e51 Compare March 26, 2026 11:58
@majestic-owl448 majestic-owl448 added the MERGE CONFLICT! To be applied to PR's that have a merge conflict and need updating label May 9, 2026
@raisedadead raisedadead removed the MERGE CONFLICT! To be applied to PR's that have a merge conflict and need updating label May 27, 2026
@raisedadead
raisedadead requested a review from ahmaxed May 27, 2026 04:12
@raisedadead
raisedadead force-pushed the feat/reset-modules branch from b305e61 to d6b29c1 Compare May 27, 2026 16:18
@raisedadead
raisedadead requested a review from a team as a code owner May 28, 2026 08:08
@socket-security

Copy link
Copy Markdown

@raisedadead
raisedadead merged commit 5a2606d into freeCodeCamp:main May 28, 2026
16 of 17 checks passed
@raisedadead
raisedadead deleted the feat/reset-modules branch May 28, 2026 13:26
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 28, 2026
@ahmaxed

ahmaxed commented May 28, 2026

Copy link
Copy Markdown
Member

Some reset buttons have been switched to the trash can. I believe we want the trash only for deleting progress on the map.

Screenshot 2026-05-28 at 11 18 16 PM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

platform: api Server application that needs familiarity with Express, Fastify, MongoDB etc. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: i18n language translation/internationalization. Often combined with language type label scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Per-Module Progress Reset

7 participants