Skip to content

feat: add share button for challenge links - #1829

Open
kp-krish wants to merge 2 commits into
freeCodeCamp:mainfrom
kp-krish:feat/share-challenge-link
Open

feat: add share button for challenge links#1829
kp-krish wants to merge 2 commits into
freeCodeCamp:mainfrom
kp-krish:feat/share-challenge-link

Conversation

@kp-krish

@kp-krish kp-krish commented Aug 23, 2026

Copy link
Copy Markdown

Checklist:

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:

Build a Curriculum Outline - Step 1

https://www.freecodecamp.org/learn/responsive-web-design-v9/workshop-curriculum-outline/step-1

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

  • No new dependency. share_plus is already in pubspec.yaml, and this follows the same SharePlus.instance.share(ShareParams(...)) pattern already used by the news tutorial view.
  • The button is gray, per the review feedback on the earlier attempt at this issue. It reuses the existing _panelIconButton helper, so it picks up the same styling as the instruction/preview/console buttons beside it automatically.
  • The URL is no longer duplicated. genForumLink already built the same /learn/<superBlock>/<block>/<dashedName> URL inline. That is now extracted into a challengeUrl helper in challenge_utils.dart and reused in both places.
  • The block name is included alongside the challenge title, matching the naming genForumLink already uses. Sharing just "Step 1" would be ambiguous, since many workshops have a step with that title.
  • The tooltip is localized through a new share_challenge key rather than hardcoded, in keeping with fix: move hardcoded strings to translations #1794. Only app_en.arb is edited by hand; app_es.arb and app_pt.arb are 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-warnings reports no new issues
  • flutter test unit (29 tests) and flutter test services (37 tests) pass, including a new unit test covering challengeUrl
  • Ran the debug build on an Android 36 emulator and confirmed the button renders in the bottom bar with the same styling as its neighbours, and that the share sheet opens with the correct title and step URL

I have screenshots of the button and the share sheet and am happy to add them here.

1-share-button-in-bottom-bar 2-share-sheet-with-step-link

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>
@kp-krish
kp-krish requested a review from a team as a code owner August 23, 2026 01:25
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>
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.

Add link sharing for specific lesson steps in mobile app for Discord assistance

1 participant