Skip to content

Use tanstack table for leaderboard#183

Merged
elliotBraem merged 1 commit intostagingfrom
feat/tanstack-table
Jun 20, 2025
Merged

Use tanstack table for leaderboard#183
elliotBraem merged 1 commit intostagingfrom
feat/tanstack-table

Conversation

@itexpert120
Copy link
Collaborator

@itexpert120 itexpert120 commented Jun 20, 2025

Screencast.From.2025-06-21.02-42-55.mp4

Summary by CodeRabbit

  • New Features

    • Introduced a modern, filterable, and sortable leaderboard with enhanced UI components, including search, feed and timeframe filters, and expandable rows.
    • Added skeleton loading states for leaderboard tables.
    • Improved leaderboard filtering, sorting, and pagination options for a more interactive experience.
  • Improvements

    • Enhanced consistency and detail in moderation history and activity data across the app and API.
    • Standardized API responses and validation for activity and moderation endpoints.
    • Upgraded database schema to provide richer moderation metadata and support for new activity types.
    • Improved type safety and validation throughout the system.
  • Bug Fixes

    • Addressed issues with leaderboard data accuracy and display.
    • Fixed inconsistencies in moderation and submission data handling.
  • Chores

    • Removed obsolete test files, seed data, and internal validation/type definitions to streamline the codebase.
    • Updated dependencies and workspace configuration for better maintainability.

@vercel
Copy link

vercel bot commented Jun 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
curatedotfun-app 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jun 20, 2025 9:47pm

@coderabbitai
Copy link

coderabbitai bot commented Jun 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces a comprehensive refactor and enhancement of the activity and moderation features across the backend and frontend. It standardizes API validation and response schemas using centralized Zod schemas, updates moderation history data structures, improves type safety, and migrates database schemas. Extensive test and validation files are removed or updated, and the frontend leaderboard is modularized with new components and hooks.

Changes

