Skip to content

Add social share for completed hands (canvas image + Twitter/X + copy as text) - #484

Merged
Marvy247 merged 1 commit into
HitEmPoka:mainfrom
gboigwe:fix/162-social-share-big-wins
Aug 31, 2026
Merged

Add social share for completed hands (canvas image + Twitter/X + copy as text)#484
Marvy247 merged 1 commit into
HitEmPoka:mainfrom
gboigwe:fix/162-social-share-big-wins

Conversation

@gboigwe

@gboigwe gboigwe commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a share button to each completed hand in the hand history panel, offering:

  • Share to X: uses the Web Share API with the rendered canvas image when the browser/device supports sharing files (navigator.canShare({ files })); falls back to opening Twitter/X's web intent with the text pre-filled plus triggering an image download, since Twitter's intent URL has no way to attach an image directly — a real platform limitation, not something a client-side app can work around.
  • Copy as text: copies a plain-text summary (hand rank, pot size, table/hand number, explorer link) to the clipboard.
  • Download image: saves the canvas-rendered summary image directly.

The canvas summary and the share text both include hand rank, pot size, and a link to the hand's transaction on the explorer (via the existing stellarExpertUrl helper), per the issue.

Issue

Closes #162

Test plan

  • npx vitest run — 131 passed, same 4 pre-existing failures as on main (audio-controls.test.tsx, reconnect-state.test.ts — unrelated, unchanged by this work)
  • Added hand-share.test.ts (8 tests): share-text formatting incl. fallback for missing rank/no tx hash, Twitter intent URL encoding, canvas dimensions, and graceful (non-throwing) degradation when the environment has no 2D canvas context
  • Added hand-share-button.test.tsx (4 tests): button open/close, modal contents, clipboard copy + "Copied!" feedback
  • Caught and fixed a real bug in my own first draft: a vi.stubGlobal("navigator", ...) in the new component test wasn't being unstubbed after each test, which leaked into and broke an unrelated test file (replay-viewer.test.tsx) when running the full suite. Added the missing afterEach(() => vi.unstubAllGlobals()) and confirmed the full suite is clean again.
  • npx tsc --noEmit — no new errors from this change. All remaining errors are pre-existing and unrelated (token-selector.test.tsx, page.tsx:668, Table.tsx replayEntry/setReplayEntry, reconnect-state.ts) — not touched, since this PR doesn't cause them.

…+ copy as text)

- hand-share.ts: builds a plain-text hand summary (rank, pot, table/
  hand number, explorer link), renders a canvas summary image, and
  converts it to a PNG blob for sharing
- HandShareButton.tsx: share modal offering "Share to X" (uses the Web
  Share API with the rendered image when supported, falling back to
  the Twitter/X web intent + an image download when it isn't, since
  Twitter's intent URL cannot attach an image directly), "Copy as
  text", and "Download image"
- HandHistoryPanel.tsx: adds the share button next to the existing
  replay button on each completed hand entry

Closes HitEmPoka#162
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@gboigwe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Marvy247
Marvy247 merged commit 14b5608 into HitEmPoka:main Aug 31, 2026
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.

Add a social share feature for big wins and bad beats

2 participants