feat(share): copy link on reading history rows behind share_history#6361
Draft
tsahimatsliah wants to merge 3 commits into
Draft
feat(share): copy link on reading history rows behind share_history#6361tsahimatsliah wants to merge 3 commits into
tsahimatsliah wants to merge 3 commits into
Conversation
Adds an opt-in showCopyLink prop to PostItemCard rendering a visible Copy link action beside the vote buttons (native share sheet on mobile, copy + toast elsewhere), wired on the history page via ReadingHistoryList behind the sharing_visibility master switch + the new share_history flag (both default off, flag-off DOM unchanged). Logs the normalized SharePost event with the existing history origin. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
History post links now carry ReferralCampaignKey.SharePost like every other post-link share in the initiative. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A direct copy-link action takes LinkIcon in control and rides the existing share_copy_icon ramp, matching the brief and post-page copy-link surfaces. CopyIcon stays reserved for copying content (summary, selected text). 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 18 — reading history, #14). Stacked on PR 1 (#6343) — base is
claude/website-sharing-visibility-be6b32, notmain.Changes
PostItemCard: new opt-inshowCopyLinkprop (defaultfalse) renders a visible "Copy link" icon action in the row's button cluster, right after the upvote/downvote pair. Single tap opens the native share sheet on mobile (navigator.share) and copies + toasts elsewhere, via the existinguseShareOrCopyLinkhook. SameButtonSize.Smalltertiary button as the vote actions, so row height and title truncation (line-clamp-2) are untouched. The click handlerstopPropagations so the row's "Go to post" link never fires.ReadingHistoryList(the history page's only list): evaluates the gate —useSharingVisibility()master switch, thenshare_historyviauseConditionalFeaturewithshouldEvaluatechained off the master — and passesshowCopyLinkdown. Flag logic stays out of the shared primitive (props-only, per repo convention).LogEvent.SharePostviapostLogEvent(LogEvent.SharePost, post, { extra: { provider, origin } })with the existingOrigin.History— already what this list passes aslogOrigin. No new event or origin minted.post.commentsPermalink, verified on the typedReadHistoryPostmodel (graphql/posts.ts— in thePicklist and selected byREADING_HISTORY_QUERY).Components/History/PostItemCardwithHistoryRow(control absent) andHistoryRowWithCopyLinkstories. The story drives the prop directly because the storybook GrowthBook mock forces boolean flags on; Jest carries the flag-off guarantee.ReadingHistoryList(typed reduce accumulator;new Date(undefined)strict violation with runtime behavior preserved).Flag
share_history, defaultfalse, appended at the end offeatureManagement.ts. Gated on both thesharing_visibilitymaster switch andshare_history; the per-surface flag is only evaluated once the master is on. Flag-off renders the exact PR 1 DOM (prop defaults tofalse, no new wrappers).Menu vs. row decision
Visible row control, no menu entry:
flexon every viewport withshowVoteActions), not hover-revealed — so a visible copy control placed with them serves touch directly. A menu fallback would render a second copy affordance on the same row by default, which was deliberately avoided.ReadingHistoryOptionsMenualready offers "Share post via..." (full share sheet) as the deeper path; a "Copy link" menu entry would make it a third share affordance per row.ShareActionsprimitive's mobile behavior from PR 1.PostItemCardconsumer auditshared/components/history/ReadingHistoryList.tsx→ webappcomponents/history/reading.tsx(/historypage; only consumer of the list)showVoteActions,logOrigin={Origin.History}shared/components/post/infinite/InfiniteReadingHistory.tsx→ReadingHistoryModal(post picker)showButtons={false} clickable={false}showCopyLinkdefaults off and the control is additionally behindshowButtonsshared/components/history/ReadingHistory.spec.tsxNo webapp/extension file renders
PostItemCarddirectly.Verification
node ./scripts/typecheck-strict-changed.js— passpnpm --filter shared lint— pass (webapp source untouched)NODE_ENV=test pnpm --filter shared test— passNODE_ENV=test pnpm --filter webapp test— passcommentsPermalink+ toast +SharePostlog with{ provider, origin: 'history' }; mobile →navigator.share(clipboard untouched); flag-off / master-off / not-opted-in → no copy control, original DOM; one control per row when on; existing vote/hide/menu tests untouched and green.🤖 Generated with Claude Code
Preview domain
https://claude-share-history.preview.app.daily.dev