Files / Group Change Summary
apps/api/package.json, apps/api/test/*, apps/api/test/utils/*, apps/api/test/setup/* Removed test scripts, test files, test data factories, helpers, and seed scripts.
apps/api/src/routes/api/activity.ts, apps/api/src/routes/api/submission.ts Refactored to use centralized Zod schemas, improved validation, error handling, and standardized response formats; updated moderation history mapping.
apps/api/src/services/activity.service.ts, apps/api/src/services/moderation.service.ts, apps/api/src/services/submission.service.ts Enhanced type safety, updated method signatures, improved moderation data handling, added new moderation fetching methods, and updated error/logging conventions.
apps/api/src/validation/activity.validation.ts Removed local activity validation schemas and types.
apps/app/package.json Added @tanstack/react-table dependency.
apps/app/src/components/Leaderboard.tsx Refactored to use new hook and modular components for leaderboard display and filtering.
apps/app/src/components/leaderboard/*, apps/app/src/hooks/useLeaderboard.ts Added modular leaderboard components (filters, table, skeleton), columns, and a custom hook for state and filtering.
apps/app/src/lib/api/activity.ts Replaced local types with imports from @curatedotfun/types, improved type safety and query parameter handling.
packages/shared-db/migrations/*, packages/shared-db/src/schema/activity.ts, packages/shared-db/src/schema/moderation.ts, packages/shared-db/src/schema/users.ts Migrated and updated database schemas for activity and moderation, added new columns and enums, and defined relations and Zod schemas.
packages/shared-db/src/repositories/activity.repository.ts, packages/shared-db/src/repositories/leaderboard.repository.ts, packages/shared-db/src/repositories/moderation.repository.ts, packages/shared-db/src/repositories/submission.repository.ts Refactored to use query builder/upsert for stats, updated moderation mapping, added new moderation query methods, and improved type safety.
packages/shared-db/src/validators.ts Removed activity, userStats, and feedUserStats validation schemas and types.
packages/types/src/api/activity.ts, packages/types/src/api/common.ts, packages/types/src/api/moderation.ts Added/updated API schemas and types for activity, moderation, and common query options with Zod.
packages/types/src/domain/submission.ts Updated moderationHistory type to use new ModerationAction.
packages/types/src/dtos/activity.dto.ts Removed old DTO schemas and types for activity.
packages/types/src/index.ts Changed export from old DTOs to new API activity types.
pnpm-workspace.yaml Changed package globs to unquoted, added onlyBuiltDependencies key.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant API_Route
  participant Service
  participant Repository
  participant DB

  Client->>API_Route: Sends request (e.g., get leaderboard)
  API_Route->>API_Route: Validate with Zod schema
  API_Route->>Service: Call service method with validated params
  Service->>Repository: Query or update data with typed params
  Repository->>DB: Execute query/upsert
  DB-->>Repository: Return results
  Repository-->>Service: Return typed/validated data
  Service-->>API_Route: Return parsed/validated response
  API_Route->>API_Route: Wrap response with Zod response schema
  API_Route-->>Client: Send standardized API response
Loading

Possibly related PRs

  • PotLock/curatedotfun#62: Reverts module federation for plugins, directly related to the refactor and removal of federation code in this PR.
  • PotLock/curatedotfun#171: Also modifies apps/api/src/routes/api/submission.ts, focusing on moderation response fields—touches related code areas.
  • PotLock/curatedotfun#181: Shares many of the same file and feature changes, indicating direct connection as part of the same refactor/enhancement effort.

Suggested reviewers

  • elliotBraem

Poem

In the warren where schemas grow,
The rabbits refactor, to and fro.
Zod brings order, types align,
Moderation’s fields now clearly defined.
Leaderboards leap with modular grace,
Old tests and scripts, we now erase.
🐇 Onward we hop, with code in place!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5080606 and 6eb4f0d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (50)
  • apps/api/package.json (0 hunks)
  • apps/api/src/routes/api/activity.ts (13 hunks)
  • apps/api/src/routes/api/submission.ts (3 hunks)
  • apps/api/src/services/activity.service.ts (9 hunks)
  • apps/api/src/services/moderation.service.ts (11 hunks)
  • apps/api/src/services/submission.service.ts (0 hunks)
  • apps/api/src/validation/activity.validation.ts (0 hunks)
  • apps/api/test/README.md (0 hunks)
  • apps/api/test/component/approval-flow.test.ts (0 hunks)
  • apps/api/test/component/submission-flow.test.ts (0 hunks)
  • apps/api/test/curate.config.test.json (0 hunks)
  • apps/api/test/e2e/full-flow.test.ts (0 hunks)
  • apps/api/test/integration/database.test.ts (0 hunks)
  • apps/api/test/setup/seed-test.ts (0 hunks)
  • apps/api/test/setup/seed.sql (0 hunks)
  • apps/api/test/unit/sanitize.test.ts (0 hunks)
  • apps/api/test/unit/services/scheduler/scheduler.service.test.ts (0 hunks)
  • apps/api/test/utils/test-client.ts (0 hunks)
  • apps/api/test/utils/test-data.ts (0 hunks)
  • apps/api/test/utils/test-helpers.ts (0 hunks)
  • apps/api/test/utils/test-server.ts (0 hunks)
  • apps/app/package.json (1 hunks)
  • apps/app/src/components/Leaderboard.tsx (2 hunks)
  • apps/app/src/components/leaderboard/LeaderboardColumns.tsx (1 hunks)
  • apps/app/src/components/leaderboard/LeaderboardFilters.tsx (1 hunks)
  • apps/app/src/components/leaderboard/LeaderboardSkeleton.tsx (1 hunks)
  • apps/app/src/components/leaderboard/LeaderboardTable.tsx (1 hunks)
  • apps/app/src/components/leaderboard/index.ts (1 hunks)
  • apps/app/src/hooks/useLeaderboard.ts (1 hunks)
  • apps/app/src/lib/api/activity.ts (1 hunks)
  • packages/shared-db/migrations/0015_ambiguous_the_watchers.sql (1 hunks)
  • packages/shared-db/migrations/0016_ambitious_blazing_skull.sql (1 hunks)
  • packages/shared-db/migrations/meta/0015_snapshot.json (1 hunks)
  • packages/shared-db/migrations/meta/0016_snapshot.json (1 hunks)
  • packages/shared-db/migrations/meta/_journal.json (1 hunks)
  • packages/shared-db/src/repositories/activity.repository.ts (5 hunks)
  • packages/shared-db/src/repositories/leaderboard.repository.ts (2 hunks)
  • packages/shared-db/src/repositories/moderation.repository.ts (6 hunks)
  • packages/shared-db/src/repositories/submission.repository.ts (3 hunks)
  • packages/shared-db/src/schema/activity.ts (4 hunks)
  • packages/shared-db/src/schema/moderation.ts (4 hunks)
  • packages/shared-db/src/schema/users.ts (2 hunks)
  • packages/shared-db/src/validators.ts (0 hunks)
  • packages/types/src/api/activity.ts (1 hunks)
  • packages/types/src/api/common.ts (1 hunks)
  • packages/types/src/api/moderation.ts (2 hunks)
  • packages/types/src/domain/submission.ts (3 hunks)
  • packages/types/src/dtos/activity.dto.ts (0 hunks)
  • packages/types/src/index.ts (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@itexpert120 itexpert120 changed the base branch from main to staging June 20, 2025 21:48
@elliotBraem elliotBraem merged commit bce477e into staging Jun 20, 2025
1 of 3 checks passed
@elliotBraem elliotBraem deleted the feat/tanstack-table branch June 20, 2025 21:50
elliotBraem added a commit that referenced this pull request Jun 21, 2025
* moderation handle platform_user_id and near account id

* standardize activity

* fmt

* delete tests

* fix shared types

* activity leaderboard

* throw not error

* fix services

* feat: use tanstack table for leaderboard (#183)

* fix: mobile layout improvement feed page (#185)

* Refactors create feed flow, steps use router (#188)

* wip

* feed types

* better feed form

* Update packages/shared-db/tsconfig.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/settings.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/index.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* set lock

* nitpicks

* fmt

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Implements JWT auth flow with 7 day tokens (#187)

* better auth services

* nit picks

* nonce validation

* nitpicks

* clean up

* fix error types

* import error

* fix auth requests

* fix: toast colors not correct (#189)

* fix: toast colors not corrent

* fmt

* fix feed

* fix zod type

* fix @ and config

* fmt

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
elliotBraem added a commit that referenced this pull request Jun 23, 2025
* moderation handle platform_user_id and near account id

* standardize activity

* fmt

* delete tests

* fix shared types

* activity leaderboard

* throw not error

* fix services

* feat: use tanstack table for leaderboard (#183)

* fix: mobile layout improvement feed page (#185)

* Refactors create feed flow, steps use router (#188)

* wip

* feed types

* better feed form

* Update packages/shared-db/tsconfig.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/settings.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/index.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* set lock

* nitpicks

* fmt

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Implements JWT auth flow with 7 day tokens (#187)

* better auth services

* nit picks

* nonce validation

* nitpicks

* clean up

* fix error types

* import error

* fix auth requests

* fix: toast colors not correct (#189)

* fix: toast colors not corrent

* fmt

* fix feed

* fix zod type

* fix @ and config

* fmt

* feat: add settings page UI

* feat: add route based tab navigation

* feat: welcome route for new feed (#192)

* feat: welcome route for new feed

* fix: feed overflow in top feeds column of leaderboard

* fix: coderabbit comments

* moderate submissions

* fmt

* fmt

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
elliotBraem added a commit that referenced this pull request Jun 24, 2025
* moderation handle platform_user_id and near account id

* standardize activity

* fmt

* delete tests

* fix shared types

* activity leaderboard

* throw not error

* fix services

* feat: use tanstack table for leaderboard (#183)

* fix: mobile layout improvement feed page (#185)

* Refactors create feed flow, steps use router (#188)

* wip

* feed types

* better feed form

* Update packages/shared-db/tsconfig.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/settings.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/index.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* set lock

* nitpicks

* fmt

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Implements JWT auth flow with 7 day tokens (#187)

* better auth services

* nit picks

* nonce validation

* nitpicks

* clean up

* fix error types

* import error

* fix auth requests

* fix: toast colors not correct (#189)

* fix: toast colors not corrent

* fmt

* fix feed

* fix zod type

* fix @ and config

* fmt

* feat: add settings page UI

* feat: add route based tab navigation

* feat: welcome route for new feed (#192)

* feat: welcome route for new feed

* fix: feed overflow in top feeds column of leaderboard

* fix: coderabbit comments

* moderate submissions

* fmt

* fmt

* adds auto approval

* auto approval

* upgrade fastintear

* fix auth flow

* upgrade packages

* nitpicks

* Introduces worker service w/ queues, enables auto-approval (#196)

* init

* clean up

* fmt

* build fixes

* init

* running

* working auto approval

* init

* clean up

* fmt

* build fixes

* init

* running

* working auto approval

* clean up

* nitpicks

* update pnpm lock

* add @roamhq/wrtc

* docker and type module

* agent-twitter-client

* add rspack

* REDIS_URL

* bullmq workaround

* clean config

* fix auth flow

* same flow

* logger

* better logger

* railway logger

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.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.

2 participants