Skip to content

Commit a2b4cc7

Browse files
authored
Merge pull request #362 from neomjs/dev
v1.0.61
2 parents 2c3709a + 008ff4f commit a2b4cc7

File tree

19 files changed

+170
-57
lines changed

19 files changed

+170
-57
lines changed

apps/covid/model/Country.mjs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,35 @@ class Country extends Model {
99
className: 'Covid.model.Country',
1010

1111
fields: [{
12+
name: 'active',
13+
type: 'Integer'
14+
}, {
1215
name: 'cases',
13-
type: 'int'
16+
type: 'Integer'
17+
}, {
18+
name: 'casesPerOneMillion',
19+
type: 'Integer'
1420
}, {
1521
name: 'country',
16-
type: 'string'
22+
type: 'String'
23+
}, {
24+
name: 'countryInfo',
25+
type: 'Object' // _id, flag, iso2, iso3, lat, long
1726
}, {
1827
name: 'critical',
19-
type: 'int'
28+
type: 'Integer'
2029
}, {
2130
name: 'deaths',
22-
type: 'int'
31+
type: 'Integer'
2332
}, {
2433
name: 'recovered',
25-
type: 'int'
34+
type: 'Integer'
2635
}, {
2736
name: 'todayCases',
28-
type: 'int'
37+
type: 'Integer'
2938
}, {
3039
name: 'todayDeaths',
31-
type: 'int'
40+
type: 'Integer'
3241
}]
3342
}}
3443
}

apps/covid/view/FooterContainer.mjs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import {default as Container} from '../../../src/container/Base.mjs';
2+
3+
/**
4+
* @class Covid.view.FooterContainer
5+
* @extends Neo.container.Base
6+
*/
7+
class FooterContainer extends Container {
8+
static getConfig() {return {
9+
/**
10+
* @member {String} className='Covid.view.FooterContainer'
11+
* @private
12+
*/
13+
className: 'Covid.view.FooterContainer',
14+
/**
15+
* @member {Number} height=20
16+
*/
17+
height: 25,
18+
/**
19+
* @member {Object} layout={ntype: 'hbox', align: 'stretch'}
20+
*/
21+
layout: {ntype: 'hbox'},
22+
/**
23+
* @member {String} reference='footer'
24+
*/
25+
reference: 'footer',
26+
/**
27+
* @member {Object} style={overflow: 'visible'}
28+
*/
29+
style: {overflow: 'visible'},
30+
/**
31+
* @member {Object} itemDefaults
32+
*/
33+
itemDefaults: {
34+
ntype: 'component',
35+
cls : ['neo-link-color'],
36+
style: {fontSize: '13px', padding: '10px', paddingTop: 0}
37+
},
38+
/**
39+
* @member {Array} items
40+
*/
41+
items: [{
42+
html : 'App created with <a target="_blank" href="https://github.com/neomjs/neo">neo.mjs</a>.'
43+
}, {
44+
flex: 1
45+
}, {
46+
html : 'Data provided by <a target="_blank" href="https://github.com/NovelCOVID/API">NovelCOVID/API</a>.'
47+
}, {
48+
flex: 1
49+
}, {
50+
html : 'Country Flag Icons made by <a target="_blank" href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a target="_blank" href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a>.'
51+
}, {
52+
ntype : 'button',
53+
cls : ['neo-button'],
54+
handler: 'onRemoveFooterButtonClick',
55+
height : 24,
56+
style : {margin: 0, marginRight: '10px', marginTop: '-5px'},
57+
text : 'Remove Footer'
58+
}]
59+
}}
60+
}
61+
62+
Neo.applyClassConfig(FooterContainer);
63+
64+
export {FooterContainer as default};

apps/covid/view/GalleryContainer.mjs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,6 @@ class GalleryContainer extends Container {
190190
'<b>Navigation Concept</b>',
191191
'<p>You can use the Arrow Keys to walk through the items.</p>'
192192
].join('')
193-
}, {
194-
module: BoxLabel,
195-
text : [
196-
'<b>Attribution</b>',
197-
'<p>App created with <a href="https://github.com/neomjs/neo">neo.mjs</a>.</p>',
198-
'<p>Data provided by <a href="https://github.com/NovelCOVID/API">NovelCOVID/API</a>.</p>',
199-
'<p>Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a>.</p>'
200-
].join('')
201193
}]
202194
}]
203195
}}

