1- import { formatAddress , useWallets } from '@0xsequence/connect'
2- import { cardVariants , ChevronRightIcon , cn , GradientAvatar , Text , TokenImage } from '@0xsequence/design-system'
1+ import { formatAddress , getNetwork , useWallets } from '@0xsequence/connect'
2+ import { Text , TokenImage } from '@0xsequence/design-system'
33import { useGetTokenBalancesSummary } from '@0xsequence/hooks'
44import { ContractType } from '@0xsequence/indexer'
5- import { ChainId } from '@0xsequence/network'
65import { useObservable } from 'micro-observables'
76import { useState } from 'react'
87
9- import { useSettings } from '../hooks'
10- import { useFiatWalletsMap } from '../hooks/useFiatWalletsMap'
11- import { getConnectorLogo } from '../utils/wallets'
8+ import { useSettings } from '../../ hooks'
9+ import { useFiatWalletsMap } from '../../ hooks/useFiatWalletsMap'
10+ import { getConnectorLogo } from '../../ utils/wallets'
1211
13- import { GradientAvatarList } from './GradientAvatarList'
14- import { ListCardNav } from './ListCard'
15- import { ListCardSelect } from './ListCard/ListCardSelect'
16- import { SlideupDrawer } from './SlideupDrawer'
17- import { WalletAccountGradient } from './WalletAccountGradient'
12+ import { ListCardNav } from '../ListCard'
13+ import { ListCardSelect } from '../ListCard/ListCardSelect'
14+ import { SlideupDrawer } from '../SlideupDrawer'
15+ import { WalletAccountGradient } from '../WalletAccountGradient'
16+ import { MediaIconWrapper , StackedIconTag } from '../IconWrappers'
17+ import { NetworkRow } from './NetworkRow'
1818
1919enum FilterType {
2020 menu = 'Filters' ,
@@ -25,16 +25,12 @@ enum FilterType {
2525
2626export const FilterMenu = ( {
2727 label,
28- buttonLabel,
2928 type,
30- onClose,
31- handleButtonPress
29+ onClose
3230} : {
3331 label : string
34- buttonLabel : string
3532 type : 'tokens' | 'collectibles' | 'transactions' | 'bypassMenuWallets'
3633 onClose : ( ) => void
37- handleButtonPress : ( ) => void
3834} ) => {
3935 const { wallets } = useWallets ( )
4036 const {
@@ -79,22 +75,76 @@ export const FilterMenu = ({
7975 type === 'bypassMenuWallets' ? FilterType . wallets : FilterType . menu
8076 )
8177
82- const walletsPreview = selectedWallets . length > 1 ? 'All' : < GradientAvatar address = { selectedWallets [ 0 ] . address } size = "sm" />
78+ const walletsPreview =
79+ selectedWallets . length > 1 ? (
80+ < StackedIconTag
81+ iconList = { [ ] }
82+ label = {
83+ < Text variant = "normal" color = "primary" >
84+ All
85+ </ Text >
86+ }
87+ />
88+ ) : (
89+ < div className = "flex flex-row gap-2 items-center" >
90+ < StackedIconTag
91+ iconList = { [ selectedWallets [ 0 ] . address ] }
92+ isAccount
93+ label = {
94+ < Text variant = "normal" color = "primary" nowrap style = { { maxWidth : '200px' } } ellipsis >
95+ { formatAddress ( selectedWallets [ 0 ] . address ) }
96+ </ Text >
97+ }
98+ />
99+ </ div >
100+ )
83101
84102 const networksPreview =
85103 selectedNetworks . length > 1 ? (
86- 'All'
104+ < div className = "flex flex-row gap-2 items-center" >
105+ < StackedIconTag
106+ iconList = { [ ] }
107+ label = {
108+ < Text variant = "normal" color = "primary" >
109+ All
110+ </ Text >
111+ }
112+ />
113+ </ div >
87114 ) : (
88- < TokenImage src = { `https://assets.sequence.info/images/networks/medium/${ selectedNetworks [ 0 ] } .webp` } />
115+ < StackedIconTag
116+ iconList = { [ `https://assets.sequence.info/images/networks/medium/${ selectedNetworks [ 0 ] } .webp` ] }
117+ label = {
118+ < Text variant = "normal" color = "primary" nowrap style = { { maxWidth : '200px' } } ellipsis >
119+ { getNetwork ( selectedNetworks [ 0 ] ) . title }
120+ </ Text >
121+ }
122+ />
89123 )
90124
91125 const collectionsPreview =
92126 collections ?. length === 0 ? (
93- 'N/A'
127+ < Text variant = "normal" color = "primary" >
128+ N/A
129+ </ Text >
94130 ) : selectedCollections . length === 0 ? (
95- 'All'
131+ < StackedIconTag
132+ iconList = { [ ] }
133+ label = {
134+ < Text variant = "normal" color = "primary" >
135+ All
136+ </ Text >
137+ }
138+ />
96139 ) : (
97- < TokenImage src = { selectedCollections [ 0 ] . contractInfo ?. logoURI } symbol = { selectedCollections [ 0 ] . contractInfo ?. name } />
140+ < StackedIconTag
141+ iconList = { [ selectedCollections [ 0 ] . contractInfo ?. logoURI ] }
142+ label = {
143+ < Text variant = "normal" color = "primary" nowrap style = { { maxWidth : '200px' } } ellipsis >
144+ { selectedCollections [ 0 ] . contractInfo ?. name }
145+ </ Text >
146+ }
147+ />
98148 )
99149
100150 const handleFilterChange = ( filter : FilterType ) => {
@@ -105,56 +155,41 @@ export const FilterMenu = ({
105155 < SlideupDrawer
106156 onClose = { onClose }
107157 label = { selectedFilter === FilterType . menu ? label : selectedFilter }
108- buttonLabel = { buttonLabel }
109- handleButtonPress = { handleButtonPress }
110158 onBackPress = {
111159 type !== 'bypassMenuWallets' && selectedFilter !== FilterType . menu ? ( ) => handleFilterChange ( FilterType . menu ) : undefined
112160 }
113161 >
114162 { selectedFilter === FilterType . menu ? (
115163 < div className = "flex flex-col bg-background-primary gap-3" >
116164 < ListCardNav
117- rightChildren = {
118- < Text color = "primary" fontWeight = "medium" variant = "normal" >
119- { walletsPreview }
120- </ Text >
121- }
122- style = { { height : '60px' } }
165+ rightChildren = { walletsPreview }
166+ style = { { height : '64px' } }
123167 onClick = { ( ) => handleFilterChange ( FilterType . wallets ) }
124168 >
125169 < Text color = "primary" fontWeight = "medium" variant = "normal" >
126170 Wallets
127171 </ Text >
128172 </ ListCardNav >
129173 < ListCardNav
130- rightChildren = {
131- < Text color = "primary" fontWeight = "medium" variant = "normal" >
132- { networksPreview }
133- </ Text >
134- }
135- style = { { height : '60px' } }
174+ rightChildren = { networksPreview }
175+ style = { { height : '64px' } }
136176 onClick = { ( ) => handleFilterChange ( FilterType . networks ) }
137177 >
138178 < Text color = "primary" fontWeight = "medium" variant = "normal" >
139179 Networks
140180 </ Text >
141181 </ ListCardNav >
142182 { type === 'collectibles' && (
143- < div
144- className = { cn ( cardVariants ( { clickable : true } ) , 'flex flex-row justify-between items-center' ) }
145- style = { { height : '60px' } }
146- onClick = { collections ?. length ? ( ) => handleFilterChange ( FilterType . collections ) : undefined }
183+ < ListCardNav
184+ rightChildren = { collectionsPreview }
185+ style = { { height : '64px' } }
186+ disabled = { collections ?. length === 0 }
187+ onClick = { ( ) => handleFilterChange ( FilterType . collections ) }
147188 >
148189 < Text color = "primary" fontWeight = "medium" variant = "normal" >
149190 Collections
150191 </ Text >
151- < div className = "flex flex-row items-center gap-2" >
152- < Text color = "primary" fontWeight = "medium" variant = "normal" >
153- { collectionsPreview }
154- </ Text >
155- < ChevronRightIcon color = "white" />
156- </ div >
157- </ div >
192+ </ ListCardNav >
158193 ) }
159194 </ div >
160195 ) : selectedFilter === FilterType . wallets ? (
@@ -171,7 +206,7 @@ export const FilterMenu = ({
171206 }
172207 onClick = { ( ) => setSelectedWallets ( [ ] ) }
173208 >
174- < GradientAvatarList accountAddressList = { wallets . map ( wallet => wallet . address ) } size = "md" />
209+ < MediaIconWrapper iconList = { wallets . map ( wallet => wallet . address ) } size = "sm" isAccount />
175210 < Text color = "primary" fontWeight = "medium" variant = "normal" >
176211 All
177212 </ Text >
@@ -211,24 +246,22 @@ export const FilterMenu = ({
211246 isSelected = { selectedNetworksObservable . get ( ) . length > 1 }
212247 onClick = { ( ) => setSelectedNetworks ( [ ] ) }
213248 >
249+ < MediaIconWrapper
250+ iconList = { allNetworks . map ( network => `https://assets.sequence.info/images/networks/medium/${ network } .webp` ) }
251+ size = "sm"
252+ />
214253 < Text color = "primary" fontWeight = "medium" variant = "normal" >
215254 All
216255 </ Text >
217256 </ ListCardSelect >
218257 ) }
219258 { allNetworks . map ( chainId => (
220- < ListCardSelect
259+ < NetworkRow
221260 key = { chainId }
261+ chainId = { chainId }
222262 isSelected = { selectedNetworksObservable . get ( ) . length === 1 && selectedNetworksObservable . get ( ) . includes ( chainId ) }
223263 onClick = { ( ) => setSelectedNetworks ( [ chainId ] ) }
224- >
225- < div className = "flex gap-2 justify-center items-center" >
226- < TokenImage src = { `https://assets.sequence.info/images/networks/medium/${ chainId } .webp` } />
227- < Text color = "primary" variant = "normal" fontWeight = "bold" >
228- { ChainId [ chainId ] }
229- </ Text >
230- </ div >
231- </ ListCardSelect >
264+ />
232265 ) ) }
233266 </ div >
234267 ) : selectedFilter === FilterType . collections ? (
@@ -239,6 +272,7 @@ export const FilterMenu = ({
239272 isSelected = { selectedCollectionsObservable . get ( ) . length === 0 }
240273 onClick = { ( ) => setSelectedCollections ( [ ] ) }
241274 >
275+ < MediaIconWrapper iconList = { collections . map ( collection => collection . contractInfo ?. logoURI ) } size = "sm" />
242276 < Text color = "primary" fontWeight = "medium" variant = "normal" >
243277 All
244278 </ Text >
@@ -251,7 +285,7 @@ export const FilterMenu = ({
251285 selectedCollectionsObservable . get ( ) . find ( c => c . contractAddress === collection . contractAddress ) !== undefined ||
252286 collections . length === 1
253287 }
254- onClick = { ( ) => setSelectedCollections ( [ collection ] ) }
288+ onClick = { collections . length > 1 ? ( ) => setSelectedCollections ( [ collection ] ) : undefined }
255289 >
256290 < TokenImage src = { collection . contractInfo ?. logoURI } symbol = { collection . contractInfo ?. name } />
257291 < Text color = "primary" fontWeight = "medium" variant = "normal" >
@@ -264,6 +298,3 @@ export const FilterMenu = ({
264298 </ SlideupDrawer >
265299 )
266300}
267-
268- // TODO: swap out collectionsPreview with home screen icons later
269- // TODO: add icons to networks
0 commit comments