feat(share): share controls on Happening Now (page, topic, highlight)#6355
Draft
tsahimatsliah wants to merge 2 commits into
Draft
feat(share): share controls on Happening Now (page, topic, highlight)#6355tsahimatsliah wants to merge 2 commits into
tsahimatsliah wants to merge 2 commits into
Conversation
Adds three levels of share/copy on the Happening Now surface behind the `share_happening_now` flag (AND the `sharing_visibility` master switch): - page: share popover next to the "Happening Now" title - topic: copy control in the channel's `DigestCTA` - highlight: copy control next to "Read more" in an expanded `HighlightItem` All three reuse the PR 1 `ShareActions` primitive through a thin logging wrapper so every level emits the same `Origin.HappeningNow` payload. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Page and topic levels now pass a referral cid like every comparable surface, and trigger labels move to the Share verb family since the desktop trigger opens a share popover rather than copying. 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. Builds on PR 1 (
claude/website-sharing-visibility-be6b32) — base this branch on it, notmain.What changed
Three levels of share/copy on the Happening Now surface, all reusing the PR 1
ShareActionsprimitive:HighlightsPage.tsxheader, right of the "Happening Now" titleShareActionsicon trigger,aria-label="Share Happening Now". Link tracks the active tab (/highlights,/highlights/all,/highlights/<channel>).DigestCTA.tsx, left of the digest notify buttonaria-label="Copy link to <displayName>", links to that channel's tab.HighlightItem.tsx, next to "Read more" in the expanded bodyaria-label="Copy link to this highlight", links topost.commentsPermalink.commentsPermalinkwas verified against the typed model: it is a requiredstringonPostHighlightFeed['post']and is selected byPOST_HIGHLIGHT_FEED_FRAGMENT. It's already used directly as a share href elsewhere (ShareBar).New
HighlightShareButton.tsxis a thin logging wrapper aroundShareActionsso all three levels emit an identically shaped event withOrigin.HappeningNow(added by PR 1 — not duplicated) plus aleveldiscriminator. It uses the genericLogEvent.ShareLog: a highlight is not a fullPosthere (the feed query returns only id + permalink), soSharePostwould emit events missing every standard post property.lib/log.tsis untouched.Avoiding triple-rendering
The composition is:
TabContainerdefaults toshouldMountInactive: falseandHighlightsPagedoesn't override it, so only one tab subtree mounts — never NDigestCTAs.DigestCTAis rendered from exactly one place (ChannelTab) and is not composed byHighlightItemorHighlightFeedList. BothHighlightItemandDigestCTAhave no render sites outsidecomponents/highlights/.?highlight=route param), so the three levels do not stack into a row of share buttons. A test asserts exactly one control per level on a channel tab.Flag
share_happening_now, defaultfalse, appended at the very end offeatureManagement.ts. Evaluated once inHighlightsPageviauseConditionalFeaturewithshouldEvaluate: useSharingVisibility().isEnabled, then threaded down as a resolvedshowShare/shareLinkprop — GrowthBook is not re-evaluated per highlight row, andHighlightItemstays provider-light.Flag-off is byte-identical to the PR 1 branch: every new node is gated on the new prop, the
Read morelink and the digest notify<span>keep their original markup/classes, and the digest copy only getsmin-w-0 flex-1 truncatewhen the share control is actually rendered.Storybook
packages/storybook/stories/components/HappeningNowShare.stories.tsx—AllLevels,FlagOff,PageLevel,TopicLevel,ItemLevel,MobileWidth. Because the components take a resolved boolean prop rather than reading the flag themselves, the known-brokenmock/gb.ts(value || 'control'makes falsy flags read as truthy) is not in the path — theFlagOffstory is a real control.Verification
node ./scripts/typecheck-strict-changed.js— passpnpm --filter shared lint— pass (webapp untouched)NODE_ENV=test pnpm --filter shared test— 295 suites / 1991 tests passNODE_ENV=test pnpm --filter webapp test— 44 suites / 297 tests passNew tests assert: copy writes to the clipboard and pushes the
✅ Copied link to clipboardtoast; a single tap callsnavigator.shareon mobile; exactly one control renders per level with no duplication; and flag-off renders none of the three while keeping "Read more" intact.🤖 Generated with Claude Code
Preview domain
https://claude-share-happening-now.preview.app.daily.dev