Skip to content

Commit b366d56

Browse files
committed
[MNY-195] Dashboard: Remove Dexscreener on erc20 public page, add token info card (#8103)
<!-- ## 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 enhancing the UI components and functionality in the `ERC20` public page, improving styles, and refactoring the token info fetching logic. ### Detailed summary - Removed `dex-screener.tsx` and `dex-screener-chains.ts`. - Adjusted padding in `ContractHeader.tsx`. - Added shadow to a div in `BuyAndSwapEmbed.tsx`. - Updated border styles in `ERC20PublicPage.tsx`. - Introduced `TokenInfoSection` for displaying token info. - Refactored `fetchTokenInfoFromBridge` to use `ThirdwebClient`. - Added icons in `ContractAnalyticsOverview` and `RecentTransfers`. - Improved layout and styles for various components. > ✨ 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** * Added token summary section (Price, Market Cap, 24h Volume) on ERC20 public pages. * **Style** * Visual polish: added shadow, larger rounded corners, adjusted headers, spacing, and rounded chart containers. * Chart and analytics headers now support/display icons; some header background styling simplified. * **Changes** * Removed embedded DexScreener integration and related chain-slug mapping. * **Refactor** * Token info fetching switched to a client-based SDK call; formatting helpers added for USD display. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent e568bce commit b366d56

File tree

11 files changed

+134
-192
lines changed

11 files changed

+134
-192
lines changed

apps/dashboard/src/@/components/blocks/BuyAndSwapEmbed.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function BuyAndSwapEmbed(props: {
6767
}, [props.pageType]);
6868

6969
return (
70-
<div className="bg-card rounded-2xl border overflow-hidden flex flex-col relative z-10">
70+
<div className="bg-card rounded-2xl border overflow-hidden flex flex-col relative z-10 shadow-xl">
7171
<div className="flex gap-2.5 p-4 border-b border-dashed">
7272
<TabButton
7373
label="Swap"

apps/dashboard/src/@/components/blocks/charts/area-chart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
3030
description?: string;
3131
titleClassName?: string;
3232
headerClassName?: string;
33+
icon?: React.ReactNode;
3334
};
3435
customHeader?: React.ReactNode;
3536
// chart config
@@ -70,6 +71,7 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
7071
<Card className={props.className}>
7172
{props.header && (
7273
<CardHeader className={props.header.headerClassName}>
74+
{props.header.icon}
7375
<CardTitle className={cn("mb-2", props.header.titleClassName)}>
7476
{props.header.title}
7577
</CardTitle>

apps/dashboard/src/@/components/blocks/grid-pattern-embed-container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function GridPatternEmbedContainer(props: {
44
children: React.ReactNode;
55
}) {
66
return (
7-
<div className=" sm:flex sm:justify-center w-full sm:border sm:border-dashed sm:bg-accent/20 sm:py-12 rounded-lg overflow-hidden relative">
7+
<div className="sm:flex sm:justify-center w-full sm:border sm:border-dashed sm:bg-accent/20 sm:py-12 rounded-xl overflow-hidden relative">
88
<GridPattern
99
width={30}
1010
height={30}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/_components/PageHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PublicPageConnectButton } from "./PublicPageConnectButton";
66

77
export function PageHeader(props: { containerClassName?: string }) {
88
return (
9-
<div className="border-b bg-card">
9+
<div className="border-b">
1010
<header
1111
className={cn(
1212
"container flex max-w-8xl justify-between py-3",

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function ContractHeaderUI(props: {
7676
return (
7777
<div
7878
className={cn(
79-
"flex flex-col lg:flex-row lg:items-center gap-5 py-6 relative",
79+
"flex flex-col lg:flex-row lg:items-center gap-5 py-8 relative",
8080
props.className,
8181
)}
8282
>

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/RecentTransfers.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22
import { formatDistanceToNow } from "date-fns";
33
import {
4+
ArrowLeftRightIcon,
45
ArrowRightIcon,
56
ChevronLeftIcon,
67
ChevronRightIcon,
@@ -73,8 +74,13 @@ function RecentTransfersUI(props: {
7374

7475
return (
7576
<div>
76-
<div className="p-4 lg:p-6 bg-card border rounded-b-none border-b-0 rounded-lg">
77-
<h2 className="font-semibold text-2xl tracking-tight mb-0.5">
77+
<div className="p-4 lg:p-6 bg-card border rounded-b-none border-b-0 rounded-xl">
78+
<div className="flex mb-3">
79+
<div className="rounded-full border p-2 bg-background">
80+
<ArrowLeftRightIcon className="size-4 text-muted-foreground" />
81+
</div>
82+
</div>
83+
<h2 className="font-semibold text-2xl tracking-tight mb-1">
7884
Recent Transfers
7985
</h2>
8086
<p className="text-muted-foreground text-sm">
@@ -194,7 +200,7 @@ function RecentTransfersUI(props: {
194200
)}
195201
</TableContainer>
196202

197-
<div className="flex items-center justify-end gap-3 rounded-b-lg border-x border-b bg-card px-6 py-5">
203+
<div className="flex items-center justify-end gap-3 rounded-b-xl border-x border-b bg-card px-6 py-5">
198204
<Button
199205
className="gap-1.5 bg-background rounded-full"
200206
disabled={props.page === 0 || props.isPending}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/contract-analytics/contract-analytics.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { BarChart3Icon } from "lucide-react";
34
import { useState } from "react";
45
import { ThirdwebAreaChart } from "@/components/blocks/charts/area-chart";
56
import {
@@ -35,10 +36,18 @@ export function ContractAnalyticsOverview(props: {
3536
margin={{
3637
bottom: 20,
3738
}}
39+
className="rounded-xl"
3840
header={{
3941
headerClassName: "p-4 lg:p-6",
4042
title: "Analytics",
4143
titleClassName: "font-semibold text-2xl mb-0.5 tracking-tight",
44+
icon: (
45+
<div className="flex mb-3">
46+
<div className="rounded-full border p-2 bg-background">
47+
<BarChart3Icon className="size-4 text-muted-foreground" />
48+
</div>
49+
</div>
50+
),
4251
description:
4352
"View trends of transactions, events and unique wallets interacting with this contract over time",
4453
}}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/dex-screener-chains.ts

Lines changed: 0 additions & 77 deletions
This file was deleted.

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/dex-screener.tsx

Lines changed: 0 additions & 58 deletions
This file was deleted.
Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,21 @@
11
import "server-only";
2-
import { isProd } from "@/constants/env-utils";
3-
import { DASHBOARD_THIRDWEB_SECRET_KEY } from "@/constants/server-envs";
2+
import { Bridge, type ThirdwebClient } from "thirdweb";
43

54
export async function fetchTokenInfoFromBridge(params: {
65
chainId: number;
76
tokenAddress: string;
8-
clientId: string;
7+
client: ThirdwebClient;
98
}) {
109
try {
11-
const res = await fetch(
12-
`https://bridge.${isProd ? "thirdweb.com" : "thirdweb-dev.com"}/v1/tokens?chainId=${params.chainId}&tokenAddress=${params.tokenAddress}`,
13-
{
14-
headers: {
15-
"x-secret-key": DASHBOARD_THIRDWEB_SECRET_KEY,
16-
},
17-
},
18-
);
19-
20-
if (!res.ok) {
21-
console.error(
22-
`Failed to fetch token info from bridge: ${await res.text()}`,
23-
);
24-
return null;
25-
}
26-
27-
const data = (await res.json()) as {
28-
data: Array<{
29-
iconUri: string;
30-
address: string;
31-
decimals: number;
32-
name: string;
33-
symbol: string;
34-
priceUsd: number;
35-
}>;
36-
};
37-
38-
return data.data[0];
10+
const res = await Bridge.tokens({
11+
client: params.client,
12+
chainId: params.chainId,
13+
tokenAddress: params.tokenAddress,
14+
includePrices: true,
15+
limit: 1,
16+
});
17+
return res[0];
3918
} catch {
40-
return null;
19+
return undefined;
4120
}
4221
}

0 commit comments

Comments
 (0)