diff --git a/src/prog/dashboard2/icons/alarm.svg b/src/prog/dashboard2/icons/alarm.svg new file mode 100644 index 00000000..b9eb2e27 --- /dev/null +++ b/src/prog/dashboard2/icons/alarm.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/prog/dashboard2/icons/home.svg b/src/prog/dashboard2/icons/home.svg new file mode 100644 index 00000000..132e4268 --- /dev/null +++ b/src/prog/dashboard2/icons/home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/prog/dashboard2/icons/lightbulb-on-outline.svg b/src/prog/dashboard2/icons/lightbulb-on-outline.svg new file mode 100644 index 00000000..cc8b9f78 --- /dev/null +++ b/src/prog/dashboard2/icons/lightbulb-on-outline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/prog/dashboard2/icons/settings.svg b/src/prog/dashboard2/icons/settings.svg new file mode 100644 index 00000000..731a5a76 --- /dev/null +++ b/src/prog/dashboard2/icons/settings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/prog/dashboard2/icons/shutters.svg b/src/prog/dashboard2/icons/shutters.svg new file mode 100644 index 00000000..15a6cfa6 --- /dev/null +++ b/src/prog/dashboard2/icons/shutters.svg @@ -0,0 +1,45 @@ + + + + +Created by potrace 1.11, written by Peter Selinger 2001-2013 + + + + + + + + + + + + + + + diff --git a/src/prog/dashboard2/icons/sprinklers.svg b/src/prog/dashboard2/icons/sprinklers.svg new file mode 100644 index 00000000..d152a485 --- /dev/null +++ b/src/prog/dashboard2/icons/sprinklers.svg @@ -0,0 +1,73 @@ + + + + +Created by potrace 1.11, written by Peter Selinger 2001-2013 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/prog/dashboard2/src/App.vue b/src/prog/dashboard2/src/App.vue index 623622e8..a6559b29 100644 --- a/src/prog/dashboard2/src/App.vue +++ b/src/prog/dashboard2/src/App.vue @@ -1,19 +1,160 @@ + +.icon-alarm:before { content: '\e800'; } /* '' */ +.icon-home:before { content: '\e801'; } /* '' */ +.icon-lightbulb-on-outline:before { content: '\e802'; } /* '' */ +.icon-settings:before { content: '\e803'; } /* '' */ +.icon-shutters:before { content: '\e804'; } /* '' */ +.icon-sprinklers:before { content: '\e805'; } /* '' */ +.icon-lightbulb:before { content: '\f0eb'; } /* '' */ + + diff --git a/src/prog/dashboard2/src/assets/css/domo.css b/src/prog/dashboard2/src/assets/css/domo.css new file mode 100644 index 00000000..75b81ae8 --- /dev/null +++ b/src/prog/dashboard2/src/assets/css/domo.css @@ -0,0 +1,62 @@ +@font-face { + font-family: 'domo'; + src: url('../font/domo.woff2') format('woff2'), + url('../font/domo.woff') format('woff'), + url('../font/domo.ttf') format('truetype'); + + font-weight: normal; + font-style: normal; +} +/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */ +/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */ +/* +@media screen and (-webkit-min-device-pixel-ratio:0) { + @font-face { + font-family: 'domo'; + src: url('../font/domo.svg?150644#domo') format('svg'); + } +} +*/ + + [class^="icon-"]:before, [class*=" icon-"]:before { + font-family: "domo"; + font-style: normal; + font-weight: normal; + speak: none; + + display: inline-block; + text-decoration: inherit; + width: 1em; + margin-right: .2em; + text-align: center; + /* opacity: .8; */ + + /* For safety - reset parent styles, that can break glyph codes*/ + font-variant: normal; + text-transform: none; + + /* fix buttons height, for twitter bootstrap */ + line-height: 1em; + + /* Animation center compensation - margins should be symmetric */ + /* remove if not needed */ + margin-left: .2em; + + /* you can be more comfortable with increased icons size */ + /* font-size: 120%; */ + + /* Font smoothing. That was taken from TWBS */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + /* Uncomment for 3D effect */ + /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ +} + +.icon-alarm:before { content: '\e800'; } /* '' */ +.icon-home:before { content: '\e801'; } /* '' */ +.icon-lightbulb-on-outline:before { content: '\e802'; } /* '' */ +.icon-settings:before { content: '\e803'; } /* '' */ +.icon-shutters:before { content: '\e804'; } /* '' */ +.icon-sprinklers:before { content: '\e805'; } /* '' */ +.icon-lightbulb:before { content: '\f0eb'; } /* '' */ diff --git a/src/prog/dashboard2/src/assets/fonts/domo.ttf b/src/prog/dashboard2/src/assets/font/domo.ttf similarity index 66% rename from src/prog/dashboard2/src/assets/fonts/domo.ttf rename to src/prog/dashboard2/src/assets/font/domo.ttf index 8c52f30d..88cfaaa0 100644 Binary files a/src/prog/dashboard2/src/assets/fonts/domo.ttf and b/src/prog/dashboard2/src/assets/font/domo.ttf differ diff --git a/src/prog/dashboard2/src/assets/font/domo.woff b/src/prog/dashboard2/src/assets/font/domo.woff new file mode 100644 index 00000000..21828ace Binary files /dev/null and b/src/prog/dashboard2/src/assets/font/domo.woff differ diff --git a/src/prog/dashboard2/src/assets/font/domo.woff2 b/src/prog/dashboard2/src/assets/font/domo.woff2 new file mode 100644 index 00000000..1942ec51 Binary files /dev/null and b/src/prog/dashboard2/src/assets/font/domo.woff2 differ diff --git a/src/prog/dashboard2/src/assets/fonts/domo.woff b/src/prog/dashboard2/src/assets/fonts/domo.woff deleted file mode 100644 index 50fe49e5..00000000 Binary files a/src/prog/dashboard2/src/assets/fonts/domo.woff and /dev/null differ diff --git a/src/prog/dashboard2/src/assets/fonts/domo.woff2 b/src/prog/dashboard2/src/assets/fonts/domo.woff2 deleted file mode 100644 index 573d6993..00000000 Binary files a/src/prog/dashboard2/src/assets/fonts/domo.woff2 and /dev/null differ diff --git a/src/prog/dashboard2/src/assets/logo.png b/src/prog/dashboard2/src/assets/logo.png deleted file mode 100644 index f3d2503f..00000000 Binary files a/src/prog/dashboard2/src/assets/logo.png and /dev/null differ diff --git a/src/prog/dashboard2/src/assets/vux_logo.png b/src/prog/dashboard2/src/assets/vux_logo.png deleted file mode 100644 index fab54655..00000000 Binary files a/src/prog/dashboard2/src/assets/vux_logo.png and /dev/null differ diff --git a/src/prog/dashboard2/src/components/Hello.vue b/src/prog/dashboard2/src/components/Hello.vue deleted file mode 100644 index 2d805395..00000000 --- a/src/prog/dashboard2/src/components/Hello.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - diff --git a/src/prog/dashboard2/src/components/HelloFromVux.vue b/src/prog/dashboard2/src/components/HelloFromVux.vue deleted file mode 100644 index 96f58ca6..00000000 --- a/src/prog/dashboard2/src/components/HelloFromVux.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/src/prog/dashboard2/src/components/Home.vue b/src/prog/dashboard2/src/components/Home.vue new file mode 100644 index 00000000..78c97a61 --- /dev/null +++ b/src/prog/dashboard2/src/components/Home.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/prog/dashboard2/src/components/Lights.vue b/src/prog/dashboard2/src/components/Lights.vue new file mode 100644 index 00000000..af97a13c --- /dev/null +++ b/src/prog/dashboard2/src/components/Lights.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/prog/dashboard2/src/components/Settings.vue b/src/prog/dashboard2/src/components/Settings.vue new file mode 100644 index 00000000..7c0d15cc --- /dev/null +++ b/src/prog/dashboard2/src/components/Settings.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/prog/dashboard2/src/components/Shutters.vue b/src/prog/dashboard2/src/components/Shutters.vue new file mode 100644 index 00000000..8df36e4f --- /dev/null +++ b/src/prog/dashboard2/src/components/Shutters.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/prog/dashboard2/src/components/Sprinklers.vue b/src/prog/dashboard2/src/components/Sprinklers.vue new file mode 100644 index 00000000..07df3d3e --- /dev/null +++ b/src/prog/dashboard2/src/components/Sprinklers.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/prog/dashboard2/src/components/Timers.vue b/src/prog/dashboard2/src/components/Timers.vue new file mode 100644 index 00000000..93232ab7 --- /dev/null +++ b/src/prog/dashboard2/src/components/Timers.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/prog/dashboard2/src/main.js b/src/prog/dashboard2/src/main.js index f5fc96de..e6c43c65 100644 --- a/src/prog/dashboard2/src/main.js +++ b/src/prog/dashboard2/src/main.js @@ -1,17 +1,78 @@ // The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from 'vue' -import FastClick from 'fastclick' +import Vuex from 'vuex' import VueRouter from 'vue-router' +import FastClick from 'fastclick' import App from './App' -import Home from './components/HelloFromVux' + +import { sync } from 'vuex-router-sync' Vue.use(VueRouter) +Vue.use(Vuex) -const routes = [{ - path: '/', - component: Home -}] +import vuexI18n from 'vuex-i18n' + +const Home = () => import('./components/Home.vue') +const Lights = () => import('./components/Lights.vue') +const Sprinklers = () => import('./components/Sprinklers.vue') +const Shutters = () => import('./components/Shutters.vue') +const Timers = () => import('./components/Timers.vue') + +const Settings = () => import('./components/Settings.vue') + +const routes = [ + // Root Level - Home Tab + { path: '/', component: Home }, + // Root Level - Lights Tab + { path: '/lights', component: Lights }, + // Root Level - Sprinkler Tab + { path: '/sprinklers', component: Sprinklers }, + // Root Level - Shutter Tab + { path: '/shutters', component: Shutters }, + // Root Level - Timers Tab + { path: '/timers', component: Timers }, + // Root Level - Settings Tab + { path: '/settings/', component: Settings } +] + +let store = new Vuex.Store({ + modules: { + i18n: vuexI18n.store + } +}) + +store.registerModule('vux', { + state: { + demoScrollTop: 0, + isLoading: false, + direction: 'forward' + }, + mutations: { + updateDemoPosition (state, payload) { + state.demoScrollTop = payload.top + }, + updateLoadingStatus (state, payload) { + state.isLoading = payload.isLoading + }, + updateDirection (state, payload) { + state.direction = payload.direction + } + }, + actions: { + updateDemoPosition ({commit}, top) { + commit({type: 'updateDemoPosition', top: top}) + } + } +}) + +Vue.use(vuexI18n.plugin, store) + +// plugins +import { LocalePlugin, LoadingPlugin } from 'vux' + +Vue.use(LocalePlugin) +Vue.use(LoadingPlugin) const router = new VueRouter({ routes @@ -19,10 +80,56 @@ const router = new VueRouter({ FastClick.attach(document.body) +// enable the vue devtools +Vue.config.devtools = true + Vue.config.productionTip = false +Vue.i18n.set('en') +Vue.i18n.fallback('en') +sync(store, router) + +// simple history management +const history = window.sessionStorage +history.clear() +let historyCount = history.getItem('count') * 1 || 0 +history.setItem('/', 0) + +router.beforeEach(function (to, from, next) { + store.commit('updateLoadingStatus', {isLoading: true}) + // console.log(to) + // console.log(from) + const toIndex = history.getItem(to.path) + const fromIndex = history.getItem(from.path) + + if (toIndex) { + if (!fromIndex || parseInt(toIndex, 10) > parseInt(fromIndex, 10) || (toIndex === '0' && fromIndex === '0')) { + store.commit('updateDirection', {direction: 'forward'}) + } else { + store.commit('updateDirection', {direction: 'reverse'}) + } + } else { + ++historyCount + history.setItem('count', historyCount) + to.path !== '/' && history.setItem(to.path, historyCount) + store.commit('updateDirection', {direction: 'forward'}) + } + + if (/\/http/.test(to.path)) { + let url = to.path.split('http')[1] + window.location.href = `http${url}` + } else { + next() + } +}) + +router.afterEach(function (to) { + store.commit('updateLoadingStatus', {isLoading: false}) +}) + /* eslint-disable no-new */ new Vue({ + store, router, render: h => h(App) }).$mount('#app-box') diff --git a/src/prog/dashboard2/src/router/index.js b/src/prog/dashboard2/src/router/index.js deleted file mode 100644 index 5bf9ea6d..00000000 --- a/src/prog/dashboard2/src/router/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import Vue from 'vue' -import Router from 'vue-router' -import Hello from '@/components/Hello' - -Vue.use(Router) - -export default new Router({ - routes: [ - { - path: '/', - name: 'Hello', - component: Hello - } - ] -}) diff --git a/src/prog/dashboard2/static/android-desktop.png b/src/prog/dashboard2/static/android-desktop.png new file mode 100644 index 00000000..2bfe5aa4 Binary files /dev/null and b/src/prog/dashboard2/static/android-desktop.png differ diff --git a/src/prog/dashboard2/static/favicon.png b/src/prog/dashboard2/static/favicon.png new file mode 100644 index 00000000..553a4622 Binary files /dev/null and b/src/prog/dashboard2/static/favicon.png differ diff --git a/src/prog/dashboard2/static/ios-desktop.png b/src/prog/dashboard2/static/ios-desktop.png new file mode 100644 index 00000000..57c47d18 Binary files /dev/null and b/src/prog/dashboard2/static/ios-desktop.png differ