feat(share): surface share next to Follow on tag and source pages#6357
Draft
tsahimatsliah wants to merge 1 commit into
Draft
feat(share): surface share next to Follow on tag and source pages#6357tsahimatsliah wants to merge 1 commit into
tsahimatsliah wants to merge 1 commit into
Conversation
Promotes copy-link/share out of the buried "…" options menu into the tag and source header action rows, behind `share_tags_sources` plus the `sharing_visibility` master switch. A shared `EntityShareAction` wraps the PR-1 `ShareActions` primitive: a vertical rule plus a ghost icon button keep "share this" spatially and visually distinct from the filled Follow/Following button, and the in-menu Share entry is dropped while the visible control is shown so the action isn't duplicated. Link/text derivation is shared with the existing `CustomFeedOptionsMenu` `shareProps` rather than recomputed. Flag off is pixel-identical to the base branch, asserted by a DOM-equality test against the untouched consumer. Co-Authored-By: Claude Opus 4.8 <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 (PR 9 / #20). Stacked on PR 1 — base is
claude/website-sharing-visibility-be6b32, notmain.What changed
Share is promoted out of the buried
CustomFeedOptionsMenu"…" menu into a visible control in the header action row on both entity pages:TagTopicPageheader (the real tag surface;PageInfoHeadernamed in the brief is aclasseddiv used only by the source page, not by/tags/[tag]).SourceActions, rendered insidePageInfoHeaderon/sources/[source].New shared pieces:
components/share/EntityShareAction.tsx— thin wrapper over PR 1'sShareActions(variant="icon",ButtonVariant.Tertiary,aria-label/tooltip "Share"). Renders as a fragment so the host row's own gap spaces it symmetrically, and leads with a vertical rule.hooks/useShareTagsSources.ts— gate:sharing_visibilitymaster switch first, thenshare_tags_sources, both viauseConditionalFeaturewithshouldEvaluate.Wiring details:
CustomFeedOptionsMenugains an optionalhideShareprop; when the visible control renders, the in-menu "Share" entry is dropped. Defaultfalse, so every other consumer's menu is unchanged.SourceActionsis also rendered byPostUsersHighlights(post page). The new control is behind an opt-inshowShareprop that only/sources/[source]passes, so that consumer's DOM is untouched.TagTopicPageandSourceActionsare independent surfaces — nothing double-renders.sharePropsobject that feeds the visible control and the existingCustomFeedOptionsMenushareProps— no recomputed URLs, both hand out the same link.Flag
share_tags_sources, defaultfalse, appended at the end offeatureManagement.ts. Gated together withuseSharingVisibility().lib/log.tsis not touched —Origin.TagPageandOrigin.SourcePagealready exist.Logging
ShareProvider+ per-surfaceOriginon the existing entity events —LogEvent.ShareTag/LogEvent.ShareSourcewithextra: {provider, origin}.OG meta status, per route
Checked against
next-seo's actualbuildTagsbehaviour rather than assuming./tags/[tag]"<Tag> posts | daily.dev")flags.description, else a generated per-tag sentence)_app'sDefaultSeo(canonicalFromRouter)/sources/[source]source.description, else the site defaultSo a shared tag/source link already unfurls naming the specific entity — no code change was needed, and
next-seofalls back to top-leveldescriptionforog:description, which both routes set per entity. Instead of a no-op edit I added__tests__/TagSourceSeo.spec.tsto lock that behaviour (including the nullable fallbacks) so it can't silently regress now that these links are promoted.Explicitly not faked: per-entity
og:image. There is no OG-image renderer for tags or sources —og.daily.devonly serves/api/posts/:id. For sources,source.imageis a small square logo and the site's Twitter card issummary_large_image, so substituting it would likely make unfurls worse than the branded 1200×630 default. Getting real per-entity images needs a backend/OG-service change, out of scope here.Storybook
stories/components/EntityShareAction.stories.tsx— tag/source × following/not-following, mobile, and a Control story.Verification
node ./scripts/typecheck-strict-changed.js— no new errors. 3 remaining are pre-existing on untouched lines (CustomFeedOptionsMenu.tsx:50,SourceActions/index.tsx:110,118).pnpm --filter shared lint✅ ·pnpm --filter webapp lint✅NODE_ENV=test pnpm --filter shared test— 296 suites / 1994 tests ✅NODE_ENV=test pnpm --filter webapp test— 45 suites / 302 tests ✅buildnot run, per instructions.Tests assert: copy →
clipboard.writeText+ the "✅ Copied link to clipboard" toast; mobile single tap →navigator.share; the entity log event carries provider + origin; the in-menu Share entry disappears only when the visible control shows; and flag-off renders markup byte-identical to the untouched consumer (SourceActions.spec.tsx), plus a flag-off assertion on the tag page inTagPage.tsx.Open questions
ShareTag/ShareSource) vs the brief'sSharePost. See above.globalThis?.location?.href, inherited verbatim from the existing menu wiring, so both controls agree. It carries whatever query string the visitor arrived with. Switching both to a canonical${webappUrl}tags/${tag}would be cleaner for a promoted share control — deliberately left alone to keep flag-off parity, easy follow-up.🤖 Generated with Claude Code
Preview domain
https://claude-share-tags-sources.preview.app.daily.dev