Skip to content

feat(share): copy-link control on squad directory cards#6363

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

feat(share): copy-link control on squad directory cards#6363
tsahimatsliah wants to merge 2 commits into
claude/website-sharing-visibility-be6b32from
claude/share-squad-directory

Conversation

@tsahimatsliah

@tsahimatsliah tsahimatsliah commented Jul 22, 2026

Copy link
Copy Markdown
Member

Part of the sharing-visibility initiative (PR 15 / #18): a small copy-link/share button next to a slightly-narrowed Join Squad button on the squad directory cards.

Changes

  • SquadDirectoryShareButton (new, packages/shared/src/components/cards/squad/): wraps the Phase-0 ShareActions primitive with the squad permalink (verified on the typed Source model), the share_source referral cid, and share logging. Desktop opens the share popover; mobile is a single tap to native share / copy.
  • useSquadDirectoryShareEnabled (new hook): per-topic share_squad_directory flag evaluated only once the sharing_visibility master switch is on (useConditionalFeature + shouldEvaluate), so control users are never bucketed.
  • Per-variant wiring (grid/list density respected, no card height change, no hover layout shift):
    • SquadGrid: full-width Join becomes flex-1 inside a gap-2 row with the icon control.
    • SquadList: control appended to the row (inherits the existing gap-4 on both sides); the truncating text column reserves the extra 3.5rem only when the flag is on.
    • UnfeaturedSquadGrid: Join + control paired in the header row.
  • Flag-off is byte-identical to the base branch — the original button/column class strings and DOM structure are asserted exactly in the specs.
  • Storybook: SquadDirectoryShare.stories.tsx showcases all three variants, flag on/off (flag-off simulated by holding FeaturesReadyContext not-ready since the repo-wide gb mock coerces flags truthy), plus a copy-flow play test.
  • Drive-by (required to pass the strict changed-file guard): cleared pre-existing strict-tsc looseness in SquadGrid.tsx (nullable id/campaign/members handling) with no behavior change.

Flag

share_squad_directory, default false, appended at the end of featureManagement.ts; additionally gated by the sharing_visibility master kill-switch via useSharingVisibility.

Log event

Reuses LogEvent.ShareSource with target_type: source, target_id: <squad id>, and extra: { origin: "squad directory", provider }. Squads are sources in the data model and ShareSource is the existing source-share event (SourceActions, source menu); the surface is distinguished by Origin.SquadDirectory per the initiative's one-event-per-entity convention — no new event name minted, SharePost avoided (post-shaped).

Verification

  • node ./scripts/typecheck-strict-changed.js — passes.
  • pnpm --filter shared lint — passes (after lint:fix formatting).
  • NODE_ENV=test pnpm --filter shared test — 296 suites / 1998 tests passed.
  • NODE_ENV=test pnpm --filter webapp test — 44 suites / 297 tests passed.
  • Specs assert: copy → clipboard + toast; mobile single tap → navigator.share (and copy fallback); flag-off DOM byte-identical (exact class strings + no wrapper); Join Squad mutation still fires with the flag on; master-gate short-circuit (per-topic flag never evaluated when the kill-switch is off).

🤖 Generated with Claude Code

Preview domain

https://claude-share-squad-directory.preview.app.daily.dev

Adds a small copy-link/share button next to a slightly-narrowed Join Squad
button on the three squad directory card variants (featured SquadGrid,
UnfeaturedSquadGrid, mobile SquadList), built on the shared ShareActions
primitive.

- New `SquadDirectoryShareButton` wraps ShareActions with the squad permalink,
  the `share_source` referral cid, and `ShareSource` logging (squads are
  sources; the surface is distinguished by `origin: squad directory`).
- New `useSquadDirectoryShareEnabled` gate: the `share_squad_directory` flag
  is only evaluated once the `sharing_visibility` master switch is on.
- Per-variant layout: grid narrows the full-width Join to `flex-1` inside a
  gap-2 row; the list reserves extra room on the truncating text column; the
  unfeatured grid pairs the control with Join in the header row. Flag-off
  renders the exact original DOM (asserted byte-for-byte in the specs).
- Storybook showcase for all three variants with flag on/off plus a copy-flow
  play test; Jest covers copy → clipboard + toast, native share on mobile,
  logging, flag gating, and that joining still works with the flag on.

Also clears the pre-existing strict-tsc looseness in SquadGrid.tsx so the
changed-file strict guard passes.

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:26pm
storybook Building Building Preview Jul 22, 2026 7:26pm

Request Review

The desktop trigger opens a share popover rather than copying, so the
Share verb family is accurate; Copy link stays for direct-copy buttons.

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