Skip to content

Commit 52e720b

Browse files
committed
Merge branch 'main' into feature/add-details-page
2 parents efe2b1b + ed53568 commit 52e720b

31 files changed

+267
-1535
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{".":"1.4.0"}
1+
{".":"1.6.0"}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## [1.6.0](https://github.com/iExecBlockchainComputing/explorer-v2/compare/iexec-explorer-v1.5.0...iexec-explorer-v1.6.0) (2025-06-02)
4+
5+
6+
### 🚀 Features
7+
8+
* add chain switch ([#12](https://github.com/iExecBlockchainComputing/explorer-v2/issues/12)) ([9e7b020](https://github.com/iExecBlockchainComputing/explorer-v2/commit/9e7b020a84495402e4a0734f39f0b8fe10da1221))
9+
10+
## [1.5.0](https://github.com/iExecBlockchainComputing/explorer-v2/compare/iexec-explorer-v1.4.0...iexec-explorer-v1.5.0) (2025-05-21)
11+
12+
13+
### 🚀 Features
14+
15+
* add main pages ([#9](https://github.com/iExecBlockchainComputing/explorer-v2/issues/9)) ([d8fcb93](https://github.com/iExecBlockchainComputing/explorer-v2/commit/d8fcb93f5922d92bee2d5be2d15767bf4661f183))
16+
317
## [1.4.0](https://github.com/iExecBlockchainComputing/explorer-v2/compare/iexec-explorer-v1.3.0...iexec-explorer-v1.4.0) (2025-05-13)
418

519

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "iexec-explorer",
33
"private": true,
4-
"version": "1.4.0",
4+
"version": "1.6.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src/components/UnsupportedChain.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import { SUPPORTED_CHAINS } from '@/config';
22
import { AlertOctagon } from 'lucide-react';
3-
import useUserStore from '@/stores/useUser.store';
3+
import { useAccount } from 'wagmi';
44
import { Alert, AlertDescription, AlertTitle } from './ui/alert';
55

66
const SUPPORTED_CHAIN_IDS = SUPPORTED_CHAINS.map((chain) => chain.id);
77

88
export function UnsupportedChain() {
9-
const { isConnected, chainId } = useUserStore();
10-
9+
const { isConnected, chainId } = useAccount();
1110
const isChainSupported =
1211
chainId !== undefined && SUPPORTED_CHAIN_IDS.includes(chainId);
1312

14-
if (isChainSupported || !isConnected) {
13+
if (!isConnected || isChainSupported) {
1514
return null;
1615
}
1716

src/components/navbar/ChainSelector.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SUPPORTED_CHAINS } from '@/config.ts';
2-
import { useRouter } from '@tanstack/react-router';
2+
import { useChainSwitch } from '@/hooks/useChainSwitch.ts';
33
import useUserStore from '@/stores/useUser.store.ts';
44
import {
55
Select,
@@ -11,23 +11,17 @@ import {
1111

1212
export function ChainSelector() {
1313
const { chainId } = useUserStore();
14-
const { navigate } = useRouter();
15-
14+
const { requestChainChange } = useChainSwitch();
1615
const handleChainChange = async (value: string) => {
17-
const newChainSlug = SUPPORTED_CHAINS.find(
18-
(chain) => chain.id === Number(value)
19-
)?.slug;
20-
const pathParts = location.pathname.split('/').filter(Boolean);
21-
const newPath =
22-
pathParts.length > 1
23-
? `/${newChainSlug}/${pathParts.slice(1).join('/')}`
24-
: `/${newChainSlug}`;
25-
26-
navigate({ to: newPath });
16+
requestChainChange(Number(value));
2717
};
2818

2919
return (
30-
<Select value={chainId.toString()} onValueChange={handleChainChange}>
20+
<Select
21+
value={chainId?.toString()}
22+
onValueChange={handleChainChange}
23+
defaultValue="-1"
24+
>
3125
<SelectTrigger>
3226
<SelectValue placeholder="Select Chain" />
3327
</SelectTrigger>

src/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import arbitrumSepoliaIcon from './assets/chain-icons/arbitrum-sepolia.svg';
22
import iexecLogo from './assets/iexec-logo.svg';
3+
import { bellecour, arbitrumSepolia } from './utils/wagmiNetworks';
34

45
export const PREVIEW_TABLE_LENGTH = 5;
56
export const DETAIL_TABLE_LENGTH = 8;
@@ -15,6 +16,7 @@ export const SUPPORTED_CHAINS = [
1516
icon: iexecLogo,
1617
blockExplorerUrl: 'https://blockscout-bellecour.iex.ec',
1718
subgraphUrl: 'https://thegraph.iex.ec/subgraphs/name/bellecour/poco-v5',
19+
wagmiNetwork: bellecour,
1820
},
1921
{
2022
id: 421614,
@@ -25,5 +27,6 @@ export const SUPPORTED_CHAINS = [
2527
blockExplorerUrl: 'https://sepolia.arbiscan.io/',
2628
subgraphUrl:
2729
'http://localhost:8080/subgraphs/id/2GCj8gzLCihsiEDq8cYvC5nUgK6VfwZ6hm3Wj8A3kcxz',
30+
wagmiNetwork: arbitrumSepolia,
2831
},
2932
];

src/graphql/execute.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import type { TypedDocumentString } from './graphql'
33

44
export async function execute<TResult, TVariables>(
55
query: TypedDocumentString<TResult, TVariables>,
6-
chainId: number,
6+
chainId?: number,
77
...[variables]: TVariables extends Record<string, never> ? [] : [TVariables]
88
) {
9+
if (!chainId) {
10+
throw Error('Missing chainId')
11+
}
912
const subgraphUrl = getSubgraphUrl(chainId);
1013
const response = await fetch(subgraphUrl, {
1114
method: 'POST',

0 commit comments

Comments
 (0)