Skip to content

feat(share): copy-link on discovery feeds and best-of archive (PR 16)#6364

Draft
tsahimatsliah wants to merge 2 commits into
claude/website-sharing-visibility-be6b32from
claude/share-discovery
Draft

feat(share): copy-link on discovery feeds and best-of archive (PR 16)#6364
tsahimatsliah wants to merge 2 commits into
claude/website-sharing-visibility-be6b32from
claude/share-discovery

Conversation

@tsahimatsliah

@tsahimatsliah tsahimatsliah commented Jul 22, 2026

Copy link
Copy Markdown
Member

Part of the sharing-visibility initiative (builds on PR 1 / #6343, based on claude/website-sharing-visibility-be6b32).

What

Adds the copy-link/share affordance to the discovery surfaces (plan item #25):

  • Explore feed headers
    • FeedExploreHeader (non-v2; laptop breadcrumb header and mobile sticky tab bar): a ShareActions icon control joins the existing right-side period-dropdown span (Float/Large to match the dropdown). The span only becomes a flex ... gap-2 cluster when the flag is on, so flag-off DOM is unchanged.
    • MainFeedLayout v2 explore strip: the control renders between ExploreSectionTabs and ExploreSortDropdown, spaced by the page header's own gap-2, and only when isAnyExplore — the strip's /discussed instance does not get it (it is the Discussions feed, not an Explore sort; keeps v2/non-v2 surface parity).
    • Both call sites share the new ExploreFeedShareButton, which resolves the canonical webapp URL of the active sort (URL-derived on webapp, tab-state fallback for the extension) so links copied from the extension resolve. Distinct accessible name "Copy link to feed" (feed cards already own per-post "Copy link" buttons).
  • Best-of archive (shared components, rendered by all nine webapp best-of routes: /posts/best-of*, /tags/[tag]/best-of*, /sources/[source]/best-of*)
    • ArchiveIndexPage and ArchiveFeedPage: control next to the h1, sharing the canonical archive URL (getArchiveIndexUrl / getArchiveUrl). Flag-off renders the exact original heading markup.

Logging

One event per entity, per the initiative convention: generic LogEvent.ShareLog with target_id = the page path and extra.origin = new Origin.ExploreFeed / Origin.BestOfArchive (appended at the end of the enum), extra.provider = share provider. No post-shaped events minted.

Flag

share_discovery, default false, appended at the end of featureManagement.ts. Gated via the new useShareDiscovery hook: useSharingVisibility() (master kill-switch) AND the per-topic flag through useConditionalFeature, with the per-topic flag only evaluated once the master gate passes. Flag-off is DOM-identical to the base branch (asserted in Jest via exact class-list checks).

Surfaces that did NOT get the control (and why)

  • /discussed (v2 explore strip instance): Discussions feed, not a discovery sort — kept parity with non-v2 where the header doesn't render there.
  • Explore hub directory pages (/tags, /sources, /users via ExploreHubHeader): out of this PR's scope (refactor: add guide to reputation #25 covers the discovery feeds + best-of archive only).
  • Non-explore feed pages (/, /my-feed, /popular, custom feeds…): guarded by a webapp Jest test that forces the gate on and asserts the control never composes there.

Verification

  • node ./scripts/typecheck-strict-changed.js — pass
  • pnpm --filter shared lint / pnpm --filter webapp lint — pass
  • NODE_ENV=test pnpm --filter shared test — 297 suites / 1995 tests passed
  • NODE_ENV=test pnpm --filter webapp test — 45 suites / 298 tests passed
  • New tests: copy → clipboard + toast; mobile → navigator.share; AND-gating (each flag alone = off); exactly one control; flag-off class-list parity; non-explore composition guard.

Notes

  • The prompt's packages/webapp/components/archive/* paths don't exist — the archive pages live in packages/shared/src/components/archive/ (verified real paths).
  • No Storybook story: the repo's Storybook only aliases @growthbook/growthbook (not -react), so a genuine flag-gated story can't be expressed; Jest is the flag guarantee per the initiative convention. The ShareActions primitive already has stories from PR 1.
  • No referral cid on these links (no matching ReferralCampaignKey for feed/archive pages); plain canonical URLs.

🤖 Generated with Claude Code

Preview domain

https://claude-share-discovery.preview.app.daily.dev

Adds the sharing-visibility affordance to the discovery surfaces behind a
new share_discovery flag (default false, AND-gated with the
sharing_visibility master kill-switch via useSharingVisibility):

- ExploreFeedShareButton: self-gated ShareActions wrapper that shares the
  canonical webapp URL of the active Explore sort and logs the generic
  ShareLog event (Origin.ExploreFeed, target_id = feed path)
- FeedExploreHeader (non-v2, laptop + mobile sticky): control joins the
  right-side period-dropdown span; span only becomes a flex cluster when
  the flag is on so flag-off DOM is unchanged
- MainFeedLayout v2 explore strip: control renders before the sort
  dropdown, only on isAnyExplore pages
- ArchiveIndexPage / ArchiveFeedPage: control next to the h1, sharing the
  canonical archive URL, logging Origin.BestOfArchive
- Jest: flag-off DOM parity, AND-gating, copy -> clipboard + toast,
  native share on mobile, exactly one control, and a webapp guard that
  non-explore feed pages never compose the control

Co-Authored-By: Claude Fable 5 <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 7:53pm
storybook Building Building Preview Jul 22, 2026 7:53pm

Request Review

All three discovery surfaces now pass a referral cid like comparable
surfaces, and the archive controls get explicit Share-family labels instead
of the primitive's Copy link default.

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