feat(share): make the post-upvote share prompt prominent#6351
Draft
tsahimatsliah wants to merge 1 commit into
Draft
feat(share): make the post-upvote share prompt prominent#6351tsahimatsliah wants to merge 1 commit into
tsahimatsliah wants to merge 1 commit into
Conversation
Redesigns `PostContentShare` — the widget that appears right after a user upvotes a post — from a plain "Should anyone else see this post?" copy-link row into a prominent card that leans into the peak-intent moment. - Reuses the Phase-0 `ShareActions` primitive (inline variant) instead of the bespoke `InviteLinkInput` control, so copy + every social destination are one tap away. - Keeps the existing `useGetShortUrl` data path and `LogEvent.SharePost` logging (now for every provider, not just copy-link). - Stays mounted after a share so the user can hit more than one destination; dismissal moves to an explicit close button. Gated behind the new `share_upvote_prompt` flag AND the `sharing_visibility` master gate. Flag-off renders the current widget unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Stacks on PR 1 (
claude/website-sharing-visibility-be6b32) — review that one first.What changed
packages/shared/src/components/post/common/PostContentShare.tsx— the widget that fires on the post page right after a user upvotes — is redesigned from a plain copy-link row into a prominent, inviting card. This is a peak-end moment (the user just told us they liked the post), so it leans into that rather than whispering.ShareActionsprimitive (variant="inline") instead of the bespokeInviteLinkInputcontrol. Copy link + X / WhatsApp / Facebook / Reddit / LinkedIn / Telegram / Email — and the native share sheet where it exists — are all one tap away.useGetShortUrlstill resolves the tracked short URL (and still gates rendering while pending); the resolved short link is what gets copied/shared. No double-shortening —ShareActionsis handed the already-short link with nocid.postLogEvent(LogEvent.SharePost, post, { provider, origin: Origin.PostContent })— now emitted for every provider, not just copy-link.Origin.PostContentalready existed; no new enum value.CloseButton(the repo's dismissible-card pattern) instead of silently unmounting on copy.bg-brand-float/text-brand-defaultbadge ties the card back to the action that triggered it. Semantic tokens only; verified in light and dark.Flag
share_upvote_prompt— appended at the end offeatureManagement.ts, defaultfalse. Gated on this flag AND the masteruseSharingVisibility()gate, both viauseConditionalFeaturewithshouldEvaluate(the per-surface flag is only evaluated once the master gate passes, and neither is evaluated until the post is actually upvoted). Flag-off renders the current widget byte-for-byte.Copy
Before
After
Storybook
packages/storybook/stories/components/PostContentShare.stories.tsx—Redesigned,Control,RedesignedMobile,RedesignedCopying(play function; stubs the clipboard because the Storybook iframe can't write to the real one).Note for anyone extending this: Storybook aliases
@growthbook/growthbookto a mock whosegetFeatureValuecoerces every falsy default to the truthy string'control', so a flag can never evaluate tofalsethere. Flag-off is simulated by holdingFeaturesReadyContextas not-ready, which is the exact pathuseConditionalFeaturetakes to fall back to the default value.Verification
node ./scripts/typecheck-strict-changed.js— passpnpm --filter shared lint— pass (webapp untouched)NODE_ENV=test pnpm --filter shared test— 295 suites / 1990 tests passNODE_ENV=test pnpm --filter webapp test— 44 suites / 297 tests passPostContentShare.spec.tsx(5 tests): flag-off renders the current UI exactly; the short-URL GraphQL path still runs and its result is what's rendered/copied; copy writes the short link to the clipboard and raises the toast; the mobile path callsnavigator.sharewith the short link and does not touch the clipboard; the close button dismisses.🤖 Generated with Claude Code
Preview domain
https://claude-share-post-upvote-prompt.preview.app.daily.dev