|
12 | 12 |
|
13 | 13 | <section class="networks" v-show="!collapsedSidebar"> |
14 | 14 | <section class="network" v-for="{network, accounts} in networkAccounts" v-show="accounts && accounts.length"> |
15 | | - <figure class="network-name">{{network.name}}</figure> |
| 15 | + <section class="network-details"> |
| 16 | + <figure class="network-name">{{network.name}}</figure> |
| 17 | + <figure class="expand-network" @click="toggleExpansion(network)" v-if="accounts.length > 1"> |
| 18 | + <span v-if="!expanded[network.unique()]">{{accounts.length-1}} more</span> |
| 19 | + <span v-else>hide</span> |
| 20 | + </figure> |
| 21 | + </section> |
16 | 22 | <section class="accounts"> |
17 | | - <section class="account" v-for="account in accounts"> |
| 23 | + <section class="account" v-for="account in accounts" v-if="search.length || expanded[network.unique()] || enabledAccounts.find(x => x.unique() === account.unique())"> |
18 | 24 | <figure class="account-name">{{account.sendable()}}<span class="authority" v-if="account.authority">@{{account.authority}}</span></figure> |
19 | | - <figure class="toggle"> |
20 | | - <Switcher small="1" :state="enabledAccounts.find(x => x.unique() === account.unique())" v-on:switched="select(account, network)" /> |
| 25 | + <figure class="select-account" :class="{'selected':enabledAccounts.find(x => x.unique() === account.unique())}" @click="select(account, network)"> |
| 26 | + <i class="fa fa-check"></i> |
21 | 27 | </figure> |
22 | 28 | </section> |
23 | 29 | </section> |
|
50 | 56 | search:'', |
51 | 57 | loadingAccounts:false, |
52 | 58 | networkAccounts:{}, |
| 59 | + expanded:{}, |
53 | 60 | }}, |
54 | 61 | computed:{ |
55 | 62 | ...mapState([ |
|
75 | 82 | this.refreshAccounts() |
76 | 83 | }, |
77 | 84 | methods:{ |
| 85 | + toggleExpansion(network){ |
| 86 | + if(this.expanded.hasOwnProperty(network.unique())) delete this.expanded[network.unique()]; |
| 87 | + else this.expanded[network.unique()] = true; |
| 88 | + this.$forceUpdate(); |
| 89 | + }, |
78 | 90 | async refreshAccounts(){ |
79 | 91 | this.loadingAccounts = true; |
80 | 92 | await SingularAccounts.refreshAccounts(this.networks, this.keys); |
|
100 | 112 | || x.authority.toLowerCase().indexOf(this.search) > -1 |
101 | 113 | || network.name.toLowerCase().indexOf(this.search) > -1; |
102 | 114 | }); |
103 | | - })().sort((a,b) => { |
104 | | - return a.sendable().localeCompare(b.sendable()) |
105 | | - }).sort((a,b) => { |
106 | | - return this.enabledAccounts.find(x => x.unique() === a.unique()) ? -1 : 0; |
107 | | - }) |
| 115 | + })() |
| 116 | +
|
| 117 | + // .sort((a,b) => { |
| 118 | + // return a.sendable().localeCompare(b.sendable()) |
| 119 | + // }).sort((a,b) => { |
| 120 | + // return this.enabledAccounts.find(x => x.unique() === a.unique()) ? -1 : 0; |
| 121 | + // }) |
108 | 122 | } |
109 | 123 | }); |
110 | 124 | }, |
|
199 | 213 |
|
200 | 214 | .networks { |
201 | 215 | overflow-y:auto; |
202 | | - max-height:calc(100vh - 180px); |
| 216 | + max-height:calc(100vh - 225px); |
203 | 217 | margin-top:20px; |
204 | 218 | padding-bottom:40px; |
| 219 | + margin-right:-12px; |
| 220 | + padding-right:5px; |
205 | 221 |
|
206 | 222 | .network { |
207 | 223 | margin-bottom:30px; |
208 | 224 |
|
209 | | - .network-name { |
210 | | - font-size: $font-size-tiny; |
211 | | - font-weight: bold; |
| 225 | + .network-details { |
| 226 | + display:flex; |
| 227 | + justify-content: space-between; |
212 | 228 | position: relative; |
213 | 229 | padding-bottom:5px; |
| 230 | + padding-right:10px; |
214 | 231 |
|
215 | 232 | &:after { |
216 | 233 | content:''; |
|
221 | 238 | left:-20px; |
222 | 239 | right:-20px; |
223 | 240 | } |
| 241 | +
|
| 242 | + .network-name { |
| 243 | + font-size: $font-size-tiny; |
| 244 | + font-weight: bold; |
| 245 | + position: relative; |
| 246 | +
|
| 247 | + i { |
| 248 | + margin-right:5px; |
| 249 | + color:$grey; |
| 250 | + } |
| 251 | + } |
| 252 | +
|
| 253 | + .expand-network { |
| 254 | + font-size: 11px; |
| 255 | + cursor: pointer; |
| 256 | + background:$blue; |
| 257 | + border-radius:4px; |
| 258 | + padding:3px 6px; |
| 259 | + color:white; |
| 260 | + } |
224 | 261 | } |
225 | 262 |
|
| 263 | +
|
| 264 | +
|
226 | 265 | .accounts { |
227 | 266 |
|
228 | 267 |
|
|
248 | 287 | } |
249 | 288 | } |
250 | 289 |
|
| 290 | + $select-account:20px; |
| 291 | + .select-account { |
| 292 | + width:$select-account; |
| 293 | + height:$select-account; |
| 294 | + border-radius:50%; |
| 295 | + display:flex; |
| 296 | + align-items: center; |
| 297 | + justify-content: center; |
| 298 | + font-size: 9px; |
| 299 | + cursor: pointer; |
| 300 | +
|
| 301 | + background:transparent; |
| 302 | + color:$blue; |
| 303 | + border:2px solid $lightgrey; |
| 304 | +
|
| 305 | + transition: all 0.1s ease; |
| 306 | + transition-property: background, color, border; |
| 307 | +
|
| 308 | + i { |
| 309 | + display:none; |
| 310 | + } |
| 311 | +
|
| 312 | + &.selected, &:hover { |
| 313 | + background:$blue; |
| 314 | + color:white; |
| 315 | + border:2px solid transparent; |
| 316 | +
|
| 317 | + i { |
| 318 | + display:block; |
| 319 | + } |
| 320 | + } |
| 321 | + } |
| 322 | +
|
251 | 323 | .toggle { |
252 | 324 |
|
253 | 325 | } |
|
0 commit comments