Skip to content

Commit 6cd64e7

Browse files
committed
[Dashboard] Fix: Routes page pagination beyond 1, add og image (#7136)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on updating titles for better clarity and modifying the pagination logic in the routes table component to directly use `routesToRender`, enhancing the user experience in the dashboard. ### Detailed summary - Updated `title` in `page.tsx` files for clarity. - Changed the condition from `paginatedRoutes.length` to `routesToRender.length` in the routes table component. - Removed pagination logic variables (`activePage`, `pageSize`, `startIndex`, `endIndex`, `paginatedRoutes`). - Updated pagination component to use `Number(props.searchParams.page) || 1`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Updated page titles and metadata for improved clarity and consistency, including changes from "On-Ramp" to "Onramp" and a new title for the routes page. - **Refactor** - Simplified the routes list rendering by removing local pagination logic, now displaying data directly as provided without client-side slicing. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 005acce commit 6cd64e7

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Metadata } from "next";
33
import { getClientThirdwebClient } from "../../../../../@/constants/thirdweb-client.client";
44
import { UniversalBridgeEmbed } from "./components/client/UniversalBridgeEmbed";
55

6-
const title = "Universal Bridge: Swap, Bridge, and On-Ramp";
6+
const title = "Universal Bridge: Swap, Bridge, and Onramp";
77
const description =
88
"Swap, bridge, and on-ramp to any EVM chain with thirdweb's Universal Bridge.";
99

Loading

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,11 @@ export async function RoutesData(props: {
7777

7878
const totalPages = Math.ceil(filteredCount / DEFAULT_PAGE_SIZE);
7979

80-
const activePage = Number(props.searchParams.page || 1);
81-
const pageSize = DEFAULT_PAGE_SIZE;
82-
const startIndex = (activePage - 1) * pageSize;
83-
const endIndex = startIndex + pageSize;
84-
const paginatedRoutes = routesToRender.slice(startIndex, endIndex);
85-
8680
return (
8781
<>
8882
<main>
8983
{/* empty state */}
90-
{paginatedRoutes.length === 0 ? (
84+
{routesToRender.length === 0 ? (
9185
<div className="flex h-[300px] items-center justify-center rounded-lg border p-8 lg:h-[500px]">
9286
<p className="text-2xl">No Results found</p>
9387
</div>
@@ -111,7 +105,7 @@ export async function RoutesData(props: {
111105
</TableRow>
112106
</TableHeader>
113107
<TableBody>
114-
{paginatedRoutes.map((route) => (
108+
{routesToRender.map((route) => (
115109
<RouteListRow
116110
key={`${route.originToken.chainId}:${route.originToken.address}-${route.destinationToken.chainId}:${route.destinationToken.address}`}
117111
originChainId={route.originToken.chainId}
@@ -131,7 +125,7 @@ export async function RoutesData(props: {
131125
</TableContainer>
132126
) : (
133127
<ul className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
134-
{paginatedRoutes.map((route) => (
128+
{routesToRender.map((route) => (
135129
<li
136130
key={`${route.originToken.chainId}:${route.originToken.address}-${route.destinationToken.chainId}:${route.destinationToken.address}`}
137131
className="h-full"
@@ -155,12 +149,15 @@ export async function RoutesData(props: {
155149
</main>
156150
<div className="h-10" />
157151
{totalPages > 1 && (
158-
<ChainlistPagination totalPages={totalPages} activePage={activePage} />
152+
<ChainlistPagination
153+
totalPages={totalPages}
154+
activePage={Number(props.searchParams.page) || 1}
155+
/>
159156
)}
160157
<div className="h-4" />
161158
<p className="text-balance text-center text-muted-foreground text-sm">
162159
Showing{" "}
163-
<span className="text-accent-foreground">{paginatedRoutes.length}</span>{" "}
160+
<span className="text-accent-foreground">{routesToRender.length}</span>{" "}
164161
out of{" "}
165162
{filteredCount !== totalCount ? (
166163
<>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
type SearchParams,
1111
} from "./components/server/routes-table";
1212

13-
const title = "Routes: Swap, Bridge, and On-Ramp";
13+
const title = "Universal Bridge Routes: Swap, Bridge, and Onramp";
1414
const description =
1515
"A list of token routes for swapping, bridging, and on-ramping between EVM chains with thirdweb.";
1616

0 commit comments

Comments
 (0)