feat: add share button for challenge links - #1829
Open
kp-krish wants to merge 2 commits into
Open
Conversation
Adds a share button to the challenge bottom bar so campers can share a link to the exact step they are on, instead of posting screenshots when asking for help. - extracts the learn URL into a `challengeUrl` helper and reuses it in `genForumLink`, so the URL is built in one place - uses the existing `share_plus` dependency and the same `SharePlus.instance.share` pattern as the news tutorial view - shares "<block name> - <challenge title>" alongside the link, matching the naming `genForumLink` already uses, so a shared step is identifiable out of context - adds a localized tooltip rather than a hardcoded string - covers `challengeUrl` with a unit test Closes freeCodeCamp#1295 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both locales currently carry the untranslated English strings, so the new key is mirrored there rather than left to Crowdin. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist:
mainbranch of the repo.Closes #1295
Adds a share button to the challenge bottom bar so campers can share a link to the exact step they are on, rather than posting screenshots of the instructions or their code when asking for help on Discord or the forum.
Tapping it opens the native share sheet with, for example:
The share sheet includes "Copy to clipboard", so this also covers the clipboard behaviour described in the issue, while letting campers send the link straight to Discord in one step.
Implementation notes
share_plusis already inpubspec.yaml, and this follows the sameSharePlus.instance.share(ShareParams(...))pattern already used by the news tutorial view._panelIconButtonhelper, so it picks up the same styling as the instruction/preview/console buttons beside it automatically.genForumLinkalready built the same/learn/<superBlock>/<block>/<dashedName>URL inline. That is now extracted into achallengeUrlhelper inchallenge_utils.dartand reused in both places.genForumLinkalready uses. Sharing just "Step 1" would be ambiguous, since many workshops have a step with that title.share_challengekey rather than hardcoded, in keeping with fix: move hardcoded strings to translations #1794. Onlyapp_en.arbis edited by hand;app_es.arbandapp_pt.arbare left to Crowdin.Scope
The button is added to
ChallengeView, which covers the code-editor challenges and daily challenges. The alternative templates (python, english, multiple choice, quiz, review) each render their own bottom bar, so they are not affected. Happy to extend it to those in this PR if you would prefer.Testing
Verified on Flutter 3.44.9 (the version pinned in CI):
flutter analyze --no-fatal-warningsreports no new issuesflutter test unit(29 tests) andflutter test services(37 tests) pass, including a new unit test coveringchallengeUrlI have screenshots of the button and the share sheet and am happy to add them here.