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

simplify app menu / architecture #317

Merged
merged 7 commits into from
Jan 4, 2018
Merged
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
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