Skip to content

Commit 2231db7

Browse files
committed
[NEB-125] Nebula: Show popular chains at the top of the list (#6565)
1 parent f9872f4 commit 2231db7

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,39 @@ export function MultiNetworkSelector(props: {
1818
onChange: (chainIds: number[]) => void;
1919
disableChainId?: boolean;
2020
className?: string;
21+
priorityChains?: number[];
2122
}) {
2223
const { allChains, idToChain } = useAllChainsData();
2324

2425
const options = useMemo(() => {
25-
return allChains.map((chain) => {
26+
let sortedChains = allChains;
27+
28+
if (props.priorityChains) {
29+
const priorityChainsSet = new Set();
30+
for (const chainId of props.priorityChains || []) {
31+
priorityChainsSet.add(chainId);
32+
}
33+
34+
const priorityChains = (props.priorityChains || [])
35+
.map((chainId) => {
36+
return idToChain.get(chainId);
37+
})
38+
.filter((v) => !!v);
39+
40+
const otherChains = allChains.filter(
41+
(chain) => !priorityChainsSet.has(chain.chainId),
42+
);
43+
44+
sortedChains = [...priorityChains, ...otherChains];
45+
}
46+
47+
return sortedChains.map((chain) => {
2648
return {
2749
label: cleanChainName(chain.name),
2850
value: String(chain.chainId),
2951
};
3052
});
31-
}, [allChains]);
53+
}, [allChains, props.priorityChains, idToChain]);
3254

3355
const searchFn = useCallback(
3456
(option: Option, searchValue: string) => {

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/server/BuyFundsSection.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function BuyFundsSection(props: { chain: ChainMetadata }) {
2828
<div className="h-6" />
2929

3030
<h2 className="px-4 text-center font-semibold text-lg tracking-tight">
31-
Buy Funds on {sanitizedChainName} using thirdweb Pay
31+
Buy Funds on {sanitizedChainName} using Universal Bridge
3232
</h2>
3333

3434
<div className="h-2" />
@@ -50,8 +50,9 @@ export function BuyFundsSection(props: { chain: ChainMetadata }) {
5050
<Link
5151
href="https://portal.thirdweb.com/connect/pay/overview"
5252
className="inline-flex items-center gap-1.5 text-muted-foreground text-sm hover:text-foreground"
53+
target="_blank"
5354
>
54-
Learn more about thirdweb Pay
55+
Learn more about Universal Bridge
5556
<ExternalLinkIcon className="size-3" />
5657
</Link>
5758
</div>

apps/dashboard/src/app/nebula-app/(app)/components/ContextFilters.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ export function ContextFiltersForm(props: {
199199
onChange={(values) => {
200200
form.setValue("chainIds", values.join(","));
201201
}}
202+
priorityChains={[
203+
1, // ethereum
204+
56, // bnb smart chain mainnet (bsc)
205+
42161, // arbitrum one mainnet
206+
8453, // base mainnet
207+
43114, // avalanche mainnet
208+
146, // sonic
209+
137, // polygon
210+
80094, // berachain mainnet
211+
10, // optimism
212+
]}
202213
/>
203214
</FormControl>
204215
<FormMessage />

0 commit comments

Comments
 (0)