Skip to content

Commit b7d82c6

Browse files
committed
Fix for travis error
1 parent dd16b72 commit b7d82c6

File tree

11 files changed

+68
-257
lines changed

11 files changed

+68
-257
lines changed

babel.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ module.exports = function(api) {
99
[
1010
'@babel/preset-env',
1111
{
12+
modules: 'commonjs',
1213
targets: {
1314
node: 'current'
1415
}
1516
}
1617
]
18+
],
19+
plugins: [
20+
'syntax-dynamic-import',
21+
['transform-runtime', {
22+
polyfill: false,
23+
regenerator: true
24+
}]
1725
]
1826
}
1927
}

components/Map/index.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,10 @@ export default {
154154
.addTo(map)
155155
})
156156
157-
map.on('mouseenter', 'clusters', function() {
158-
map.getCanvas().style.cursor = 'pointer'
159-
})
160-
161-
map.on('mouseleave', 'clusters', function() {
162-
map.getCanvas().style.cursor = ''
163-
})
157+
map.on('mouseenter', 'clusters', () => map.getCanvas().style.cursor = 'pointer')
158+
map.on('mouseleave', 'clusters', () => map.getCanvas().style.cursor = '')
159+
map.on('mouseenter', 'unclustered-point', () => map.getCanvas().style.cursor = 'pointer')
160+
map.on('mouseleave', 'unclustered-point', () => map.getCanvas().style.cursor = '')
164161
}
165162
},
166163
mounted() {

components/Search/index.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ export default {
3535
background-color: rgba(39, 39, 39, 1);
3636
box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 4px -1px, rgba(0, 0, 0, 0.14) 0px 4px 5px 0px, rgba(0, 0, 0, 0.12) 0px 1px 10px 0px;
3737
animation: float-up 1s infinite alternate;
38+
39+
&:hover {
40+
animation-play-state: paused;
41+
}
3842
}
3943
4044
@keyframes float-up {
4145
0% {
42-
transform: translate3d(0, 0px, 0);
43-
}
46+
transform: translate3d(0, 0px, 0);
47+
}
4448
100% {
45-
transform: translate3d(0, 5px, 0);
46-
}
49+
transform: translate3d(0, 8px, 0);
50+
}
4751
}
4852
</style>

nuxt.config.js

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module.exports = {
1515
** Environment variables
1616
*/
1717
env: {
18-
accessToken: process.env.MAPBOX_TOKEN
18+
accessToken: process.env.MAPBOX_TOKEN,
19+
apiUrl: process.env.API_URL || 'http://localhost:3000/'
1920
},
2021

2122
/*
@@ -58,30 +59,9 @@ module.exports = {
5859
** Nuxt.js modules
5960
*/
6061
modules: [
61-
'@nuxtjs/axios',
62-
'@nuxtjs/pwa'
62+
'@nuxtjs/axios'
6363
],
6464

65-
/*
66-
** Axios configuration
67-
*/
68-
axios: {
69-
baseURL: process.env.API_URL || 'http://localhost:3000/'
70-
},
71-
72-
/*
73-
** PWA configuration
74-
*/
75-
pwa: {
76-
manifest: {
77-
name: pkg.author.name,
78-
short_name: pkg.author.name.split(' ')[0]
79-
},
80-
icons: {
81-
sizes: [16, 32, 180, 192, 512]
82-
}
83-
},
84-
8565
/*
8666
** Router middleware
8767
*/

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"dependencies": {
2020
"@nuxtjs/axios": "^5.9.5",
21-
"@nuxtjs/pwa": "^3.0.0-beta.20",
21+
"babel-runtime": "^6.26.0",
2222
"cross-env": "^5.2.0",
2323
"mapbox-gl": "^1.8.1",
2424
"mapbox-gl-vue": "^2.0.4",
@@ -30,6 +30,7 @@
3030
"@vue/test-utils": "^1.0.0-beta.31",
3131
"babel-core": "^7.0.0-bridge.0",
3232
"babel-jest": "^25.1.0",
33+
"babel-plugin-transform-runtime": "^6.23.0",
3334
"dotenv": "^8.2.0",
3435
"jest": "^25.1.0",
3536
"jest-serializer-vue": "^2.0.2",

pages/index.vue

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
<template>
22
<div>
3-
<Map :data="data" />
3+
<Map :data="$store.state.data" />
44
</div>
55
</template>
66

77
<script>
8-
import { mapGetters } from 'vuex'
98
import Map from '~/components/Map'
109
1110
export default {
12-
loading: false,
11+
async fetch ({ app: { $axios }, store, params }) {
12+
const { data } = await $axios.get(`${process.env.apiUrl}/all`)
13+
store.commit('SET_DATA', data)
14+
},
1315
components: {
1416
Map
15-
},
16-
computed: {
17-
...mapGetters([
18-
'data'
19-
])
20-
},
21-
data() {
22-
return {}
2317
}
2418
}
2519
</script>

store/actions.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
export default {
2-
async nuxtServerInit({ commit }, ctx) {
2+
async getData({ commit }, ctx) {
33
await this.$axios.get('/all')
44
.then(res => {
55
if (res.status === 200) {
6-
const {
7-
confirmed,
8-
recovered,
9-
deaths
10-
// latest
11-
} = res.data
126
commit('SET_DATA', res.data)
13-
commit('SET_CONFIRMED', confirmed)
14-
commit('SET_RECOVERED', recovered)
15-
commit('SET_DEATHS', deaths)
16-
// commit('SET_LATEST', latest)
177
}
188
})
199
.catch(err => {

store/getters.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
export default {
2-
data: state => state.data,
3-
confirmed: state => state.confirmed,
4-
deaths: state => state.deaths,
5-
latest: state => state.latest,
6-
recovered: state => state.recovered
2+
data: state => state.data
73
}

store/mutations.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -52,44 +52,5 @@ export default {
5252
// toCollection('recovered', recovered.locations, dataCollection)
5353
// toCollection('dead', deaths.locations, dataCollection)
5454
state.data = dataCollection
55-
},
56-
SET_CONFIRMED: (state, confirmed) => {
57-
const { locations } = confirmed
58-
const confirmedCollection = {
59-
type: 'FeatureCollection',
60-
features: []
61-
}
62-
locations.forEach((location, index) => {
63-
const cluster_id = location.country_code + (location.province ? `_${location.province}` : '') + `_${index}`
64-
confirmedCollection.features.push({
65-
type: 'Feature',
66-
properties: {
67-
cluster_id: cluster_id,
68-
state: 1,
69-
country: location.country,
70-
country_code: location.country_code,
71-
history: location.history,
72-
latest: location.latest,
73-
province: location.province
74-
},
75-
geometry: {
76-
type: 'Point',
77-
coordinates: [
78-
location.coordinates.long,
79-
location.coordinates.lat
80-
]
81-
}
82-
})
83-
})
84-
state.confirmed = confirmedCollection
85-
},
86-
SET_RECOVERED: (state, recovered) => {
87-
state.recovered = recovered
88-
},
89-
SET_DEATHS: (state, deaths) => {
90-
state.deaths = deaths
91-
},
92-
SET_LATEST: (state, latest) => {
93-
state.latest = latest
9455
}
9556
}

store/state.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
export default () => ({
2-
data: {},
3-
confirmed: {},
4-
recovered: {},
5-
deaths: {},
6-
latest: {}
2+
data: {}
73
})

0 commit comments

Comments
 (0)