Skip to content

feat(market): add per-market on-chain activity feed tab (#1032) - #1063

Merged
greatest0fallt1me merged 1 commit into
Predictify-org:mainfrom
ranjeetprabhatedu-dotcom:feat/market-activity-feed-1032
Nov 23, 2026
Merged

greatest0fallt1me merged 1 commit into
Predictify-org:mainfrom
ranjeetprabhatedu-dotcom:feat/market-activity-feed-1032

Conversation

@ranjeetprabhatedu-dotcom

Copy link
Copy Markdown
Contributor

Summary

Implements a per-market on-chain activity feed tab displaying live contract events (bet, claim, dispute) with cursor-based pagination, virtualization, and accessible feed semantics.

Closes #1032

Changes

  • lib/stellar/market-activity.ts:
    • Defined MarketActivityEvent interface (id, type, address, amount, outcome, ledgerClosedAt, txHash).
    • Added Zod schemas for strict event payload validation.
    • Implemented parseContractEvent and parseContractEvents safely mapping contract topics/data into normalized events and gracefully ignoring unknown/malformed types without throwing.
    • Implemented fetchMarketActivity supporting cursor pagination, limit, abort signals, and injectable fetchers.
  • hooks/useMarketActivity.ts:
    • React hook managing event state, initial loading, cursor-based pagination (loadMore), error handling, and manual retry.
    • Implemented ID deduplication across pages to prevent duplicate entries.
    • Handled in-flight request aborts and stale response discarding on unmount and market ID changes.
  • components/market/MarketActivityFeed.tsx:
    • Virtualized list using @tanstack/react-virtual with estimated row heights for high-volume event performance.
    • Full WAI-ARIA feed semantics: role="feed", aria-busy, row role="article", aria-posinset, and aria-setsize.
    • Integrates CopyAddress for masked address display and clipboard copy, and Timestamp for relative/absolute time tooltips.
    • Handled loading skeletons, empty state with clear messaging, error state with retry button, and infinite scroll auto-loading near viewport end.
  • app/markets/[id]/MarketDetailClient.tsx:
    • Wired <MarketActivityFeed marketId={marketId} /> into the activity tab slot of MarketDetailTabs.
  • Unit & Integration Tests:
    • lib/stellar/__tests__/market-activity.test.ts: verified parser rules (bet, claim, dispute), unknown type drops, missing address/amount handling, and fetcher behavior (13/13 passing).
    • components/market/__tests__/MarketActivityFeed.test.tsx: verified skeleton loading, empty state, error + retry, feed accessibility, deduplication across pages, market switch mid-flight, and 1,000-item virtualizer rendering window (8/8 passing).

Verification

  • Tested via:
    pnpm test -- lib/stellar/__tests__/market-activity.test.ts components/market/__tests__/MarketActivityFeed.test.tsx components/market/__tests__/market-detail-tabs.test.tsx
    • 3 passed, 3 total suites (31 passed, 31 total tests).
  • ESLint verified:
    pnpm exec eslint lib/stellar/market-activity.ts lib/stellar/__tests__/market-activity.test.ts hooks/useMarketActivity.ts components/market/MarketActivityFeed.tsx components/market/__tests__/MarketActivityFeed.test.tsx app/markets/[id]/MarketDetailClient.tsx
    • 0 errors, 0 warnings.

@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

@ranjeetprabhatedu-dotcom is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel.

A member of the Team first needs to authorize it.

@greatest0fallt1me
greatest0fallt1me merged commit fd746d6 into Predictify-org:main Nov 23, 2026
1 of 2 checks passed
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 per-market on-chain activity feed tab

2 participants