Skip to content

feat(share): copy link on reading history rows behind share_history#6361

Draft
tsahimatsliah wants to merge 3 commits into
claude/website-sharing-visibility-be6b32from
claude/share-history
Draft

feat(share): copy link on reading history rows behind share_history#6361
tsahimatsliah wants to merge 3 commits into
claude/website-sharing-visibility-be6b32from
claude/share-history

Conversation

@tsahimatsliah

@tsahimatsliah tsahimatsliah commented Jul 22, 2026

Copy link
Copy Markdown
Member

Part of the sharing visibility initiative (PR 18 — reading history, #14). Stacked on PR 1 (#6343) — base is claude/website-sharing-visibility-be6b32, not main.

Changes

  • PostItemCard: new opt-in showCopyLink prop (default false) 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 existing useShareOrCopyLink hook. Same ButtonSize.Small tertiary button as the vote actions, so row height and title truncation (line-clamp-2) are untouched. The click handler stopPropagations so the row's "Go to post" link never fires.
  • ReadingHistoryList (the history page's only list): evaluates the gate — useSharingVisibility() master switch, then share_history via useConditionalFeature with shouldEvaluate chained off the master — and passes showCopyLink down. Flag logic stays out of the shared primitive (props-only, per repo convention).
  • Logging: history rows are real posts, so this uses the normalized LogEvent.SharePost via postLogEvent(LogEvent.SharePost, post, { extra: { provider, origin } }) with the existing Origin.History — already what this list passes as logOrigin. No new event or origin minted.
  • Link: post.commentsPermalink, verified on the typed ReadHistoryPost model (graphql/posts.ts — in the Pick list and selected by READING_HISTORY_QUERY).
  • Storybook: Components/History/PostItemCard with HistoryRow (control absent) and HistoryRowWithCopyLink stories. The story drives the prop directly because the storybook GrowthBook mock forces boolean flags on; Jest carries the flag-off guarantee.
  • Drive-by strict fixes surfaced by the changed-file guard in ReadingHistoryList (typed reduce accumulator; new Date(undefined) strict violation with runtime behavior preserved).

Flag

share_history, default false, appended at the end of featureManagement.ts. Gated on both the sharing_visibility master switch and share_history; the per-surface flag is only evaluated once the master is on. Flag-off renders the exact PR 1 DOM (prop defaults to false, no new wrappers).

Menu vs. row decision

Visible row control, no menu entry:

  • The history row's actions are always visible (the vote buttons render flex on every viewport with showVoteActions), 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.
  • The row's ReadingHistoryOptionsMenu already 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.
  • On mobile the visible control taps straight into the native share sheet, matching the ShareActions primitive's mobile behavior from PR 1.

PostItemCard consumer audit

Consumer Usage Effect
shared/components/history/ReadingHistoryList.tsx → webapp components/history/reading.tsx (/history page; only consumer of the list) showVoteActions, logOrigin={Origin.History} Gets the control when flags are on
shared/components/post/infinite/InfiniteReadingHistory.tsxReadingHistoryModal (post picker) showButtons={false} clickable={false} Unchanged — showCopyLink defaults off and the control is additionally behind showButtons
shared/components/history/ReadingHistory.spec.tsx tests Extended; all original assertions untouched

No webapp/extension file renders PostItemCard directly.

Verification

  • node ./scripts/typecheck-strict-changed.js — pass
  • pnpm --filter shared lint — pass (webapp source untouched)
  • NODE_ENV=test pnpm --filter shared test — pass
  • NODE_ENV=test pnpm --filter webapp test — pass
  • New tests: copy → clipboard receives commentsPermalink + toast + SharePost log 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

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>
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
daily-webapp Ready Ready Preview Jul 22, 2026 8:38pm
storybook Building Building Preview Jul 22, 2026 8:38pm

Request Review

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant