feat(share): share/copy on hot-take surfaces#6365
Draft
tsahimatsliah wants to merge 2 commits into
Draft
Conversation
Share affordances on every hot-take surface, built on the PR 1 ShareActions primitive: HotTakeItem (V1 + V2) action area, the ProfileUserHotTakes section header, the HotAndColdModal top card, and a header share inside PopularHotTakesList (pages/users.tsx untouched). - deep links land on the owner profile's #hot-takes anchor (getHotTakesProfileUrl), pre-filled text quotes the take - one generic ShareLog event with the new Origin.HotTake for all surfaces; extra.surface distinguishes, target_id = take id / owner id - behind share_hot_takes (default false) AND the sharing_visibility master flag via useHotTakeShareEnabled; flag-off is byte-identical (asserted in Jest on every surface) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replaces the free-string extra.surface vocabulary that shadowed existing enum values: the modal reuses Origin.HotAndCold, the profile surfaces reuse Origin.HotTakeList (target_id already separates item from header), and the leaderboard card gets a proper PopularHotTakes member in place of HotTake. 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 19 — hot takes, #23). Builds on the PR 1 foundation branch.
Changes
Share/copy affordances on every hot-take surface, all composing the shared
ShareActionsprimitive through one newHotTakeShareControl/HotTakeShareButton(flag-gated wrapper):HotTakeItem/HotTakeItem.v2— share icon in the action area (between the owner edit/delete hover group and the upvote), driven by a new optionalownerUsernameprop so existing consumers keep their exact DOM when it is absent.ProfileUserHotTakesheader — section-level share next to the owner "Add" button, shown to owners and visitors, only when the section has at least one take (flag not even evaluated for empty sections).HotAndColdModalcard — share pinned top-right of the top card of the swipe stack only (rendered last + explicitz-20above the swipe-effect overlays); hidden for takes without an author.PopularHotTakesListheader — board-level share implemented INSIDE the component via the existingheaderslot ofLeaderboardList; the custom header mirrors the container's stock heading markup so flag-on only adds the control.pages/users.tsxis untouched (owned byclaude/share-leaderboard, PR feat(share): leaderboard share affordances + share-my-rank card #6359 — post-merge myheaderprop still wins over itstitleActiondefault, so no double affordance).Deep links: new
getHotTakesProfileUrl(username)(reusesHOT_TAKES_ANCHOR, deliberately without theaddHotTakequery thatgetAddHotTakeProfileUrlcarries, which would pop the add-modal for owners) — a shared link lands on the hot-takes section of the owner's profile. Popular-list rows were refactored to the same helper (byte-identical URL). Pre-filled text quotes the take:Hot take: "…" — @user on daily.dev.Logging
One entity-level event for all surfaces — no per-surface event names:
LogEvent.ShareLog(existing) + newOrigin.HotTake = 'hot take'(appended at the end of theOriginenum; the existingHotTakeList/HotAndColdorigins are per-surface vote origins, not a generic hot-take origin)target_id= hot take id (single-take shares) / owner id (section share)extra={ provider, origin, surface }withsurface∈profile item | profile header | hot and cold modal | popular hot takesFlag
share_hot_takes, defaultfalse, appended at the END offeatureManagement.ts. Gated viauseHotTakeShareEnabled=useSharingVisibility()master switch AND the per-topic flag throughuseConditionalFeature+shouldEvaluate(per-topic flag only evaluated once the master switch is on, so control users are never bucketed). Flag-off is byte-identical to the PR 1 branch — asserted in Jest (innerHTMLequality on items, structural identity on headers).V1/V2 variant findings
HotTakeItem.tsxis a wrapper that picks the variant at runtime viauseEngagementBarV2()(auth user +engagement_bar_v2flag): V2 (.v2file,ButtonV2/CardAction) for flagged authenticated users, V1 (QuaternaryButton) otherwise. Both are reachable, so both variants got the identical share control; adescribe.eachspec covers both.Composition audit
HotTakeItemis rendered only byProfileUserHotTakes→ per-item control + section-header control coexist (item + list-header, no same-element duplicates).HotAndColdModal's onboarding mode rendersOnboardingPostCard(posts, not hot takes) — untouched; onlyHotTakeCardgets the control, and only the top card of the stack (asserted: exactly one control withnextTakepresent).PopularHotTakesListrows are plain profile links → header control only.Verification
node ./scripts/typecheck-strict-changed.js— passpnpm --filter shared lint— exit 0NODE_ENV=test pnpm --filter shared test— 297 suites / 2005 tests passedNODE_ENV=test pnpm --filter webapp test— 44 suites / 297 tests passed (incl. MyFeedPage, no re-run needed)git diff --name-only origin/claude/website-sharing-visibility-be6b32...HEAD— 16 files, all in scope;pages/users.tsxabsentHotTakeShare.stories.tsxcovers item (V1 + V2), modal-card and popular-list states plus controls; flag-off stories holdFeaturesReadyContextnot-ready since the repo-widemock/gb.tscoerces false defaults truthy — Jest is the real flag-off guarantee.storybook lintnot runnable (pre-existing).Follow-up (not in this PR)
Image-share for a single hot take (rendering the take as a shareable card image) is likely the right long-term shape for this surface — deliberately not built here; this PR is link+text only.
🤖 Generated with Claude Code
Preview domain
https://claude-share-hot-takes.preview.app.daily.dev