Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Receive Button #602

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions app/src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,30 @@
router-view
app-footer
modal-help
modal-receive
session(v-else)
notifications(:notifications='notifications' theme='cosmos')
modal-error(v-if='config.modals.error.active' :body='config.modals.error.message')
</template>

<script>
import { mapGetters } from "vuex"
import AppHeader from "common/AppHeader"
import AppFooter from "common/AppFooter"
import Notifications from "@nylira/vue-notifications"
import ModalError from "common/NiModalError"
import ModalHelp from "common/NiModalHelp"
import Session from "common/NiSession"
import store from "./vuex/store"
import { mapGetters } from 'vuex'
import AppHeader from 'common/AppHeader'
import AppFooter from 'common/AppFooter'
import Notifications from '@nylira/vue-notifications'
import ModalError from 'common/NiModalError'
import ModalHelp from 'common/NiModalHelp'
import ModalReceive from 'common/NiModalReceive'
import Session from 'common/NiSession'
import store from './vuex/store'
export default {
name: "app",
components: {
AppHeader,
AppFooter,
ModalError,
ModalHelp,
ModalReceive,
Notifications,
Session
},
Expand Down
23 changes: 19 additions & 4 deletions app/src/renderer/components/common/NiLiCopy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
.value {{ value }}
menu
btn-copy(:value='value')
btn.receive(
v-if="receive"
value="Receive"
@click.native="enableModalReceive"
icon="file_download"
address="value")
</template>

<script>
import BtnCopy from "common/NiBtnCopy"
import BtnCopy from 'common/NiBtnCopy'
import Btn from '@nylira/vue-button'
export default {
name: "ni-li-copy",
components: { BtnCopy },
props: ["value"]
name: 'ni-li-copy',
components: { BtnCopy, Btn },
props: ['value', 'receive'],
methods: {
enableModalReceive () {
this.$store.commit('setModalReceive', true)
}
}
}
</script>

Expand All @@ -33,6 +45,9 @@ export default {
text-overflow ellipsis
white-space nowrap

.receive
margin-left 0.5rem

menu
display flex
align-items center
Expand Down
56 changes: 56 additions & 0 deletions app/src/renderer/components/common/NiModalReceive.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<template lang="pug">
modal.ni-modal-receive(v-if="active" :close="close")
div(slot='title') Receive Tokens
p You can receive tokens of any denomination by sharing this address.
li-copy.receive-modal(:value="wallet.key.address")
</template>

<script>
import { mapGetters } from 'vuex'
import Btn from '@nylira/vue-button'
import BtnCopy from 'common/NiBtnCopy'
import LiCopy from 'common/NiLiCopy'
import Modal from 'common/NiModal'
import Part from 'common/NiPart'
export default {
name: 'ni-modal-receive',
props: ['value'],
components: {
Btn,
BtnCopy,
LiCopy,
Modal,
Part
},
computed: {
...mapGetters(['config', 'wallet']),
active () {
return this.config.modals.receive.active
}
},
methods: {
close () {
this.$store.commit('setModalReceive', false)
}
}
}
</script>

<style lang="stylus">
@import '~variables'

.ni-modal.ni-modal-receive
z-index z(modalError)

.ni-modal-main
padding 2rem

p
margin 0 0 2rem

.receive-modal
border 1px solid bc

.value
padding 0
</style>
2 changes: 1 addition & 1 deletion app/src/renderer/components/wallet/PageWallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ page(title='Wallet')
modal-search(type="balances")

part(title='Your Address')
li-copy(:value="wallet.key.address")
li-copy(:value="wallet.key.address" receive="true")

part(title="Denomination Balances")
data-loading(v-if="wallet.balancesLoading")
Expand Down
6 changes: 5 additions & 1 deletion app/src/renderer/vuex/modules/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default ({ commit }) => {
modals: {
error: { active: false },
help: { active: false },
receive: { active: false },
session: {
active: true,
state: "loading"
Expand All @@ -34,7 +35,10 @@ export default ({ commit }) => {
setModalHelp(state, value) {
state.modals.help.active = value
},
setModalSession(state, value) {
setModalReceive (state, value) {
state.modals.receive.active = value
},
setModalSession (state, value) {
// reset modal session state if we're closing the modal
if (value) {
noScroll.on()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ exports[`NiLiCopy has the expected html structure 1`] = `
</span>
</span>
</button>
<!---->
</menu>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,27 @@ exports[`PageWallet has the expected html structure 1`] = `
</span>
</span>
</button>
<button
address="value"
class="ni-btn receive"
>
<span
class="ni-btn__container"
>
<i
aria-hidden="true"
class="ni-btn__icon material-icons"
>
file_download
</i>
<!---->
<span
class="ni-btn__value"
>
Receive
</span>
</span>
</button>
</menu>
</div>
</main>
Expand Down Expand Up @@ -469,6 +490,27 @@ exports[`PageWallet should filter the balances 1`] = `
</span>
</span>
</button>
<button
address="value"
class="ni-btn receive"
>
<span
class="ni-btn__container"
>
<i
aria-hidden="true"
class="ni-btn__icon material-icons"
>
file_download
</i>
<!---->
<span
class="ni-btn__value"
>
Receive
</span>
</span>
</button>
</menu>
</div>
</main>
Expand Down