Skip to content

Commit 171dbe1

Browse files
committed
show deprecation in playground UI
1 parent 483ce36 commit 171dbe1

File tree

6 files changed

+71
-2
lines changed

6 files changed

+71
-2
lines changed

apps/playground-web/src/app/insight/[blueprint_slug]/page.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import { Badge } from "@/components/ui/badge";
12
import {
23
Breadcrumb,
34
BreadcrumbItem,
45
BreadcrumbLink,
56
BreadcrumbList,
67
BreadcrumbSeparator,
78
} from "@/components/ui/breadcrumb";
9+
import { cn } from "@/lib/utils";
810
import { redirect } from "next/navigation";
911
import { THIRDWEB_CLIENT } from "../../../lib/client";
1012
import { isProd } from "../../../lib/env";
@@ -53,8 +55,26 @@ export default async function Page(props: {
5355
<div>
5456
<Breadcrumbs />
5557
<h1 className="mt-3 mb-6 font-semibold text-2xl tracking-tight lg:text-3xl">
56-
{title}
58+
<div className="flex items-center gap-2">
59+
<span
60+
className={cn(
61+
pathMetadata.deprecated && "text-muted-foreground line-through",
62+
)}
63+
>
64+
{title}
65+
</span>
66+
{pathMetadata.deprecated && (
67+
<Badge variant="destructive" className="text-xs">
68+
Deprecated
69+
</Badge>
70+
)}
71+
</div>
5772
</h1>
73+
<p className="mt-3 mb-6">
74+
<div className="flex items-center gap-2">
75+
<span>{pathMetadata.description}</span>
76+
</div>
77+
</p>
5878
<BlueprintPlayground
5979
key={searchParams.path}
6080
metadata={pathMetadata}

apps/playground-web/src/app/insight/insightBlueprints.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ export const insightBlueprints: MinimalBlueprintSpec[] = [
99
{
1010
name: "Get events",
1111
path: "/v1/events",
12+
deprecated: false,
1213
},
1314
{
1415
name: "Get contract events",
1516
path: "/v1/events/{contractAddress}",
17+
deprecated: false,
1618
},
1719
{
1820
name: "Get contract events with specific signature",
1921
path: "/v1/events/{contractAddress}/{signature}",
22+
deprecated: false,
2023
},
2124
],
2225
},
@@ -27,14 +30,17 @@ export const insightBlueprints: MinimalBlueprintSpec[] = [
2730
{
2831
name: "Get transactions",
2932
path: "/v1/transactions",
33+
deprecated: false,
3034
},
3135
{
3236
name: "Get contract transactions",
3337
path: "/v1/transactions/{contractAddress}",
38+
deprecated: false,
3439
},
3540
{
3641
name: "Get contract transactions with specific signature",
3742
path: "/v1/transactions/{contractAddress}/{signature}",
43+
deprecated: false,
3844
},
3945
],
4046
},
@@ -45,6 +51,7 @@ export const insightBlueprints: MinimalBlueprintSpec[] = [
4551
{
4652
name: "Get blocks",
4753
path: "/v1/blocks",
54+
deprecated: false,
4855
},
4956
],
5057
},
@@ -55,38 +62,47 @@ export const insightBlueprints: MinimalBlueprintSpec[] = [
5562
{
5663
name: "Get token transfers by transaction",
5764
path: "/v1/tokens/transfers/transaction/{transaction_hash}",
65+
deprecated: false,
5866
},
5967
{
6068
name: "Get token transfers by contract",
6169
path: "/v1/tokens/transfers/{contract_address}",
70+
deprecated: false,
6271
},
6372
{
6473
name: "Get token transfers",
6574
path: "/v1/tokens/transfers",
75+
deprecated: false,
6676
},
6777
{
6878
name: "Get ERC-20 balances by address",
6979
path: "/v1/tokens/erc20/{ownerAddress}",
80+
deprecated: false,
7081
},
7182
{
7283
name: "Get ERC-721 balances by address",
7384
path: "/v1/tokens/erc721/{ownerAddress}",
85+
deprecated: true,
7486
},
7587
{
7688
name: "Get ERC-1155 balances by address",
7789
path: "/v1/tokens/erc1155/{ownerAddress}",
90+
deprecated: true,
7891
},
7992
{
8093
name: "Get supported tokens for price data",
8194
path: "/v1/tokens/price/supported",
95+
deprecated: false,
8296
},
8397
{
8498
name: "Get token price",
8599
path: "/v1/tokens/price",
100+
deprecated: false,
86101
},
87102
{
88103
name: "Token lookup",
89104
path: "/v1/tokens/lookup",
105+
deprecated: false,
90106
},
91107
],
92108
},
@@ -97,54 +113,67 @@ export const insightBlueprints: MinimalBlueprintSpec[] = [
97113
{
98114
name: "Get NFT balances by address",
99115
path: "/v1/nfts/balance/{ownerAddress}",
116+
deprecated: false,
100117
},
101118
{
102119
name: "Get collection",
103120
path: "/v1/nfts/collections/{contract_address}",
121+
deprecated: false,
104122
},
105123
{
106124
name: "Get NFTs by owner",
107125
path: "/v1/nfts",
126+
deprecated: false,
108127
},
109128
{
110129
name: "Get NFT owners by contract",
111130
path: "/v1/nfts/owners/{contract_address}",
131+
deprecated: false,
112132
},
113133
{
114134
name: "Get NFT owners by token",
115135
path: "/v1/nfts/owners/{contract_address}/{token_id}",
136+
deprecated: false,
116137
},
117138
{
118139
name: "Get NFT transfers",
119140
path: "/v1/nfts/transfers",
141+
deprecated: false,
120142
},
121143
{
122144
name: "Get NFT transfers by transaction",
123145
path: "/v1/nfts/transfers/transaction/{transaction_hash}",
146+
deprecated: false,
124147
},
125148
{
126149
name: "Get NFT transfers by contract",
127150
path: "/v1/nfts/transfers/{contract_address}",
151+
deprecated: false,
128152
},
129153
{
130154
name: "Get NFTs by contract",
131155
path: "/v1/nfts/{contract_address}",
156+
deprecated: false,
132157
},
133158
{
134159
name: "Get NFT transfers by token",
135160
path: "/v1/nfts/transfers/{contract_address}/{token_id}",
161+
deprecated: false,
136162
},
137163
{
138164
name: "Get NFT by token ID",
139165
path: "/v1/nfts/{contract_address}/{token_id}",
166+
deprecated: false,
140167
},
141168
{
142169
name: "Force refresh collection metadata",
143170
path: "/v1/nfts/metadata/refresh/{contract_address}",
171+
deprecated: false,
144172
},
145173
{
146174
name: "Force refresh token metadata",
147175
path: "/v1/nfts/metadata/refresh/{contract_address}/{token_id}",
176+
deprecated: false,
148177
},
149178
],
150179
},
@@ -155,6 +184,7 @@ export const insightBlueprints: MinimalBlueprintSpec[] = [
155184
{
156185
name: "Get wallet transactions",
157186
path: "/v1/wallets/{wallet_address}/transactions",
187+
deprecated: false,
158188
},
159189
],
160190
},
@@ -165,10 +195,12 @@ export const insightBlueprints: MinimalBlueprintSpec[] = [
165195
{
166196
name: "Get contract ABI​",
167197
path: "/v1/contracts/abi/{contractAddress}",
198+
deprecated: false,
168199
},
169200
{
170201
name: "Get contract metadata​",
171202
path: "/v1/contracts/metadata/{contractAddress}",
203+
deprecated: false,
172204
},
173205
],
174206
},
@@ -179,6 +211,7 @@ export const insightBlueprints: MinimalBlueprintSpec[] = [
179211
{
180212
name: "Decode logs and transactions​",
181213
path: "/v1/decode/{contractAddress}",
214+
deprecated: false,
182215
},
183216
],
184217
},
@@ -189,6 +222,7 @@ export const insightBlueprints: MinimalBlueprintSpec[] = [
189222
{
190223
name: "Resolve",
191224
path: "/v1/resolve/{input}",
225+
deprecated: false,
192226
},
193227
],
194228
},

