-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #287 from cosmos/peng/282-fix-mobile
Peng/282 fix mobile
- Loading branch information
Showing
15 changed files
with
173 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,25 @@ | ||
<template lang='pug'> | ||
footer.app-footer | ||
.app-footer-container(v-if='connected') | ||
.afi.afi-success | ||
i.material-icons.success done | ||
span {{ lastHeader.chain_id }} (\#{{ lastHeader.height }}) | ||
.afi | ||
i.material-icons settings_ethernet | ||
span {{ nodeIP }} | ||
.app-footer-container(v-else) | ||
.afi | ||
i.material-icons.fa-spin rotate_right | ||
span Connecting… | ||
connectivity | ||
</template> | ||
|
||
<script> | ||
import { mapGetters } from 'vuex' | ||
import Connectivity from 'common/NiConnectivity' | ||
export default { | ||
name: 'app-footer', | ||
computed: { | ||
...mapGetters(['lastHeader', 'nodeIP', 'connected']) | ||
components: { | ||
Connectivity | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="stylus"> | ||
@require '~variables' | ||
.app-footer-container | ||
border-top px solid bc | ||
height 3rem + px | ||
display flex | ||
align-items center | ||
justify-content space-between | ||
background app-bg | ||
.app-footer | ||
display none | ||
color dim | ||
.afi | ||
display flex | ||
align-items center | ||
padding 0 1rem | ||
i | ||
margin-right 0.5rem | ||
.success | ||
color success | ||
@media screen and (max-width: 567px) | ||
.app-footer-container | ||
display none | ||
@media screen and (min-width: 1024px) | ||
.app-footer | ||
display block | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template lang='pug'> | ||
.ni-connectivity(v-if='connected') | ||
list-item(icon="done" :title="blockString") | ||
list-item(icon="settings_ethernet" :title="nodeIP") | ||
.ni-connectivity(v-else) | ||
list-item(icon="rotate_right" title="Connecting...") | ||
</template> | ||
|
||
<script> | ||
import { mapGetters } from 'vuex' | ||
import ListItem from 'common/NiListItem' | ||
import num from 'scripts/num' | ||
export default { | ||
name: 'ni-connectivity', | ||
components: { | ||
ListItem | ||
}, | ||
computed: { | ||
...mapGetters(['lastHeader', 'nodeIP', 'connected']), | ||
blockString () { | ||
return `${this.lastHeader.chain_id} (#${num.prettyInt(this.lastHeader.height)})` | ||
} | ||
}, | ||
data: () => ({ | ||
num: num | ||
}) | ||
} | ||
</script> | ||
|
||
<style lang="stylus"> | ||
@require '~variables' | ||
.ni-connectivity | ||
background app-bg | ||
@media screen and (min-width: 1024px) | ||
.ni-connectivity | ||
border-top px solid bc | ||
height 3rem + px | ||
display flex | ||
align-items center | ||
justify-content space-between | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import Vuex from 'vuex' | ||
import { mount, createLocalVue } from 'vue-test-utils' | ||
import htmlBeautify from 'html-beautify' | ||
import NiConnectivity from 'common/NiConnectivity' | ||
|
||
const localVue = createLocalVue() | ||
localVue.use(Vuex) | ||
|
||
describe('NiConnectivity', () => { | ||
let wrapper | ||
let store = new Vuex.Store({ | ||
getters: { | ||
connected: () => true, | ||
lastHeader: () => ({ chain_id: 'gaia-home', height: '31337' }), | ||
nodeIP: () => '127.0.0.1' | ||
} | ||
}) | ||
store.commit = jest.fn() | ||
|
||
beforeEach(() => { | ||
wrapper = mount(NiConnectivity, { | ||
localVue, | ||
store | ||
}) | ||
}) | ||
|
||
it('has the expected html structure', () => { | ||
expect(htmlBeautify(wrapper.html())).toMatchSnapshot() | ||
}) | ||
|
||
it('has a network icon', () => { | ||
expect(wrapper.find('.ni-li:nth-child(1) i.material-icons').text().trim()) | ||
.toBe('done') | ||
}) | ||
|
||
it('has a network string', () => { | ||
expect(wrapper.find('.ni-li:nth-child(1) .ni-li-title').text().trim()) | ||
.toBe('gaia-home (#31,337)') | ||
}) | ||
|
||
it('has an IP icon', () => { | ||
expect(wrapper.find('.ni-li:nth-child(2) i.material-icons').text().trim()) | ||
.toBe('settings_ethernet') | ||
}) | ||
|
||
it('has an IP string', () => { | ||
expect(wrapper.find('.ni-li:nth-child(2) .ni-li-title').text().trim()) | ||
.toBe('127.0.0.1') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`NiConnectivity has the expected html structure 1`] = ` | ||
"<div class=\\"ni-connectivity\\"> | ||
<div class=\\"ni-li\\"> | ||
<div class=\\"ni-li-container\\"> | ||
<div class=\\"ni-li-thumb\\"> | ||
<i class=\\"material-icons\\">done</i> | ||
</div> | ||
<div class=\\"ni-li-label\\"> | ||
<div class=\\"ni-li-title\\"> | ||
gaia-home (#31,337) | ||
</div> | ||
<div class=\\"ni-li-subtitle\\"></div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class=\\"ni-li\\"> | ||
<div class=\\"ni-li-container\\"> | ||
<div class=\\"ni-li-thumb\\"> | ||
<i class=\\"material-icons\\">settings_ethernet</i> | ||
</div> | ||
<div class=\\"ni-li-label\\"> | ||
<div class=\\"ni-li-title\\"> | ||
127.0.0.1 | ||
</div> | ||
<div class=\\"ni-li-subtitle\\"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div>" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.