@@ -4,8 +4,11 @@ import {
4
4
AccordionSummary ,
5
5
Checkbox ,
6
6
Divider ,
7
+ FormControlLabel ,
7
8
Grid ,
8
9
IconButton ,
10
+ Radio ,
11
+ RadioGroup ,
9
12
TextField ,
10
13
Typography ,
11
14
} from "@material-ui/core" ;
@@ -29,6 +32,7 @@ function NetworkMembers({ network }) {
29
32
const [ filter , setFilter ] = useState ( "" ) ;
30
33
const [ filterActive , setFilterActive ] = useState ( false ) ;
31
34
const [ filterInactive , setFilterInactive ] = useState ( false ) ;
35
+ const [ sortBy , setSortBy ] = useState ( "id" ) ;
32
36
33
37
const fetchData = useCallback ( async ( ) => {
34
38
try {
@@ -175,14 +179,14 @@ function NetworkMembers({ network }) {
175
179
< RefreshIcon />
176
180
</ IconButton >
177
181
< Grid container >
178
- < Grid item sm = { 6 } >
182
+ < Grid item sm = { 3 } >
179
183
< Typography > Search (Addr/Name)</ Typography >
180
184
< TextField
181
185
value = { filter }
182
186
onChange = { ( e ) => setFilter ( e . target . value ) }
183
187
/>
184
188
</ Grid >
185
- < Grid item sm = "auto" >
189
+ < Grid item sm = { 3 } >
186
190
< Typography > Display Filter</ Typography >
187
191
< Checkbox
188
192
checked = { filterActive }
@@ -197,6 +201,13 @@ function NetworkMembers({ network }) {
197
201
/>
198
202
< span > Inactive</ span >
199
203
</ Grid >
204
+ < Grid item sm = { 3 } >
205
+ < Typography > Sort by</ Typography >
206
+ < RadioGroup value = { sortBy } onChange = { ( e ) => setSortBy ( e . target . value ) } >
207
+ < FormControlLabel value = "name" control = { < Radio /> } label = "Name" />
208
+ < FormControlLabel value = "id" control = { < Radio /> } label = "Address" />
209
+ </ RadioGroup >
210
+ </ Grid >
200
211
< Divider />
201
212
</ Grid >
202
213
< Grid container >
@@ -212,6 +223,7 @@ function NetworkMembers({ network }) {
212
223
( filterInactive ? x . online === 0 : true )
213
224
)
214
225
} )
226
+ . sort ( ( a , b ) => a [ sortBy ] . localeCompare ( b [ sortBy ] ) )
215
227
}
216
228
/>
217
229
) : (
0 commit comments