apps/playground-web/src/app/insight/page.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default function Page() {
2929
return {
3030
name: pathInfo.name,
3131
link: `/insight/${blueprint.id}?path=${pathInfo.path}`,
32+
deprecated: pathInfo.deprecated,
3233
};
3334
})}
3435
/>
@@ -60,10 +61,19 @@ function BlueprintSection(props: {
6061
<span className="flex items-center gap-3">
6162
<Link
6263
href={item.link}
63-
className="before:absolute before:inset-0"
64+
className={`${
65+
item.deprecated
66+
? "line-through before:absolute before:inset-0"
67+
: ""
68+
}`}
6469
>
6570
{item.name}
6671
</Link>
72+
{item.deprecated && (
73+
<span className="rounded bg-destructive/10 px-2 py-0.5 font-medium text-destructive text-xs">
74+
Deprecated
75+
</span>
76+
)}
6777
</span>
6878
</TableCell>
6979
</TableRow>

apps/playground-web/src/app/insight/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type BlueprintListItem = {
1717
name: string;
1818
path: string;
1919
method: string;
20+
deprecated: boolean;
2021
}[];
2122
};
2223

@@ -33,6 +34,7 @@ export type MinimalBlueprintSpec = {
3334
paths: {
3435
name: string;
3536
path: string;
37+
deprecated: boolean;
3638
}[];
3739
};
3840

apps/playground-web/src/app/navLinks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export function getSidebarLinks() {
141141
return {
142142
name: pathInfo.name,
143143
href: `/insight/${blueprint.id}?path=${pathInfo.path}`,
144+
crossedOut: pathInfo.deprecated,
144145
};
145146
}),
146147
};

apps/playground-web/src/components/ui/sidebar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { CustomAccordion } from "./CustomAccordion";
1111
export type LinkMeta = {
1212
name: string;
1313
href: string;
14+
crossedOut?: boolean;
1415
};
1516

1617
export type LinkGroup = {
@@ -83,6 +84,7 @@ function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void }) {
8384
className={clsx(
8485
"block overflow-hidden text-ellipsis py-1 font-medium transition-colors duration-300 hover:text-foreground lg:text-base",
8586
isActive ? "text-foreground" : "text-muted-foreground",
87+
"crossedOut" in link && link.crossedOut && "line-through",
8688
)}
8789
>
8890
{link.name}

0 commit comments

Comments
 (0)