import '../styles';

import Vue from 'vue'
import { sync } from 'vuex-router-sync';
import { swInit } from "../lib/ServiceWorker";
import VueProgressBar from "vue-progressbar";
import config from '../config';
import store from '../store';
import router from '../router';
import '../lib/GlobalMixins';
import App from '../components/App';

import AppAutocomplete from "../components/AppAutocomplete";
import AppDateTime from "../components/AppDateTime";
import AppDatePicker from "../components/AppDatePicker";
import AppIcon from "../components/AppIcon";
import AppModal from "../components/AppModal";
import AppNavbar from "../components/AppNavbar";
import AppPager from "../components/AppPager";
import AppRating from "../components/AppRating";
import AppTagEditor from "../components/AppTagEditor";
import AppTextField from "../components/AppTextField";

Vue.component("AppAutocomplete", AppAutocomplete);
Vue.component("AppDateTime", AppDateTime);
Vue.component("AppDatePicker", AppDatePicker);
Vue.component("AppIcon", AppIcon);
Vue.component("AppModal", AppModal);
Vue.component("AppNavbar", AppNavbar);
Vue.component("AppPager", AppPager);
Vue.component("AppRating", AppRating);
Vue.component("AppTagEditor", AppTagEditor);
Vue.component("AppTextField", AppTextField);


Vue.use(VueProgressBar, {
//  color: '#bffaf3',
//  failedColor: '#874b4b',
//   thickness: '5px',
//   transition: {
//     speed: '0.2s',
//     opacity: '0.6s',
//     termination: 300
//   },
//   autoRevert: true,
//   location: 'left',
//   inverse: false
});

sync(store, router);
swInit(store);

document.addEventListener('DOMContentLoaded', () => {

  const app = document.getElementById('app');
  config.baseApiUrl = app.dataset.url;

  window.$vm = new Vue({
    el: '#app',
    store,
    router,
    render: createElement => createElement('App'),
    components: { App }
  });
});
