feat(share): share DevCard alongside download#6356
Draft
tsahimatsliah wants to merge 2 commits into
Draft
Conversation
Adds a share/copy-link control next to "Download DevCard" in the DevCard customization step, behind `share_devcard` + the `sharing_visibility` master gate. Shares the profile permalink (its OG image is the DevCard) rather than the raw PNG, so previews render the card and the link still points somewhere useful. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Brings ShareDevcard in line with every other entity share event in the initiative, which all carry a target_id. Co-Authored-By: Claude Opus 4.8 <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.
Part of the sharing-visibility initiative (PR 14 / #24). Builds on PR 1 (#6343) — base branch is
claude/website-sharing-visibility-be6b32, notmain.What changed
The DevCard customization step only offered Download DevCard. Sharing your card meant downloading the PNG and uploading it somewhere yourself.
DevCardStep2.tsxnow renders a share control next to the download button, using the sharedShareActionsprimitive from PR 1 (mobile → single tap to the native share sheet; desktop → share popover with copy link + socials).aria-label="Share DevCard"and a tooltip, so it is keyboard operable and screen-reader labelled.mt-4 flex flex-row items-center justify-center gap-3) reusing the existing button size, so no new row and no layout shift on mobile or desktop.LogEvent.ShareDevcard(already defined, previously unused) with the provider andOrigin.DevCardfrom PR 1.Image or link?
Link — the profile permalink, not the PNG and not
navigator.share({ files }).The profile page already sets the DevCard as its Open Graph image (
getOGImageUrlinProfileLayout,/devcards/v2/{userId}.png?type=wide). So sharinguser.permalink:.png, andReferralCampaignKey.ShareProfile, matching how the profile share already works.File sharing was considered and rejected:
navigator.canShare({ files })is mobile-only and inconsistent, it requires fetching the PNG to a blob first, and the result a recipient gets is an image with no link back to daily.dev. The link path already delivers the image via the OG preview, on every platform, with no feature detection needed.Flag
share_devcard, defaultfalse, appended at the end offeatureManagement.ts. Evaluated viauseConditionalFeaturewithshouldEvaluate, gated on theuseSharingVisibility()master kill-switch. Flag off renders the exact pre-existing markup — the download button keeps its originalmx-auto mt-4 grow-0 self-startclasses and no wrapper is introduced (asserted in tests).Storybook
stories/components/DevCardShareActions.stories.tsx— Desktop, Flag off (download only), Mobile viewport.DevCardStep2lives inwebapp, which storybook does not depend on, so the story mirrors the action row rather than importing the step.Verification
node ./scripts/typecheck-strict-changed.js— passedpnpm --filter shared lint— passedpnpm --filter webapp lint— passedNODE_ENV=test pnpm --filter shared test— 294 suites / 1985 tests passedNODE_ENV=test pnpm --filter webapp test— 45 suites / 303 tests passedNew spec
packages/webapp/__tests__/DevCardStep2.spec.tsxasserts: flag off keeps the download-only row and the original button classes; flag on renders the labelled share control; copy writes the shortened link to the clipboard and shows the toast; native share is used when available (and clipboard is not); the download action still fires the generate mutation and hands the resulting image URL todownloadUrl.pnpm --filter storybook lintis not runnable on this repo (pre-existing).🤖 Generated with Claude Code
Preview domain
https://claude-share-devcard.preview.app.daily.dev