Skip to content

Commit

Permalink
Merge pull request #317 from cosmos/jordan/128-simplify-app-menu
Browse files Browse the repository at this point in the history
simplify app menu / architecture
  • Loading branch information
jbibla authored Jan 4, 2018
2 parents 074696a + e568eea commit 446c2ea
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 32 deletions.
24 changes: 10 additions & 14 deletions app/src/renderer/components/common/AppMenu.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<template lang="pug">
menu.app-menu
.app-menu-main
part(title='Wallet')
list-item(to="/" exact @click.native="close" title="Balance")
list-item(to="/wallet/send" exact @click.native="close" title="Send")
list-item(to="/wallet/transactions" exact @click.native="close" title="Transactions")
part(title='Governance' v-if="config.devMode")
list-item(to="/proposals" exact @click.native="close" title="Proposals")
part(title='Stake')
list-item(to="/staking" exact @click.native="close" title="Delegates")
part(title='Monitor' v-if="config.devMode")
list-item(to="/blockchain" exact @click.native="close" title="Blockchain")
list-item(to="/validators" exact @click.native="close" title="Validators"
v-bind:class="{ 'active': isValidatorPage }")
part(title='Connectivity')
connectivity
list-item(to="/" exact @click.native="close" title="Balances")
list-item(to="/wallet/transactions" exact @click.native="close" title="Transactions")
list-item(to="/staking" exact @click.native="close" title="Delegates")
list-item(to="/validators" exact @click.native="close" title="Validators" v-bind:class="{ 'active': isValidatorPage }")
list-item(to="/proposals" exact @click.native="close" title="Proposals" v-if="config.devMode")
list-item(to="/blockchain" exact @click.native="close" title="Monitor" v-if="config.devMode")
connectivity
user-pane
</template>

Expand Down Expand Up @@ -72,6 +65,9 @@ export default {
flex 1
position relative // for perfect-scrollbar
.ni-li-link
padding 0 0 0 1rem
.ni-user
border-top 1px solid bc
padding 1rem
Expand Down
4 changes: 4 additions & 0 deletions app/src/renderer/components/common/NiConnectivity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export default {
.ni-connectivity
background app-bg
.ni-li-thumb
.material-icons
color success
@media screen and (min-width: 1024px)
.ni-connectivity
border-top px solid bc
Expand Down
3 changes: 1 addition & 2 deletions app/src/renderer/components/common/NiListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ export default {
width 3rem - px
i.material-icons
display block
background app-fg
width 3rem - px
height 3rem - px
display flex
Expand All @@ -142,7 +141,7 @@ export default {
display flex
align-items flex-start
justify-content center
padding 0 1rem
padding 0 1rem 0 0
flex-flow column nowrap
.ni-li-title
Expand Down
7 changes: 1 addition & 6 deletions app/src/renderer/components/common/NiUserPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,13 @@ list-item.ni-li-user(
to="/profile"
@click.native="close"
icon="face"
:title="'Account ' + user.account")
:title="user.account")
div(v-else-if="user.signedIn")
list-item.ni-li-user(
type="link"
icon="exit_to_app"
@click.native="signOut"
title="Sign Out")
list-item.ni-li-user(
v-else
@click.native="openSession"
icon="exit_to_app"
title="Sign In")
</template>

<script>
Expand Down
10 changes: 1 addition & 9 deletions test/unit/specs/NiUserPane.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,11 @@ describe('NiUserPane', () => {
it('should not show the active account name if signed out', async () => {
await store.dispatch('signOut')
wrapper.update()
expect(wrapper.html()).not.toContain('ACTIVE_ACCOUNT')
expect(wrapper.html()).toBeUndefined()
})

it('should redirect to the profile page if signed in', () => {
wrapper.find(ListItem).trigger('click')
expect(router.currentRoute.path).toBe('/profile')
})

it('should show login page if clicked and signed out', async () => {
await store.dispatch('signOut')
wrapper.update()
wrapper.find(ListItem).trigger('click')
expect(store.commit).toHaveBeenCalledWith('setModalSession', true)
expect(store.commit).toHaveBeenCalledWith('setActiveMenu', '')
})
})
2 changes: 1 addition & 1 deletion test/unit/specs/__snapshots__/NiUserPane.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports[`NiUserPane has the expected html structure 1`] = `
<div
class="ni-li-title"
>
Account ACTIVE_ACCOUNT
ACTIVE_ACCOUNT
</div>
<div
class="ni-li-subtitle"
Expand Down

0 comments on commit 446c2ea

Please sign in to comment.