Skip to content

Fix: Update routes page to use server-side pagination and filtering #7133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2025

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented May 22, 2025

  • Updated getRoutes to use server-side parameters for filtering and pagination
  • Modified routes-table to work with API pagination response format
  • Changed search placeholder text to be more specific

🤖 Generated with Claude Code


PR-Codex overview

This PR primarily focuses on enhancing the user interface and functionality of the Universal Bridge component within the dashboard application. It introduces new features, modifies existing components, and improves styling for better user experience.

Detailed summary

  • Adjusted CopyTextButton padding and styles.
  • Updated Search input placeholder to "Search by token name or symbol".
  • Added a new section for "Get Started with Universal Bridge" with a call-to-action link.
  • Enhanced route fetching functionality with additional query parameters.
  • Improved UI elements in RouteListRow and RoutesData for better layout and accessibility.
  • Updated pagination logic and filtered route data handling.
  • Enhanced table styling for better visual hierarchy.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features
    • Enhanced search input with a more specific placeholder: "Search by token name or symbol."
    • Improved route search and filtering by moving these operations to the server, resulting in faster and more accurate results.
    • Added promotional banners about Universal Bridge with call-to-action links in multiple dashboard pages.
  • Refactor
    • Simplified client logic for route filtering and pagination, now relying on server-provided results and metadata.
  • Style
    • Updated table header and route list row styling for better visual presentation and alignment.
    • Reduced padding in copy text buttons for a more compact appearance.

- Updated getRoutes to use server-side parameters for filtering and pagination
- Modified routes-table to work with API pagination response format
- Changed search placeholder text to be more specific

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
@gregfromstl gregfromstl requested review from a team as code owners May 22, 2025 23:27
Copy link

changeset-bot bot commented May 22, 2025

⚠️ No Changeset found

Latest commit: c0ebb26

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented May 22, 2025

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

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 0:18am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) May 23, 2025 0:18am
login ⬜️ Skipped (Inspect) May 23, 2025 0:18am
thirdweb_playground ⬜️ Skipped (Inspect) May 23, 2025 0:18am
wallet-ui ⬜️ Skipped (Inspect) May 23, 2025 0:18am

Copy link
Contributor

coderabbitai bot commented May 22, 2025

Walkthrough

The changes shift route filtering and pagination from the client-side to the server-side by updating the API usage and related utility functions. The search input placeholder was also updated for clarity. Client code now passes query parameters to the API, and the API returns filtered, paginated data with metadata, simplifying client logic and removing unnecessary local processing. Additionally, promotional banners with call-to-action links were added in multiple pages, and UI styling adjustments were made in several components.

Changes

File(s) Change Summary
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/client/search.tsx Updated the search input placeholder text from "Search with anything!" to "Search by token name or symbol." No logic or control flow was changed.
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routes-table.tsx Refactored to remove client-side filtering and pagination of routes. Now calls getRoutes with filter and pagination parameters, relying on the server-side for filtering and pagination. Updated the SearchParams type, pagination logic, and removed unused imports and fields. Uses metadata from API response for pagination. Enhanced table header styling with additional classes.
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/utils.ts Extended the getRoutes function to accept additional filtering and pagination parameters, always set sortBy=popularity, and removed conditional authorization header logic. The function now returns the full API response, including a meta object with totalCount and filteredCount. The function signature was updated accordingly.
apps/dashboard/src/@/components/ui/CopyTextButton.tsx Reduced horizontal and vertical padding of the button element in the CopyTextButton component. No logic or control flow changes.
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/page.tsx Added a new promotional banner section with green gradient styling, heading, descriptive text, and a "Learn More" link opening the thirdweb payments portal in a new tab. Positioned absolutely near the bottom of the page with responsive layout and icon usage.
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routelist-row.tsx Updated styling and layout of the RouteListRow component: added group and transition classes, adjusted spacing, increased token icon size, updated border and background styles, added font weight to token symbols, and changed chain name text color and font weight. No logic or data flow changes.
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/page.tsx Imported ArrowUpRightIcon, adjusted header layout spacing and alignment, and added a new green-themed promotional section with heading, descriptive text, and a "Learn More" link opening external documentation in a new tab. Minor spacing adjustments before and after the new section.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/connect/universal-bridge/page.tsx Added a new green-themed promotional section below the PayAnalytics component with heading, descriptive text, and a "Learn More" link opening the thirdweb payments portal in a new tab with security attributes. Imported ArrowUpRightIcon for icon usage. No logic or data fetching changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SearchInput
    participant RoutesTable
    participant Utils (getRoutes)
    participant API

    User->>SearchInput: Enter search query
    SearchInput->>RoutesTable: Pass search parameters
    RoutesTable->>Utils (getRoutes): Call getRoutes({filters, pagination})
    Utils (getRoutes)->>API: GET /routes?filters&pagination
    API-->>Utils (getRoutes): Return filtered, paginated routes + meta
    Utils (getRoutes)-->>RoutesTable: Return data and meta
    RoutesTable-->>SearchInput: Display filtered results and pagination
