Skip to content

Commit c17d7ea

Browse files
committed
Port to nuxtjs
1 parent 521593d commit c17d7ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+10513
-5065
lines changed

.env.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
GTM_ID=UA-156992619-1
2-
VUE_APP_API_URL=http://api.coronatracker.com
2+
API_BASE_URL=http://api.coronatracker.com
3+
API_PATH=/v1

.gitignore

+91-9
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,106 @@
1-
.DS_Store
21
node_modules
32
/dist
43

54
# local env files
65
.env.local
76
.env.*.local
87

9-
# Log files
10-
npm-debug.log*
11-
yarn-debug.log*
12-
yarn-error.log*
13-
148
# Editor directories and files
15-
.idea
169
.vscode
1710
*.suo
1811
*.ntvs*
1912
*.njsproj
2013
*.sln
2114
*.sw?
15+
*.lock
16+
17+
# Created by .ignore support plugin (hsz.mobi)
18+
### Node template
19+
# Logs
20+
/logs
21+
*.log
22+
npm-debug.log*
23+
yarn-debug.log*
24+
yarn-error.log*
25+
26+
# Runtime data
27+
pids
28+
*.pid
29+
*.seed
30+
*.pid.lock
31+
32+
# Directory for instrumented libs generated by jscoverage/JSCover
33+
lib-cov
34+
35+
# Coverage directory used by tools like istanbul
36+
coverage
37+
38+
# nyc test coverage
39+
.nyc_output
40+
41+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
42+
.grunt
43+
44+
# Bower dependency directory (https://bower.io/)
45+
bower_components
46+
47+
# node-waf configuration
48+
.lock-wscript
49+
50+
# Compiled binary addons (https://nodejs.org/api/addons.html)
51+
build/Release
52+
53+
# Dependency directories
54+
node_modules/
55+
jspm_packages/
56+
57+
# TypeScript v1 declaration files
58+
typings/
59+
60+
# Optional npm cache directory
61+
.npm
62+
63+
# Optional eslint cache
64+
.eslintcache
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variables file
2276
.env
23-
.env.example
24-
*.lock
77+
78+
# parcel-bundler cache (https://parceljs.org/)
79+
.cache
80+
81+
# next.js build output
82+
.next
83+
84+
# nuxt.js build output
85+
.nuxt
86+
87+
# Nuxt generate
88+
dist
89+
90+
# vuepress build output
91+
.vuepress/dist
92+
93+
# Serverless directories
94+
.serverless
95+
96+
# IDE / Editor
97+
.idea
98+
99+
# Service worker
100+
sw.*
101+
102+
# Mac OSX
103+
.DS_Store
104+
105+
# Vim swap files
106+
*.swp

README.md

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
# corona-tracker
22

3-
## Project setup
4-
```
5-
npm install
6-
```
3+
> Corona tracker
74
8-
### Compiles and hot-reloads for development
9-
```
10-
npm run serve
11-
```
5+
## Build Setup
126

13-
### Compiles and minifies for production
14-
```
15-
npm run build
16-
```
7+
``` bash
8+
# install dependencies
9+
$ npm run install
1710

18-
### Lints and fixes files
19-
```
20-
npm run lint
11+
# serve with hot reload at localhost:3000
12+
$ npm run dev
13+
14+
# build for production and launch server
15+
$ npm run build
16+
$ npm run start
17+
18+
# generate static project
19+
$ npm run generate
2120
```
2221

23-
### Customize configuration
24-
See [Configuration Reference](https://cli.vuejs.org/config/).
22+
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).

api/analytics.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default axios => ({
2+
fetchTrendByDate: (start_date, end_date) => {
3+
return axios.get(`/analytics/trend?start_date=${start_date}&end_date=${end_date}`)
4+
.then(res => res.data)
5+
},
6+
});

api/healthcareinstitutions.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default axios => ({
2+
getHealthcareInstitutions: () => {
3+
return axios.get(`https://v2-api.sheety.co/3d29e508008ed3f47cc52f6aaf321f51/coronaInfo/hospitalsAndHealthcareProviders`)
4+
.then(res => res.data);
5+
},
6+
});

api/index.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import analyticsApiFactory from './analytics';
2+
import healthCareInstitutionsApiFactory from './healthcareinstitutions'
3+
import newsApiFactory from './news';
4+
import statsApiFactory from './stats';
5+
6+
const apiFactory = axios => ({
7+
analytics: analyticsApiFactory(axios),
8+
healthcareinstitutions: healthCareInstitutionsApiFactory(axios),
9+
news: newsApiFactory(axios),
10+
stats: statsApiFactory(axios),
11+
});
12+
13+
export default apiFactory;

api/news.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export default axios => ({
2+
getRecentNews: ({ limit = 4, sort = '-publishedAt', country = '' } = {}) => {
3+
return axios.get(`/news?sort=${sort}&limit=${limit}&country=${country}`)
4+
.then(res => res.data);
5+
},
6+
7+
getTrendingNews: ({ limit, offset, country = '', language = 'en' }) => {
8+
return axios.get(`/news/trending?offset=${offset}&limit=${limit}&country=${country}&language=${language}`)
9+
.then(res => res.data);
10+
},
11+
12+
searchNews: (q) => {
13+
return axios.get(`/news`, {
14+
params: { q },
15+
})
16+
.then(res => res.data);
17+
},
18+
});

