Skip to content

Commit b48452e

Browse files
authored
Merge pull request #49 from GetScatter/master
Fix for buttons on account switcher
2 parents a1abf56 + 69638a8 commit b48452e

2 files changed

Lines changed: 86 additions & 14 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bridge",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"private": true,
55
"scripts": {
66
"build": "npm run check && yarn && cross-env NODE_ENV=production BABEL_ENV=prod vue-cli-service build && npm run zip",

src/components/ManageAccounts.vue

Lines changed: 85 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@
1212

1313
<section class="networks" v-show="!collapsedSidebar">
1414
<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>
1622
<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())">
1824
<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>
2127
</figure>
2228
</section>
2329
</section>
@@ -50,6 +56,7 @@
5056
search:'',
5157
loadingAccounts:false,
5258
networkAccounts:{},
59+
expanded:{},
5360
}},
5461
computed:{
5562
...mapState([
@@ -75,6 +82,11 @@
7582
this.refreshAccounts()
7683
},
7784
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+
},
7890
async refreshAccounts(){
7991
this.loadingAccounts = true;
8092
await SingularAccounts.refreshAccounts(this.networks, this.keys);
@@ -100,11 +112,13 @@
100112
|| x.authority.toLowerCase().indexOf(this.search) > -1
101113
|| network.name.toLowerCase().indexOf(this.search) > -1;
102114
});
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+
// })
108122
}
109123
});
110124
},
@@ -199,18 +213,21 @@
199213
200214
.networks {
201215
overflow-y:auto;
202-
max-height:calc(100vh - 180px);
216+
max-height:calc(100vh - 225px);
203217
margin-top:20px;
204218
padding-bottom:40px;
219+
margin-right:-12px;
220+
padding-right:5px;
205221
206222
.network {
207223
margin-bottom:30px;
208224
209-
.network-name {
210-
font-size: $font-size-tiny;
211-
font-weight: bold;
225+
.network-details {
226+
display:flex;
227+
justify-content: space-between;
212228
position: relative;
213229
padding-bottom:5px;
230+
padding-right:10px;
214231
215232
&:after {
216233
content:'';
@@ -221,8 +238,30 @@
221238
left:-20px;
222239
right:-20px;
223240
}
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+
}
224261
}
225262
263+
264+
226265
.accounts {
227266
228267
@@ -248,6 +287,39 @@
248287
}
249288
}
250289
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+
251323
.toggle {
252324
253325
}

0 commit comments

Comments
 (0)