Loading

Suggested reviewers

  • jnsdls

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

📜 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 2d949d1 and c0ebb26.

📒 Files selected for processing (6)
  • apps/dashboard/src/@/components/ui/CopyTextButton.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/page.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routelist-row.tsx (5 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routes-table.tsx (4 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/page.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/connect/universal-bridge/page.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (3)
  • apps/dashboard/src/@/components/ui/CopyTextButton.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/connect/universal-bridge/page.tsx
  • apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routelist-row.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routes-table.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/page.tsx (4)

1-1: Added necessary icon import for the promotional banner.

The ArrowUpRightIcon import is correctly added to support the new promotional banner section.


47-61: Improved layout structure for better responsiveness.

The header structure has been enhanced with better flex container organization and consistent spacing. The changes properly implement responsive design patterns with appropriate gap spacing and flex direction adjustments between mobile and desktop views.


64-85: Well-implemented promotional section for Universal Bridge.

The promotional banner is well-structured with:

  • Proper responsive layout (column on mobile, row on larger screens)
  • Consistent styling using Tailwind classes
  • Accessible link attributes (target="_blank" with rel="noopener noreferrer")
  • Clear visual hierarchy with appropriate text sizing and spacing

The design aligns with the PR objective to add promotional content for the Universal Bridge feature.


86-86: Good spacing for visual separation.

The added height spacing provides appropriate visual separation between the promotional banner and the RoutesData component below it.

apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/page.tsx (2)

1-1: Added necessary icon import for the promotional banner.

The ArrowUpRightIcon import is correctly added to support the new promotional banner section.


40-66: Well-positioned promotional banner with consistent styling.

The promotional banner implementation is well-executed with:

  • Proper absolute positioning at the bottom of the page
  • Appropriate z-index to ensure visibility above other content
  • Consistent styling with the banner in the routes page
  • Responsive layout that adjusts for different screen sizes
  • Proper container padding and margins

The implementation maintains visual consistency with the banner on the routes page while adapting to the specific layout requirements of the bridge page.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.

Copy link
Contributor

graphite-app bot commented May 22, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label May 22, 2025
Copy link

codecov bot commented May 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.61%. Comparing base (23029db) to head (c0ebb26).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7133   +/-   ##
=======================================
  Coverage   55.61%   55.61%           
=======================================
  Files         902      902           
  Lines       58177    58177           
  Branches     4085     4085           
=======================================
  Hits        32356    32356           
  Misses      25716    25716           
  Partials      105      105           
Flag Coverage Δ
packages 55.61% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routes-table.tsx (1)

78-84: ⚠️ Potential issue

Double pagination issue.

There appears to be both server-side pagination (using offset and limit in the API call) and client-side pagination (slicing the results). This could cause issues with pagination accuracy.

The server already returns paginated results, so client-side pagination is redundant and could lead to showing fewer results than expected. Consider this fix:

- const totalPages = Math.ceil(filteredCount / DEFAULT_PAGE_SIZE);
+ const totalPages = Math.ceil(filteredCount / DEFAULT_PAGE_SIZE);

- const activePage = Number(props.searchParams.page || 1);
+ const activePage = Number(props.searchParams.page || 1);
- const pageSize = DEFAULT_PAGE_SIZE;
- const startIndex = (activePage - 1) * pageSize;
- const endIndex = startIndex + pageSize;
- const paginatedRoutes = routesToRender.slice(startIndex, endIndex);
+ const paginatedRoutes = routesToRender;
🧹 Nitpick comments (1)
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/utils.ts (1)

53-53: Remove outdated comment.

This comment contradicts the changes being made in this PR, which is moving filtering and pagination to server-side.

- // It's faster to filter client side, doesn't seem to be a big performance boost to paginate/filter server side
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5ab59ff and 2d949d1.

📒 Files selected for processing (3)
  • apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/client/search.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routes-table.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(bridge)/utils.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/utils.ts (2)
apps/dashboard/src/@/constants/public-envs.ts (1)
  • NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST (24-25)
apps/dashboard/src/@/constants/server-envs.ts (1)
  • DASHBOARD_THIRDWEB_SECRET_KEY (8-9)
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routes-table.tsx (1)
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/utils.ts (1)
  • getRoutes (8-70)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (10)
apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/client/search.tsx (1)

50-50: Great UX improvement!

The updated placeholder text provides clearer guidance to users about what they can search for, aligning with the server-side filtering capabilities now implemented in the system.

apps/dashboard/src/app/(app)/(dashboard)/(bridge)/utils.ts (4)

8-26: Function signature properly updated to support server-side filtering and pagination.

The function now accepts all necessary parameters for server-side filtering and pagination, with proper TypeScript typing.


31-51: Server-side filtering parameters properly implemented.

All the new filtering parameters are correctly passed to the API endpoint as query parameters.


54-59: Simplified authorization header.

The authorization header has been simplified to only use the x-secret-key header, which is cleaner.


64-69: Return type updated to include metadata for pagination.

The response type has been properly updated to include metadata for pagination, and the function now returns the full response object.

apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routes-table.tsx (5)

15-23: SearchParams type appropriately updated.

The type has been simplified to only include the necessary parameters for the new server-side filtering approach.


30-36: Filter object structure updated for server-side filtering.

The filters object now uses the new query parameter names that match the updated getRoutes function.


44-44: Filter conditions properly mapped to new query parameters.

Text-based searches are now properly mapped to the new originQuery and destinationQuery parameters.

Also applies to: 52-52


55-60: API call properly updated for server-side pagination and filtering.

The call to getRoutes now includes the necessary pagination parameters (limit and offset) and filter parameters.


62-66: Return structure updated to use server response metadata.

The function now properly returns the routes data along with the total and filtered counts from the API response.

Copy link
Contributor

github-actions bot commented May 22, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 56.62 KB (0%) 1.2 s (0%) 355 ms (+148.73% 🔺) 1.5 s
thirdweb (cjs) 309.13 KB (0%) 6.2 s (0%) 1.2 s (+9.89% 🔺) 7.4 s
thirdweb (minimal + tree-shaking) 5.69 KB (0%) 114 ms (0%) 46 ms (+413.84% 🔺) 160 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 33 ms (+805.15% 🔺) 44 ms
thirdweb/react (minimal + tree-shaking) 19.5 KB (0%) 390 ms (0%) 141 ms (+463.68% 🔺) 531 ms

- Updated `CopyTextButton` styles for improved spacing and appearance.
- Added a promotional section for Universal Bridge on multiple pages, including `bridge/page.tsx`, `routes/page.tsx`, and `universal-bridge/page.tsx`, featuring a call-to-action button.
- Improved layout and styling of route list components for better user experience.

This update aims to enhance the visibility and accessibility of the Universal Bridge feature across the dashboard.
@vercel vercel bot temporarily deployed to Preview – login May 23, 2025 00:04 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 23, 2025 00:04 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 May 23, 2025 00:04 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 23, 2025 00:04 Inactive
- Adjusted the positioning of a div in `bridge/page.tsx` to enhance the overall layout and visual consistency.
- Removed unnecessary class from the div to streamline the styling.

This change aims to improve the user interface and maintain a clean design across the dashboard.
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 23, 2025 00:05 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 23, 2025 00:05 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 May 23, 2025 00:05 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 23, 2025 00:05 Inactive
@gregfromstl gregfromstl merged commit 678c00e into main May 23, 2025
24 checks passed
@gregfromstl gregfromstl deleted the greg/fix-routes-page-crashing branch May 23, 2025 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant