feat(share): copy-my-feed digest button in the feed nav#6362
Draft
tsahimatsliah wants to merge 1 commit into
Draft
feat(share): copy-my-feed digest button in the feed nav#6362tsahimatsliah wants to merge 1 commit into
tsahimatsliah wants to merge 1 commit into
Conversation
Adds a "Copy my feed" button to the mobile feed nav (MobileFeedActions on phones, the FeedNav tablet corner on tablets) that copies — or natively shares on mobile — a Slack-pasteable text digest of the top 20 posts already loaded in the active feed, one bullet per post with a tracked link. The digest is read straight from the TanStack Query cache by prefix-matching the feed query key ([feedName, userId, ...variables]), so no duplicate feed request is ever fired; if fewer than 20 posts are loaded we copy what's there. Links are tracked long links via addLogQueryParams (cid=copy_my_feed) rather than short links, since shortening 20 URLs would cost 20 network calls per copy. Gated behind the new share_copy_my_feed flag (default false) together with the sharing_visibility master switch — flag-off renders nothing and the nav chrome stays pixel-identical. Logs the generic ShareLog event with origin "copy my feed", provider, and postCount. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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, #6343). Adds a "Copy my feed" button to the feed navigation that generates a copyable text digest of the top ~20 posts from the current feed.
What changed
CopyMyFeedButton(packages/shared/src/components/feeds/CopyMyFeedButton.tsx): icon-only Tertiary button (tooltip +aria-label,type="button"), disabled while the active feed has no loaded posts, rendersnullwhile the flag is off.MobileFeedActionsright-side action row (next to quests/giveback).FeedNavcorner overlay (JS-gated withisTabletlike the giveback entry, so phones never mount a hidden duplicate). The last tab's clearance margin bumpsmr-24 → mr-36only when the flag is on, following the precedent from the giveback entry (7689803).FeedNavonly renders below laptop (MainLayoutHeadergates it withisMobile). The laptop+ feed header lives inMainFeedLayout.tsx, which sibling PR 16 owns — a desktop placement is intentionally left out of this PR (see below).useCopyMyFeed: reads the posts straight from the TanStack Query cache — no duplicate feed request. Feed queries are keyed[feedName, userId, ...variables](generateQueryKey+MainFeedLayout), so the hook prefix-matches[activeFeedName, userId](plus[custom, userId, defaultFeedId]for the custom-default-feed-on-/case) and digests the newest matching query with data. Button enablement subscribes to the query cache viauseSyncExternalStorewith a cheap primitive snapshot (dataUpdatedAt), gated off entirely while the flag is off.navigator.share({ text }), feature-detected viashouldUseNativeShare); otherwise copy to clipboard + toast.LogEvent.ShareLogwithextra: { origin: Origin.CopyMyFeed, provider, postCount }(one event per entity, no per-surface event).Origin.CopyMyFeedcomes from PR 1.CopyMyFeedButton.stories.tsx— loaded-feed state with a preview of the exact composed text, empty-feed (disabled), flag-off control (renders nothing, simulated by holdingFeaturesReadyContextnot-ready since the Storybook GB mock can't evaluate false), and a clipboard interaction play test.Tracked-link approach: long links, not short links
Per-link shortening would cost ~20 sequential GraphQL calls per copy, so links go through
addLogQueryParams-style tracked long links instead (getTrackedUrlwith the newReferralCampaignKey.CopyMyFeed→?userid=…&cid=copy_my_feed). Tradeoff: URLs are longer/uglier thandly.tolinks, but the copy is instant and attribution is preserved.Flag
share_copy_my_feed, defaultfalse, appended at the end offeatureManagement.ts. Gated together with thesharing_visibilitymaster switch viauseConditionalFeature+shouldEvaluate(the per-topic flag is only evaluated once the master is on). Flag-off renders nothing — nav DOM/pixels identical to the base branch, asserted in Jest.Verification
node ./scripts/typecheck-strict-changed.js— passpnpm --filter shared lint— pass (0 warnings)NODE_ENV=test pnpm --filter shared test— 295 suites, 1993 tests, all passNODE_ENV=test pnpm --filter webapp test— 44 suites, 297 tests, all passnavigator.sharewith the digest text + ShareLog(provider=native); empty feed → disabled button, no copy; flag-off → empty DOM (component spec) and unmocked-flag-off surface assertion inMobileFeedActions.spec.tsx.🤖 Generated with Claude Code
Preview domain
https://claude-share-copy-my-feed.preview.app.daily.dev