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

fedekunze/1718 remove session pt 1 #1916

Merged
merged 25 commits into from
Feb 13, 2019
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [\#1894](https://github.com/cosmos/voyager/issues/1894) Added favicons for all the browsers and devices @jbibla
- [\#1865](https://github.com/cosmos/voyager/issues/1865) Added Vuex blocks module @sabau
- [\#1928](https://github.com/cosmos/voyager/issues/1928) Added Browserstack reference to README @sabau
- [\#1918](https://github.com/cosmos/voyager/issues/1918) added message to log in when sending transactions and the user is not authenticated @fedekunze
- [\#1866](https://github.com/cosmos/voyager/issues/1866) Added blocks to network page and a page for viewing individual blocks @jbibla

### Changed
Expand Down Expand Up @@ -116,6 +117,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [\#1221](https://github.com/cosmos/voyager/issues/1221) individual linter check on GitHub @faboweb
- [\#1855](https://github.com/cosmos/voyager/issues/1855) skip gaia build if already built that hash @sabau
- [\#1922](https://github.com/cosmos/voyager/issues/1922) removed font awesome @jbibla
- [\#1916](https://github.com/cosmos/voyager/pull/1916) redirect to session modal when user hasn't logged in @fedekunze
- [\#1836](https://github.com/cosmos/voyager/issues/1836) remove back button @fedekunze
- [\#1948](https://github.com/cosmos/voyager/pull/1948) changed PR template @fedekunze
- [\#1946](https://github.com/cosmos/voyager/pull/1946) removed proposer_address raw hex @jbibla

Expand Down
22 changes: 17 additions & 5 deletions app/src/renderer/components/common/ActionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<img
class="icon action-modal-atom"
src="~assets/images/cosmos-logo.png"
/><span class="action-modal-title">{{ title }}</span>
/>
<span class="action-modal-title">
{{ user.signedIn ? title : `Sign in required` }}
</span>
<div
id="closeBtn"
class="action-modal-icon action-modal-close"
Expand All @@ -14,7 +17,10 @@
<i class="material-icons">close</i>
</div>
</div>
<div v-if="step === `txDetails`" class="action-modal-form">
<div v-if="!user.signedIn" class="action-modal-form">
<p>You need to sign in to submit a transaction.</p>
</div>
<div v-else-if="step === `txDetails`" class="action-modal-form">
<slot />
<tm-form-group
v-if="signMethods.length > 1"
Expand Down Expand Up @@ -50,7 +56,7 @@
/>
</tm-form-group>
</div>
<div v-else-if="step === `sign`">
<div v-else-if="step === `sign`" class="action-modal-form">
<hardware-state
icon="usb"
value="Please unlock the Cosmos app on your Ledger Nano S"
Expand All @@ -61,7 +67,13 @@
<tm-form-group class="action-modal-group">
<div class="action-modal-footer">
<tm-btn
v-if="sending"
v-if="!user.signedIn"
value="Go to Sign In"
color="primary"
@click.native="$store.commit(`setSignIn`, true)"
/>
<tm-btn
v-else-if="sending"
value="Sending..."
disabled="disabled"
color="primary"
Expand Down Expand Up @@ -161,7 +173,7 @@ export default {
show: false
}),
computed: {
...mapGetters([`connected`, signWithLedger]),
...mapGetters([`connected`, `ledger`, `user`]),
selectedSignMethod() {
if (this.ledger.isConnected) {
return signWithLedger
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/common/TmPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h2 v-if="title" slot="title">{{ title }}</h2>
<h3 v-if="subtitle" slot="subtitle">{{ subtitle }}</h3>
<slot slot="menu-body" name="menu-body">
<tm-balance />
<tm-balance v-if="user.signedIn" />
<tool-bar :refresh="refreshable" :searching="searchable" />
</slot>
<slot slot="header-buttons" name="header-buttons" />
Expand Down
23 changes: 3 additions & 20 deletions app/src/renderer/components/common/ToolBar.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<template>
<div class="tool-bar">
<a
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
v-tooltip.bottom="'Back'"
:disabled="user.history.length === 0"
class="back"
@click="back"
>
<i class="material-icons">arrow_back</i>
</a>
<a
v-tooltip.bottom="'Refresh'"
v-if="!!refresh"
Expand All @@ -32,7 +24,7 @@
</a>
<router-link
v-tooltip.bottom="'Preferences'"
v-if="config.devMode"
v-if="user.signedIn"
id="settings"
to="/preferences"
>
Expand All @@ -45,7 +37,7 @@
</template>

<script>
import { mapGetters, mapMutations } from "vuex"
import { mapGetters } from "vuex"
export default {
name: `tool-bar`,
props: {
Expand All @@ -59,7 +51,7 @@ export default {
}
},
computed: {
...mapGetters([`user`, `lastPage`, `config`]),
...mapGetters([`user`, `config`]),
searchEnabled() {
return !!this.searching
},
Expand All @@ -71,15 +63,6 @@ export default {
}
},
methods: {
...mapMutations([`pauseHistory`, `popHistory`]),
back() {
if (!this.lastPage) return
this.pauseHistory(true)
this.$router.push(this.lastPage, () => {
this.popHistory()
this.pauseHistory(false)
})
},
enableModalHelp() {
this.$store.commit(`setModalHelp`, true)
},
Expand Down
8 changes: 7 additions & 1 deletion app/src/renderer/components/governance/PageGovernance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ export default {
]
}),
computed: {
...mapGetters([`proposals`, `filters`, `depositDenom`, `connected`]),
...mapGetters([
`proposals`,
`filters`,
`depositDenom`,
`connected`,
`user`
]),
proposalList() {
return Object.values(this.proposals.proposals)
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/renderer/components/governance/PageProposal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ export default {
`connected`,
`wallet`,
`votes`,
`config`
`config`,
`user`
]),
proposal() {
return this.proposals.proposals[this.proposalId]
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/staking/PageStaking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default {
]
}),
computed: {
...mapGetters([`connected`, `delegates`, `filters`])
...mapGetters([`connected`, `delegates`, `filters`, `user`])
},
methods: {
...mapActions([`updateDelegates`])
Expand Down
1 change: 1 addition & 0 deletions app/src/renderer/components/staking/PageValidator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export default {
`config`,
`keybase`,
`liquidAtoms`,
`user`,
`wallet`,
`connected`
]),
Expand Down
3 changes: 0 additions & 3 deletions app/src/renderer/components/staking/TableValidators.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ export default {
async mounted() {
Mousetrap.bind([`command+f`, `ctrl+f`], () => this.setSearch(true))
Mousetrap.bind(`esc`, () => this.setSearch(false))

// XXX temporary because querying the shares shows old shares after bonding
// this.updateDelegates()
},
methods: {
updateDelegates() {
Expand Down
17 changes: 11 additions & 6 deletions app/src/renderer/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ export default [
path: `/staking`,
name: `Staking`,
component: require(`./components/staking/PageStaking`).default,
redirect: `/staking/my-delegations/`,
redirect: `/staking/validators/`,
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
children: [
{
path: `my-delegations`,
name: `My Delegations`,
component: require(`./components/staking/TabMyDelegations`).default
component: require(`./components/staking/TabMyDelegations`).default,
meta: { requiresAuth: true }
},
{
path: `validators`,
Expand All @@ -62,23 +63,27 @@ export default [
{
path: `/preferences`,
name: `preferences`,
component: require(`./components/common/PagePreferences`).default
component: require(`./components/common/PagePreferences`).default,
meta: { requiresAuth: true }
},
{
path: `/`,
name: `wallet`,
component: require(`./components/wallet/PageWallet`).default
component: require(`./components/wallet/PageWallet`).default,
meta: { requiresAuth: true }
},
{
path: `/wallet/send/:denom?`,
name: `send`,
props: true,
component: require(`./components/wallet/SendModal`).default
component: require(`./components/wallet/SendModal`).default,
meta: { requiresAuth: true }
},
{
path: `/transactions`,
name: `transactions`,
component: require(`./components/wallet/PageTransactions`).default
component: require(`./components/wallet/PageTransactions`).default,
meta: { requiresAuth: true }
},
{
path: `/network`,
Expand Down
19 changes: 18 additions & 1 deletion app/src/renderer/scripts/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,25 @@ import * as urlHelpers from "../../helpers/url.js"
import _config from "../../config"

export const routeGuard = store => (to, from, next) => {
if (from.fullPath !== to.fullPath && !store.getters.user.pauseHistory)
if (from.fullPath !== to.fullPath && !store.getters.user.pauseHistory) {
store.commit(`addHistory`, from.fullPath)
}

if (to.redirectedFrom == `/staking` && store.state.user.signedIn) {
to = Object.assign({}, to, {
path: `/staking/my-delegations`,
fullPath: `/staking/my-delegations`,
name: `My Delegations`
})
next(to.path)
} else if (
!store.state.user.signedIn &&
to.matched.some(record => record.meta.requiresAuth)
) {
// redirect to session page if auth required
store.commit(`setModalSessionState`, `welcome`)
store.commit(`setModalSession`, true)
}
next()
}

Expand Down
7 changes: 4 additions & 3 deletions app/src/renderer/vuex/modules/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function({ node }) {
}, 1000)
}
},
async rpcSubscribe({ commit, dispatch }) {
async rpcSubscribe({ commit, dispatch, rootState }) {
const { node } = state.externals
if (state.stopConnecting) return

Expand Down Expand Up @@ -103,8 +103,9 @@ export default function({ node }) {
dispatch(`setLastHeader`, header)
}
)

dispatch(`walletSubscribe`)
if (rootState.user.signedIn) {
dispatch(`walletSubscribe`)
}
dispatch(`checkNodeHalted`)
dispatch(`pollRPCConnection`)
},
Expand Down
4 changes: 2 additions & 2 deletions app/src/renderer/vuex/modules/delegation.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export default ({ node }) => {
}
}
const actions = {
reconnected({ state, dispatch }) {
if (state.loading) {
reconnected({ state, dispatch, rootState }) {
if (state.loading && rootState.user.signedIn) {
dispatch(`getBondedDelegates`)
}
},
Expand Down
5 changes: 3 additions & 2 deletions app/src/renderer/vuex/modules/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ export default ({ node }) => {
// clear previous account state
rootState.transactions = JSON.parse(JSON.stringify(emptyState))
},
async reconnected({ state, dispatch }) {
if (state.loading) {
async reconnected({ state, dispatch, rootState }) {
// TODO: remove signedIn check when we support the option for setting a custom address for txs page
if (state.loading && rootState.user.signedIn) {
await dispatch(`getAllTxs`)
}
},
Expand Down
6 changes: 1 addition & 5 deletions app/src/renderer/vuex/modules/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,9 @@ export default ({}) => {
},
async showInitialScreen({ state, dispatch, commit }) {
dispatch(`resetSessionData`)

await dispatch(`loadAccounts`)
commit(`setModalSessionState`, `welcome`)

state.externals.track(`pageview`, {
dl: `/session/welcome`
})
state.externals.track(`pageview`, { dl: `/` })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the thinking here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the main page is not longer /session/welcome

},
async loadAccounts({ commit, state }) {
state.loading = true
Expand Down
4 changes: 2 additions & 2 deletions app/src/renderer/vuex/modules/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default ({ node }) => {
}

const actions = {
async reconnected({ state, dispatch }) {
if (state.loading && state.address) {
async reconnected({ rootState, state, dispatch }) {
if (state.loading && state.address && rootState.user.signedIn) {
await dispatch(`queryWalletBalances`)
}
},
Expand Down
Loading