apps/covid/view/HeaderContainer.mjs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ class HeaderContainer extends Container {
3131
* @member {Array} items
3232
*/
3333
items: [{
34-
html : 'COVID-19 neo.mjs App',
35-
style: {padding: '20px'},
36-
width: 210
34+
cls : ['neo-link-color'],
35+
html : 'COVID-19 neo.mjs App',
36+
minWidth: 140,
37+
style : {padding: '20px'},
38+
width : 210
3739
}, {
3840
module : SelectField,
3941
displayField : 'country',
4042
flex : 'none',
4143
height : 25,
4244
labelPosition: 'inline',
4345
labelText : 'Select a Country',
46+
minWidth : 140,
4447
reference : 'country-field',
4548
style : {marginTop: '15px'},
4649
width : 200,
@@ -83,8 +86,8 @@ class HeaderContainer extends Container {
8386
tag: 'table',
8487
cn : [
8588
{tag: 'tr', cn : [{tag: 'td', html: 'Cases'}, {tag: 'td', cls: ['neo-align-right']}]},
86-
{tag: 'tr', cn : [{tag: 'td', html: 'Deaths'}, {tag: 'td', cls: ['neo-align-right', 'neo-content-deaths']}]},
87-
{tag: 'tr', cn : [{tag: 'td', html: 'Recovered'}, {tag: 'td', cls: ['neo-align-right', 'neo-content-recovered']}]}
89+
{tag: 'tr', cn : [{tag: 'td', html: 'Recovered'}, {tag: 'td', cls: ['neo-align-right', 'neo-content-recovered']}]},
90+
{tag: 'tr', cn : [{tag: 'td', html: 'Deaths'}, {tag: 'td', cls: ['neo-align-right', 'neo-content-deaths']}]}
8891
]
8992
}
9093
}, {

apps/covid/view/HelixContainer.mjs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,6 @@ class HelixContainer extends Container {
236236
'<p>Hit the Space Key to rotate the currently selected item to the front.</p>',
237237
'<p>Hit the Enter Key to expand the currently selected item.</p>'
238238
].join('')
239-
}, {
240-
module: BoxLabel,
241-
text : [
242-
'<b>Attribution</b>',
243-
'<p>App created with <a href="https://github.com/neomjs/neo">neo.mjs</a>.</p>',
244-
'<p>Data provided by <a href="https://github.com/NovelCOVID/API">NovelCOVID/API</a>.</p>',
245-
'<p>Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a>.</p>'
246-
].join('')
247239
}]
248240
}]
249241
}}

apps/covid/view/MainContainer.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import FooterContainer from './FooterContainer.mjs';
12
import GalleryContainer from './GalleryContainer.mjs';
23
import HeaderContainer from './HeaderContainer.mjs';
34
import HelixContainer from './HelixContainer.mjs';
@@ -47,7 +48,7 @@ class MainContainer extends Viewport {
4748
activeIndex: this.controller.getTabIndex(Neo.config.hash),
4849
flex : 1,
4950
reference : 'tab-container',
50-
style : {margin: '10px'},
51+
style : {margin: '10px', marginBottom: '10px'},
5152

5253
items: [{
5354
module : TableContainer,
@@ -72,7 +73,7 @@ class MainContainer extends Viewport {
7273
text : 'Helix'
7374
}
7475
}]
75-
}];
76+
}, FooterContainer];
7677
}
7778
}
7879

apps/covid/view/MainContainerController.mjs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ class MainContainerController extends ComponentController {
9090
vdom = summaryTable.vdom;
9191

9292
vdom.cn[0].cn[1].html = data.cases;
93-
vdom.cn[1].cn[1].html = data.deaths;
94-
vdom.cn[2].cn[1].html = data.recovered;
93+
vdom.cn[1].cn[1].html = data.recovered;
94+
vdom.cn[2].cn[1].html = data.deaths;
9595

9696
summaryTable.vdom = vdom;
9797
}
@@ -278,6 +278,13 @@ class MainContainerController extends ComponentController {
278278
me.loadSummaryData();
279279
}
280280

281+
/**
282+
* @param {Object} data
283+
*/
284+
onRemoveFooterButtonClick(data) {
285+
this.view.remove(this.getReference('footer'), true);
286+
}
287+
281288
/**
282289
* @param {Object} data
283290
*/

apps/covid/view/TableContainer.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ class TableContainer extends Container {
2323
* @member {Neo.controller.Component|null} controller=TableContainerController
2424
*/
2525
controller: TableContainerController,
26+
/**
27+
* @member {Number} historyPanelWidth=420
28+
* @private
29+
*/
30+
historyPanelWidth: 420,
2631
/**
2732
* @member {Neo.table.Container|null} table=null
2833
*/
@@ -49,7 +54,7 @@ class TableContainer extends Container {
4954
layout : {ntype: 'vbox', align: 'stretch'},
5055
reference: 'controls-panel',
5156
style : {backgroundColor: '#2b2b2b'},
52-
width : 410,
57+
width : '@config:historyPanelWidth',
5358

5459
containerConfig: {
5560
flex : null,

apps/covid/view/TableContainerController.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class TableContainerController extends ComponentController {
109109
const panel = this.getReference('controls-panel'),
110110
expand = panel.width === 40;
111111

112-
panel.width = expand ? 410 : 40;
112+
panel.width = expand ? this.view.historyPanelWidth : 40;
113113

114114
data.component.text = expand ? 'X' : '+';
115115
}

apps/covid/view/country/Gallery.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class CountryGallery extends Gallery {
166166
setTimeout(() => {
167167
this.selectOnMount = true;
168168
this.onMounted();
169-
}, Neo.config.environment === 'development' ? 200 : 500);
169+
}, 200);
170170
}
171171
}
172172

0 commit comments

Comments
 (0)