Skip to content

Commit 2d2470f

Browse files
committed
feat: add lucide-vue-next dependency and update ChainSelector component for improved select functionality
1 parent 95a42f9 commit 2d2470f

File tree

4 files changed

+40
-21
lines changed

4 files changed

+40
-21
lines changed

package-lock.json

Lines changed: 10 additions & 0 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@vueuse/core": "^13.6.0",
2121
"@wagmi/vue": "^0.1.24",
2222
"clsx": "^2.1.1",
23+
"lucide-vue-next": "^0.539.0",
2324
"pinia": "^3.0.3",
2425
"reka-ui": "^2.4.1",
2526
"tailwind-merge": "^3.3.1",

src/components/ChainSelector.vue

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<template>
2-
<Select
3-
v-model="selectedChainId"
4-
:placeholder="'Select Chain'"
5-
:class="className"
6-
@update:model-value="handleChainChange"
7-
>
8-
<SelectItem
9-
v-for="chain in filteredChains"
10-
:key="chain.id"
11-
:value="chain.id.toString()"
12-
:class="className"
13-
>
14-
<div class="flex items-center gap-2">
15-
<img :src="chain.icon" class="size-4" :alt="chain.name" />
16-
{{ chain.name }}
17-
</div>
18-
</SelectItem>
2+
<Select>
3+
<SelectTrigger>
4+
<SelectValue placeholder="Select Chain" />
5+
</SelectTrigger>
6+
<SelectContent>
7+
<SelectGroup
8+
v-for="chain in filteredChains"
9+
:key="chain.id"
10+
:value="chain.id.toString()"
11+
:class="className"
12+
>
13+
<SelectItem :value="chain.id.toString()">
14+
<img :src="chain.icon" class="size-4" :alt="chain.name" />
15+
{{ chain.name }}
16+
</SelectItem>
17+
</SelectGroup>
18+
</SelectContent>
1919
</Select>
2020
</template>
2121

@@ -25,8 +25,14 @@ import { useAccount } from '@wagmi/vue';
2525
import { useChainSwitch } from '@/hooks/useChainSwitch';
2626
import { getSupportedChains, getChainById } from '@/utils/chain.utils';
2727
import useUserStore from '@/stores/useUser.store';
28-
import Select from '@/components/ui/Select.vue';
29-
import SelectItem from '@/components/ui/SelectItem.vue';
28+
import {
29+
Select,
30+
SelectContent,
31+
SelectGroup,
32+
SelectItem,
33+
SelectTrigger,
34+
SelectValue,
35+
} from '@/components/ui/select';
3036
3137
interface Props {
3238
className?: string;

src/utils/chain.utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { arbitrum } from 'viem/chains';
22
import { bellecour } from './bellecourChainConfig';
3+
import arbitrumLogo from '@/assets/icons/arbitrum.svg';
4+
import iexecLogo from '@/assets/icons/iexec-logo.png';
35

46
export interface Chain {
57
id: number;
@@ -28,15 +30,15 @@ export function getSupportedChains(): Chain[] {
2830
{
2931
id: arbitrum.id,
3032
name: arbitrum.name,
31-
icon: '/assets/icons/arbitrum.svg',
33+
icon: arbitrumLogo,
3234
nativeCurrency: arbitrum.nativeCurrency,
3335
rpcUrls: arbitrum.rpcUrls,
3436
blockExplorers: arbitrum.blockExplorers,
3537
},
3638
{
3739
id: bellecour.id,
3840
name: bellecour.name,
39-
icon: '/assets/icons/iexec-logo.png',
41+
icon: iexecLogo,
4042
nativeCurrency: bellecour.nativeCurrency,
4143
rpcUrls: bellecour.rpcUrls,
4244
blockExplorers: bellecour.blockExplorers,

0 commit comments

Comments
 (0)