-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathwallets.ls
More file actions
89 lines (89 loc) · 2.48 KB
/
wallets.ls
File metadata and controls
89 lines (89 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
require! {
\react
\./wallet.ls
\prelude-ls : { map, take, drop }
\./menu.ls
\./seed.ls : { get }
\./web3.ls
\./navigate.ls
}
.wallets
@import scheme
$real-height: 300px
$cards-height: 296px
$pad: 20px
$radius: 15px
height: 373px
padding: 0 5px
box-sizing: border-box
position: absolute
left: 0
bottom: 5px
$cards-pad: 5px
right: 0
margin: 0 $cards-pad
z-index: 2
border-radius: $radius
>*
width: 100%
>.arrow
position: absolute
text-align: center
cursor: pointer
&.arrow-t
top: 0
margin-top: 10px
&.arrow-d
bottom: 0
margin-bottom: 10px
transform: rotate(180deg)
&:not(.true)
visibility: hidden
padding-top: 40px
padding-bottom: 40px
background: rgba(white, 0.5)
>.wallet-container
overflow: hidden
border-radius: $radius
height: $cards-height
width: 100%
arrow = \https://res.cloudinary.com/dfbhd7liw/image/upload/v1543595868/wallet/arrow.png
wallets = ({ store })->
return null if not store.current.account?
{ list } = store.current
max = 4
can-up = store.current.list > 0
can-down = store.current.list < store.current.account.wallets.length / max
#get-wallet-index = ->
# store.current.wallet-index =
# store.current.list * max
go-up = ->
return if not can-up
store.current.list -= max
store.current.wallet-index = 0
go-down = ->
return if not can-down
store.current.list += max
store.current.wallet-index = 0
wallets =
store.current.account.wallets
|> drop list
|> take max
.pug(key="wallets")
menu { store }
.wallets.pug(key="wallets-body")
.arrow.arrow-t.pug(on-click=go-up class="#{can-up}" key="arrow-up")
img.pug(src="#{arrow}")
.wallet-container.pug(key="wallets-viewport")
wallets |> map wallet store, wallets
.arrow.arrow-d.pug(on-click=go-down class="#{can-down}" key="arrow-down")
img.pug(src="#{arrow}")
wallets.init = (store, cb)->
delete store.current.send?wallet
store.current.send?tx-type = \regular
return cb null if store.current.account?
store.current.seed = get!
refresh-timer = 30 * 60 * 1000
err <- web3(store, { refresh-timer }).refresh
cb err
module.exports = wallets