Skip to content

Performance sharing FEDEV-2835#2620

Open
qwinndev wants to merge 11 commits into
releasefrom
performance-sharing-FEDEV-2835
Open

Performance sharing FEDEV-2835#2620
qwinndev wants to merge 11 commits into
releasefrom
performance-sharing-FEDEV-2835

Conversation

@qwinndev

@qwinndev qwinndev commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

FEDEV-2835

Adds a "Share PnL" action to the Daily and Cumulative PnL card on the Account Dashboard, opening a share modal with a 460x240 performance card.

  • Reuses the /trade share infrastructure: same image upload + share link flow (uploadElementAsShareImage/getShareURL), referral code behavior including the create-code prompt, and action labels (Copy link, Copy image/Share, Share on X)
  • The card shows PnL %, PnL amount (hideable via the "Show PnL amounts" toggle), win rate, trade count, selected period, a cumulative PnL mini chart, and a QR code carrying the referral link
  • Stats come from accountPnlSummaryStats buckets; the chart's selected from-date maps to a bucket by UTC day boundaries (today / last 7d / last 30d / this year / all time), other periods fall back to all time so the card's stats, period label, and chart stay consistent
  • Sharing is only available on your own account dashboard; the share modal mounts lazily on first open and the button pushes a SharePositionClick analytics event like the other share entry points
  • usePnlHistoricalData extracted from DailyAndCumulativePnL.tsx unchanged so the modal can reuse it; bucket labels shared with GeneralPerformanceDetails

Shared share-modal code extracted into components/ShareModal/ and reused by both PositionShare and PerformanceShare (no behavior changes for /trade sharing):

  • useShareReferralCodeState — affiliate/used code resolution, create-code card + skip-prompt state and analytics
  • useShareCardActions — image upload, copy link / copy image / tweet handlers with analytics
  • ShareCardActionButtons, SkipReferralCodeBanner, ShareCardFrame, ShareCardStat, ShareCardReferralCodeStat, ShareCardQRCode, ShareCardPnlValue — shared modal/card UI pieces
  • CreateReferralCode moved from components/PositionShare/ to components/ShareModal/

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploying gmx-interface-home with  Cloudflare Pages  Cloudflare Pages

Latest commit: 201c493
Status: ✅  Deploy successful!
Preview URL: https://e8fa4380.gmx-interface-home.pages.dev
Branch Preview URL: https://performance-sharing-fedev-28.gmx-interface-home.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploying gmx-interface with  Cloudflare Pages  Cloudflare Pages

Latest commit: 201c493
Status: ✅  Deploy successful!
Preview URL: https://f82560bd.gmx-interface.pages.dev
Branch Preview URL: https://performance-sharing-fedev-28.gmx-interface.pages.dev

View logs

@qwinndev qwinndev changed the title Add account dashboard performance sharing FEDEV-2835 Performance sharing FEDEV-2835 Jul 7, 2026
qwinndev added 6 commits July 7, 2026 17:31
…cycle

- pnlSummaryBuckets: match the selected period by local calendar day
  (differenceInCalendarDays / startOfYear) instead of UTC-day truncation,
  so today/week/month/year no longer become unreachable for UTC-ahead
  users and the 7d/30d presets stay stable across DST. Add a spec.
- PerformanceShareCard: hide the Win rate stat when winsLossesRatioBps is
  undefined (no closed trades) instead of showing a false "0.00%", matching
  GeneralPerformanceDetails.
- PerformanceShare: look up the referral code on the connected wallet chain
  (where CreateReferralCode registers) rather than the dashboard ?network=
  chain, so the create-code prompt and shared code match the wallet.
- DailyAndCumulativePnL: unmount the share modal after it closes so its
  referral polling and PnL queries stop in the background, refresh the
  period bucket on reopen, and reset state when the account is no longer own.
@github-actions

Copy link
Copy Markdown

Playwright Component Test Report

All tests passed.

View Report

Commit 201c493

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