Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions apps/dashboard/src/@/components/blocks/NetworkSelectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,39 @@ export function MultiNetworkSelector(props: {
onChange: (chainIds: number[]) => void;
disableChainId?: boolean;
className?: string;
priorityChains?: number[];
}) {
const { allChains, idToChain } = useAllChainsData();

const options = useMemo(() => {
return allChains.map((chain) => {
let sortedChains = allChains;

if (props.priorityChains) {
const priorityChainsSet = new Set();
for (const chainId of props.priorityChains || []) {
priorityChainsSet.add(chainId);
}

const priorityChains = (props.priorityChains || [])
.map((chainId) => {
return idToChain.get(chainId);
})
.filter((v) => !!v);

const otherChains = allChains.filter(
(chain) => !priorityChainsSet.has(chain.chainId),
);

sortedChains = [...priorityChains, ...otherChains];
}

return sortedChains.map((chain) => {
return {
label: cleanChainName(chain.name),
value: String(chain.chainId),
};
});
}, [allChains]);
}, [allChains, props.priorityChains, idToChain]);

const searchFn = useCallback(
(option: Option, searchValue: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function BuyFundsSection(props: { chain: ChainMetadata }) {
<div className="h-6" />

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

<div className="h-2" />
Expand All @@ -50,8 +50,9 @@ export function BuyFundsSection(props: { chain: ChainMetadata }) {
<Link
href="https://portal.thirdweb.com/connect/pay/overview"
className="inline-flex items-center gap-1.5 text-muted-foreground text-sm hover:text-foreground"
target="_blank"
>
Learn more about thirdweb Pay
Learn more about Universal Bridge
<ExternalLinkIcon className="size-3" />
</Link>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ export function ContextFiltersForm(props: {
onChange={(values) => {
form.setValue("chainIds", values.join(","));
}}
priorityChains={[
1, // ethereum
56, // bnb smart chain mainnet (bsc)
42161, // arbitrum one mainnet
8453, // base mainnet
43114, // avalanche mainnet
146, // sonic
137, // polygon
80094, // berachain mainnet
10, // optimism
]}
/>
</FormControl>
<FormMessage />
Expand Down
Loading