diff --git a/.editorconfig b/.editorconfig index 499b0f7..e78a844 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,6 @@ root = true -[*.cr] +[*.{cr,vue,js}] charset = utf-8 end_of_line = lf insert_final_newline = true diff --git a/assets/App.vue b/assets/App.vue index a3d6cce..30c4259 100644 --- a/assets/App.vue +++ b/assets/App.vue @@ -1,110 +1,37 @@ - + diff --git a/assets/StatisticsPage.vue b/assets/StatisticsPage.vue new file mode 100644 index 0000000..828498d --- /dev/null +++ b/assets/StatisticsPage.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/assets/TimerPage.vue b/assets/TimerPage.vue new file mode 100644 index 0000000..23eb844 --- /dev/null +++ b/assets/TimerPage.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/assets/main.js b/assets/main.js index c3f9ce3..9d5cf6e 100644 --- a/assets/main.js +++ b/assets/main.js @@ -1,10 +1,24 @@ import Vue from 'vue'; +import VueRouter from 'vue-router'; import App from './App.vue'; -Vue.config.productionTip = false; +import TimerPage from './TimerPage.vue'; +import StatisticsPage from './StatisticsPage.vue'; + +Vue.use(VueRouter); + +const routes = [ + { path: '/', name: 'timer', component: TimerPage }, + { path: '/statistics', name: 'statistics', component: StatisticsPage }, +]; + +const router = new VueRouter({ + routes, +}); new Vue({ - // router, + el: '#app', + router, // store, render: h => h(App), -}).$mount('#app'); +}); diff --git a/package-lock.json b/package-lock.json index 5c87efe..ac128b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "homepage", + "name": "dayoff", "version": "1.0.0", "lockfileVersion": 1, "requires": true, @@ -6783,6 +6783,12 @@ "vue-style-loader": "^4.1.0" } }, + "vue-router": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.6.tgz", + "integrity": "sha512-GYhn2ynaZlysZMkFE5oCHRUTqE8BWs/a9YbKpNLi0i7xD6KG1EzDqpHQmv1F5gXjr8kL5iIVS8EOtRaVUEXTqA==", + "dev": true + }, "vue-style-loader": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz", diff --git a/package.json b/package.json index 92bd3a6..773e64f 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "underscore": "^1.9.2", "vue": "^2.6.11", "vue-loader": "^15.9.0", + "vue-router": "^3.1.6", "vue-style-loader": "^4.1.2", "vue-template-compiler": "^2.6.11", "webpack": "^4.41.6", diff --git a/src/dayoff.cr b/src/dayoff.cr index 7444988..6a12712 100644 --- a/src/dayoff.cr +++ b/src/dayoff.cr @@ -40,7 +40,7 @@ end get "/api/status" do |env| profile = app.profile Dayoff::ProfileId.new(env.get("profile_id").to_s) - total_span = profile.total_status now + total_span = profile.total_status now.at_beginning_of_day today_span = profile.date_status now data = { started: profile.started?,