diff --git a/.travis.yml b/.travis.yml index cbd49a9..bb0dece 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,5 @@ deploy: github_token: $GITHUB_TOKEN local_dir: dist on: - branch: master \ No newline at end of file + branch: master + tags: true \ No newline at end of file diff --git a/package.json b/package.json index f7bbf27..d149b82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "covid-vue", - "version": "0.2.0", + "version": "0.5.0", "private": true, "scripts": { "serve": "vue-cli-service serve", @@ -18,6 +18,7 @@ "vuex": "^3.1.3" }, "devDependencies": { + "@fortawesome/fontawesome-free": "^5.13.0", "@vue/cli-plugin-babel": "~4.3.0", "@vue/cli-plugin-eslint": "~4.3.0", "@vue/cli-plugin-router": "~4.3.0", diff --git a/src/App.vue b/src/App.vue index c35d9f8..57306a0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,9 +1,19 @@ - + diff --git a/src/components/Header.vue b/src/components/Header.vue new file mode 100644 index 0000000..3d5ccf3 --- /dev/null +++ b/src/components/Header.vue @@ -0,0 +1,12 @@ + diff --git a/src/plugins/vuetify.js b/src/plugins/vuetify.js index 1bbe20f..263a57f 100644 --- a/src/plugins/vuetify.js +++ b/src/plugins/vuetify.js @@ -1,6 +1,11 @@ +import '@fortawesome/fontawesome-free/css/all.css' import Vue from 'vue' import Vuetify from 'vuetify/lib' Vue.use(Vuetify) -export default new Vuetify({}) +export default new Vuetify({ + icons: { + iconfont: 'fa' + } +}) diff --git a/src/store/index.js b/src/store/index.js index 6dff675..dbee5f6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,37 +1,13 @@ import Vue from 'vue' import Vuex from 'vuex' -import CovidService from '@/services/covid.services' +import * as countries from './modules/countries' +import * as stats from './modules/stats' Vue.use(Vuex) export default new Vuex.Store({ - state: { - countries: [], - overviewStats: {} - }, - mutations: { - SET_COUNTRIES(state, data) { - state.countries = data - }, - SET_OVERVIEW_STATS(state, data) { - state.overviewStats = data - } - }, - actions: { - async fetchCountries({ commit }, filter) { - const { data } = await CovidService.fetchCountries(filter) - - if (data != null) { - commit('SET_COUNTRIES', data) - } - }, - async fetchOverviewStats({ commit }) { - const { data } = await CovidService.fetchWorldWide() - - if (data != null) { - commit('SET_OVERVIEW_STATS', data) - } - } - }, - modules: {} + modules: { + countries, + stats + } }) diff --git a/src/store/modules/countries.js b/src/store/modules/countries.js new file mode 100644 index 0000000..a443e78 --- /dev/null +++ b/src/store/modules/countries.js @@ -0,0 +1,37 @@ +import CovidService from '@/services/covid.services' + +export const namespaced = true + +export const state = { + countries: [], + selected: null +} + +export const mutations = { + SET_COUNTRIES(state, data) { + state.countries = data + }, + SET_SELECTED_COUNTRY(state, data) { + state.selected = data + } +} + +export const actions = { + async fetchCountries({ commit }, filter) { + const { data } = await CovidService.fetchCountries(filter) + + if (data != null) { + commit('SET_COUNTRIES', data) + } + }, + async fetchByCountry({ commit }, code) { + const { data } = await CovidService.fetchByCountry(code) + + if (data != null) { + commit('SET_SELECTED_COUNTRY', data) + } + }, + setSelectedCountry({ commit }, country) { + commit('SET_SELECTED_COUNTRY', country) + } +} diff --git a/src/store/modules/stats.js b/src/store/modules/stats.js new file mode 100644 index 0000000..0bddbd2 --- /dev/null +++ b/src/store/modules/stats.js @@ -0,0 +1,23 @@ +import CovidService from '@/services/covid.services' + +export const namespaced = true + +export const state = { + overview: {} +} + +export const mutations = { + SET_OVERVIEW_STATS(state, data) { + state.overview = data + } +} + +export const actions = { + async fetchOverviewStats({ commit }) { + const { data } = await CovidService.fetchWorldWide() + + if (data != null) { + commit('SET_OVERVIEW_STATS', data) + } + } +} diff --git a/src/views/Countries.vue b/src/views/Countries.vue index 6541515..268e4af 100644 --- a/src/views/Countries.vue +++ b/src/views/Countries.vue @@ -1,21 +1,50 @@ diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index c64ff44..63f178b 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -1,5 +1,5 @@ diff --git a/yarn.lock b/yarn.lock index 2e06d3b..016568c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -804,6 +804,11 @@ exec-sh "^0.3.2" minimist "^1.2.0" +"@fortawesome/fontawesome-free@^5.13.0": + version "5.13.0" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.13.0.tgz#fcb113d1aca4b471b709e8c9c168674fbd6e06d9" + integrity sha512-xKOeQEl5O47GPZYIMToj6uuA2syyFlq9EMSl2ui0uytjY9xbe8XS0pexNWmxrdcCyNGyDmLyYw5FtKsalBUeOg== + "@hapi/address@2.x.x": version "2.1.4" resolved "https://registry.npm.taobao.org/@hapi/address/download/@hapi/address-2.1.4.tgz?cache=0&sync_timestamp=1584144369412&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40hapi%2Faddress%2Fdownload%2F%40hapi%2Faddress-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5"