Skip to content

Commit bc7b5f3

Browse files
committed
Add map control
1 parent b932ef6 commit bc7b5f3

File tree

6 files changed

+36
-41
lines changed

6 files changed

+36
-41
lines changed

babel.config.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,11 @@ module.exports = function(api) {
99
[
1010
'@babel/preset-env',
1111
{
12-
modules: 'commonjs',
1312
targets: {
1413
node: 'current'
1514
}
1615
}
1716
]
18-
],
19-
plugins: [
20-
'syntax-dynamic-import',
21-
['transform-runtime', {
22-
polyfill: false,
23-
regenerator: true
24-
}]
2517
]
2618
}
2719
}

components/Map/index.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export default {
1818
const mapboxgl = require('mapbox-gl/dist/mapbox-gl')
1919
mapboxgl.accessToken = token
2020
21+
let totals
22+
let markers = {}
23+
let markersOnScreen = {}
24+
let point_counts = []
2125
const colors = ['#ffa332', '#66a266', '#b20000']
2226
2327
const map = new mapboxgl.Map({
@@ -27,10 +31,7 @@ export default {
2731
zoom: 1.6
2832
})
2933
30-
let markers = {}
31-
let markersOnScreen = {}
32-
let point_counts = []
33-
let totals
34+
map.addControl(new mapboxgl.NavigationControl())
3435
3536
const addLayers = map => {
3637
map.addSource('covid', {
@@ -114,7 +115,7 @@ export default {
114115
115116
map.easeTo({
116117
center: features[0].geometry.coordinates,
117-
zoom: map.getZoom() + 1
118+
zoom: zoom
118119
})
119120
})
120121
})

nuxt.config.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const webpack = require('webpack')
22
const pkg = require('./package')
3+
const _ = require('lodash')
34

45
const routerBase = process.env.DEPLOY_ENV === 'GH_PAGES' ? {
56
base: `/${process.env.REPO_NAME}/`
@@ -14,8 +15,7 @@ module.exports = {
1415
** Environment variables
1516
*/
1617
env: {
17-
accessToken: process.env.MAPBOX_TOKEN,
18-
apiUrl: process.env.API_URL
18+
accessToken: process.env.MAPBOX_TOKEN
1919
},
2020

2121
/*
@@ -52,17 +52,36 @@ module.exports = {
5252
/*
5353
** Plugins to load before mounting the App
5454
*/
55-
plugins: [
56-
'~/plugins/axios'
57-
],
55+
plugins: [],
5856

5957
/*
6058
** Nuxt.js modules
6159
*/
6260
modules: [
63-
'@nuxtjs/axios'
61+
'@nuxtjs/axios',
62+
'@nuxtjs/pwa'
6463
],
6564

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+
6685
/*
6786
** Router middleware
6887
*/

plugins/axios.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

store/actions.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
export default {
2-
async getData({ commit }, ctx) {
2+
async nuxtServerInit({ commit }, ctx) {
33
await this.$axios.get('/all')
44
.then(res => {
55
if (res.status === 200) {
6+
// const {
7+
// latest
8+
// } = res.data
69
commit('SET_DATA', res.data)
10+
// commit('SET_LATEST', latest)
711
}
812
})
913
.catch(err => {

store/mutations.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default {
1010
type: 'FeatureCollection',
1111
features: []
1212
}
13-
// const toCollection = (status, locations, collection) => {
1413
confirmed.locations.forEach((location, index) => {
1514
const recovered_locations = recovered.locations[index]
1615
const dead_locations = deaths.locations[index]
@@ -47,10 +46,6 @@ export default {
4746
}
4847
})
4948
})
50-
// }
51-
// toCollection('confirmed', confirmed.locations, dataCollection)
52-
// toCollection('recovered', recovered.locations, dataCollection)
53-
// toCollection('dead', deaths.locations, dataCollection)
5449
state.data = dataCollection
5550
}
5651
}

0 commit comments

Comments
 (0)