api/stats.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default axios => ({
2+
getStats: (country) => {
3+
return axios.get(`/stats?country=${country}`)
4+
.then(res => res.data);
5+
},
6+
});

assets/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ASSETS
2+
3+
**This directory is not required, you can delete it if you don't want to use it.**
4+
5+
This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.
6+
7+
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).

assets/css/tailwind.css

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@import 'tailwindcss/base';
2+
@import 'tailwindcss/components';
3+
@import 'tailwindcss/utilities';
4+
5+
.container {
6+
@apply max-w-5xl !important;
7+
@apply mx-auto py-2 px-2;
8+
}

assets/image/hafeez_nazri.jpg

139 KB
Loading

assets/image/lau_cher_han.jpg

9.77 MB
Loading

assets/image/lazy-load-spinner.gif

30 KB
Loading

assets/image/logo.png

23.6 KB
Loading

assets/image/shian.jpg

124 KB
Loading

assets/image/smartphone.png

840 Bytes
Loading

assets/image/tan_wei_seng.png

56.3 KB
Loading
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<template>
2+
<div>
3+
<p class="2xl font-bold">Affected countries map chart here</p>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
props: {
10+
data: {
11+
type: Array,
12+
default: null,
13+
}
14+
},
15+
16+
data () {
17+
return {
18+
chart: null,
19+
}
20+
},
21+
22+
methods: {
23+
renderChart () {
24+
//
25+
}
26+
}
27+
}
28+
</script>
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<template>
2+
<div>
3+
<p class="2xl font-bold">Affected region horizontal-stacked bar chart here</p>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
props: {
10+
data: {
11+
type: Array,
12+
default: null,
13+
}
14+
},
15+
16+
data () {
17+
return {
18+
chart: null,
19+
}
20+
},
21+
22+
methods: {
23+
renderChart () {
24+
//
25+
}
26+
}
27+
}
28+
</script>
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<template>
2+
<div>
3+
<p class="2xl font-bold">Outbreak trend multi-line chart here</p>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
props: {
10+
data: {
11+
type: Array,
12+
default: null,
13+
}
14+
},
15+
16+
data () {
17+
return {
18+
chart: null,
19+
}
20+
},
21+
22+
methods: {
23+
renderChart () {
24+
//
25+
}
26+
}
27+
}
28+
</script>

components/Analytics/SidebarNav.vue

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<div class="w-full h-56 lg:h-full lg:w-1/5 bg-white shadow-md">
3+
<div class="relative h-full min-h-screen pl-6">
4+
<div class="xl:py-2">
5+
<p class="text-2xl font-bold">2019-nCoV Reports</p>
6+
7+
<div v-for="link in links" :key="link.name" class="hidden lg:block pt-3">
8+
<nuxt-link :to="{ name: link.name }">
9+
<i :class="'fa fa-' + link.icon" class="mr-2"></i>
10+
{{ link.display }}
11+
</nuxt-link>
12+
</div>
13+
14+
<div v-for="link in links" :key="'mob-'+link.name" class="lg:hidden pt-3">
15+
<nuxt-link :to="{ name: link.name }">
16+
<i :class="'fa fa-' + link.icon" class="mr-2"></i>
17+
{{ link.display }}
18+
</nuxt-link>
19+
</div>
20+
</div>
21+
</div>
22+
</div>
23+
</template>
24+
25+
<script>
26+
export default {
27+
computed: {
28+
currentPage: function () {
29+
return this.$route.name.replace('page.', '')
30+
}
31+
},
32+
33+
data () {
34+
return {
35+
links: [
36+
{ name: 'analytics2', display: 'Overview', icon: 'columns' },
37+
{ name: 'analytics2-virus-comparison', display: 'Virus Comparison', icon: 'search' },
38+
{ name: 'analytics2-advanced-analysis', display: 'Advanced Analysis', icon: 'chart-line' },
39+
{ name: 'analytics2-predictive-analysis', display: 'Predictive', icon: 'expand-alt' },
40+
{ name: 'analytics2-travel-path', display: 'Travel Path', icon: 'route' },
41+
],
42+
43+
showLinksMobile: false,
44+
}
45+
}
46+
}
47+
</script>

components/Card.vue

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<div>
3+
<div class="bg-primary text-white font-bold p-2">{{ title }}</div>
4+
<div class="bg-gray-100">
5+
<slot></slot>
6+
</div>
7+
</div>
8+
</template>
9+
10+
<script>
11+
export default {
12+
name: "Card",
13+
props: {
14+
title: {
15+
type: String,
16+
required: true
17+
}
18+
}
19+
}
20+
</script>
21+
22+
<style scoped>
23+
24+
</style>

0 commit comments

Comments
 (0)