2018-08-28 22:50:22 +02:00
|
|
|
import Vue from 'vue'
|
|
|
|
import App from './App.vue'
|
2018-09-06 19:46:09 +02:00
|
|
|
import router from './router'
|
2018-08-28 22:50:22 +02:00
|
|
|
|
2020-05-09 21:39:46 +02:00
|
|
|
import {VERSION} from './version.json'
|
|
|
|
console.info(`Vikunja frontend version ${VERSION}`)
|
|
|
|
|
2020-05-10 18:26:33 +02:00
|
|
|
// Make sure the api url does not contain a / at the end
|
|
|
|
if(window.API_URL.substr(window.API_URL.length - 1, window.API_URL.length) === '/') {
|
|
|
|
window.API_URL = window.API_URL.substr(0, window.API_URL.length - 1)
|
|
|
|
}
|
|
|
|
|
2018-09-12 08:22:17 +02:00
|
|
|
// Register the modal
|
2020-06-17 22:15:59 +02:00
|
|
|
import Modal from './components/modal/modal'
|
2018-09-12 08:22:17 +02:00
|
|
|
Vue.component('modal', Modal)
|
|
|
|
|
2018-12-25 23:41:55 +01:00
|
|
|
// Add CSS
|
2019-12-19 23:09:23 +01:00
|
|
|
import './styles/vikunja.scss'
|
2018-09-06 19:56:44 +02:00
|
|
|
|
2018-08-28 22:50:22 +02:00
|
|
|
Vue.config.productionTip = false
|
|
|
|
|
2018-09-08 21:43:16 +02:00
|
|
|
// Notifications
|
|
|
|
import Notifications from 'vue-notification'
|
|
|
|
Vue.use(Notifications)
|
|
|
|
|
2018-09-09 17:23:06 +02:00
|
|
|
// Icons
|
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
import { faSignOutAlt } from '@fortawesome/free-solid-svg-icons'
|
2018-09-09 19:09:46 +02:00
|
|
|
import { faPlus } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faListOl } from '@fortawesome/free-solid-svg-icons'
|
2018-09-09 22:09:20 +02:00
|
|
|
import { faTasks } from '@fortawesome/free-solid-svg-icons'
|
2018-09-10 21:06:39 +02:00
|
|
|
import { faCog } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faAngleRight } from '@fortawesome/free-solid-svg-icons'
|
2018-09-11 19:20:07 +02:00
|
|
|
import { faLayerGroup } from '@fortawesome/free-solid-svg-icons'
|
2018-09-11 20:16:08 +02:00
|
|
|
import { faTrashAlt } from '@fortawesome/free-solid-svg-icons'
|
2018-09-14 07:23:25 +02:00
|
|
|
import { faUsers } from '@fortawesome/free-solid-svg-icons'
|
2018-09-14 08:29:09 +02:00
|
|
|
import { faUser } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faLock } from '@fortawesome/free-solid-svg-icons'
|
2018-09-18 07:38:26 +02:00
|
|
|
import { faPen } from '@fortawesome/free-solid-svg-icons'
|
2018-11-25 22:02:22 +01:00
|
|
|
import { faTimes } from '@fortawesome/free-solid-svg-icons'
|
2018-12-25 16:03:51 +01:00
|
|
|
import { faTachometerAlt } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faCalendar } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faBars } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faPowerOff } from '@fortawesome/free-solid-svg-icons'
|
2018-12-25 23:41:55 +01:00
|
|
|
import { faCalendarWeek } from '@fortawesome/free-solid-svg-icons'
|
2019-03-03 16:03:08 +01:00
|
|
|
import { faExclamation } from '@fortawesome/free-solid-svg-icons'
|
2019-03-07 20:48:40 +01:00
|
|
|
import { faTags } from '@fortawesome/free-solid-svg-icons'
|
2019-04-23 21:50:37 +02:00
|
|
|
import { faChevronDown } from '@fortawesome/free-solid-svg-icons'
|
2019-04-29 23:41:39 +02:00
|
|
|
import { faCheck } from '@fortawesome/free-solid-svg-icons'
|
2019-09-09 19:55:43 +02:00
|
|
|
import { faPaste } from '@fortawesome/free-solid-svg-icons'
|
2019-10-19 21:41:23 +02:00
|
|
|
import { faPencilAlt } from '@fortawesome/free-solid-svg-icons'
|
2018-12-25 16:03:51 +01:00
|
|
|
import { faTimesCircle } from '@fortawesome/free-regular-svg-icons'
|
2018-12-25 23:41:55 +01:00
|
|
|
import { faCalendarAlt } from '@fortawesome/free-regular-svg-icons'
|
2019-11-24 14:16:24 +01:00
|
|
|
import { faCloudDownloadAlt } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faPercent } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faStar } from '@fortawesome/free-regular-svg-icons'
|
|
|
|
import { faAlignLeft } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faPaperclip } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faClock } from '@fortawesome/free-regular-svg-icons'
|
|
|
|
import { faHistory } from '@fortawesome/free-solid-svg-icons'
|
2020-01-31 11:05:53 +01:00
|
|
|
import { faSearch } from '@fortawesome/free-solid-svg-icons'
|
2020-02-09 14:46:01 +01:00
|
|
|
import { faCheckDouble } from '@fortawesome/free-solid-svg-icons'
|
2020-04-01 22:13:57 +02:00
|
|
|
import { faTh } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faSort } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faSortUp } from '@fortawesome/free-solid-svg-icons'
|
2020-04-18 14:39:56 +02:00
|
|
|
import { faList } from '@fortawesome/free-solid-svg-icons'
|
2020-04-26 01:11:34 +02:00
|
|
|
import { faEllipsisV } from '@fortawesome/free-solid-svg-icons'
|
2020-06-11 17:34:13 +02:00
|
|
|
import { faFilter } from '@fortawesome/free-solid-svg-icons'
|
2020-06-21 20:27:39 +02:00
|
|
|
import { faFillDrip } from '@fortawesome/free-solid-svg-icons'
|
2020-02-25 21:11:36 +01:00
|
|
|
import { faComments } from '@fortawesome/free-regular-svg-icons'
|
2018-09-09 17:23:06 +02:00
|
|
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
|
|
|
|
|
|
|
library.add(faSignOutAlt)
|
2018-09-09 19:09:46 +02:00
|
|
|
library.add(faPlus)
|
|
|
|
library.add(faListOl)
|
2018-09-09 22:09:20 +02:00
|
|
|
library.add(faTasks)
|
2018-09-10 21:06:39 +02:00
|
|
|
library.add(faCog)
|
|
|
|
library.add(faAngleRight)
|
2018-09-11 19:20:07 +02:00
|
|
|
library.add(faLayerGroup)
|
2018-09-11 20:16:08 +02:00
|
|
|
library.add(faTrashAlt)
|
2018-09-14 07:23:25 +02:00
|
|
|
library.add(faUsers)
|
2018-09-14 08:29:09 +02:00
|
|
|
library.add(faUser)
|
|
|
|
library.add(faLock)
|
2018-09-18 07:38:26 +02:00
|
|
|
library.add(faPen)
|
2018-11-25 22:02:22 +01:00
|
|
|
library.add(faTimes)
|
2018-12-25 16:03:51 +01:00
|
|
|
library.add(faTachometerAlt)
|
|
|
|
library.add(faCalendar)
|
|
|
|
library.add(faTimesCircle)
|
|
|
|
library.add(faBars)
|
|
|
|
library.add(faPowerOff)
|
2018-12-25 23:41:55 +01:00
|
|
|
library.add(faCalendarWeek)
|
|
|
|
library.add(faCalendarAlt)
|
2019-03-03 16:03:08 +01:00
|
|
|
library.add(faExclamation)
|
2019-03-07 20:48:40 +01:00
|
|
|
library.add(faTags)
|
2019-04-23 21:50:37 +02:00
|
|
|
library.add(faChevronDown)
|
2019-04-29 23:41:39 +02:00
|
|
|
library.add(faCheck)
|
2019-09-09 19:55:43 +02:00
|
|
|
library.add(faPaste)
|
2019-10-19 21:41:23 +02:00
|
|
|
library.add(faPencilAlt)
|
2019-11-24 14:16:24 +01:00
|
|
|
library.add(faCloudDownloadAlt)
|
|
|
|
library.add(faCloudUploadAlt)
|
|
|
|
library.add(faPercent)
|
|
|
|
library.add(faStar)
|
|
|
|
library.add(faAlignLeft)
|
|
|
|
library.add(faPaperclip)
|
|
|
|
library.add(faClock)
|
|
|
|
library.add(faHistory)
|
2020-01-31 11:05:53 +01:00
|
|
|
library.add(faSearch)
|
2020-02-09 14:46:01 +01:00
|
|
|
library.add(faCheckDouble)
|
2020-02-25 21:11:36 +01:00
|
|
|
library.add(faComments)
|
2020-04-01 22:13:57 +02:00
|
|
|
library.add(faTh)
|
|
|
|
library.add(faSort)
|
|
|
|
library.add(faSortUp)
|
2020-04-18 14:39:56 +02:00
|
|
|
library.add(faList)
|
2020-04-26 01:11:34 +02:00
|
|
|
library.add(faEllipsisV)
|
2020-06-11 17:34:13 +02:00
|
|
|
library.add(faFilter)
|
2020-06-21 20:27:39 +02:00
|
|
|
library.add(faFillDrip)
|
2018-09-09 17:23:06 +02:00
|
|
|
|
|
|
|
Vue.component('icon', FontAwesomeIcon)
|
|
|
|
|
2018-12-25 16:03:51 +01:00
|
|
|
// Tooltip
|
|
|
|
import VTooltip from 'v-tooltip'
|
|
|
|
Vue.use(VTooltip)
|
|
|
|
|
2019-10-16 20:25:10 +02:00
|
|
|
// PWA
|
|
|
|
import './registerServiceWorker'
|
|
|
|
|
2018-12-25 16:03:51 +01:00
|
|
|
// Set focus
|
|
|
|
Vue.directive('focus', {
|
|
|
|
// When the bound element is inserted into the DOM...
|
2020-01-31 17:19:04 +01:00
|
|
|
inserted: el => {
|
|
|
|
// Focus the element only if the viewport is big enough
|
|
|
|
// auto focusing elements on mobile can be annoying since in these cases the
|
|
|
|
// keyboard always pops up and takes half of the available space on the screen.
|
|
|
|
// The threshhold is the same as the breakpoints in css.
|
|
|
|
if (window.innerWidth > 769) {
|
|
|
|
el.focus()
|
|
|
|
}
|
2018-12-25 16:03:51 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2020-01-30 22:47:08 +01:00
|
|
|
// Mixins
|
|
|
|
import message from './message'
|
2020-03-02 21:55:22 +01:00
|
|
|
import {format, formatDistance} from 'date-fns'
|
2020-06-17 00:20:37 +02:00
|
|
|
import {colorIsDark} from './helpers/colorIsDark'
|
2020-07-07 22:07:13 +02:00
|
|
|
import {setTitle} from './helpers/setTitle'
|
2020-01-30 21:49:00 +01:00
|
|
|
Vue.mixin({
|
|
|
|
methods: {
|
2020-03-23 18:46:33 +01:00
|
|
|
formatDateSince: date => {
|
|
|
|
const currentDate = new Date()
|
|
|
|
let formatted = '';
|
|
|
|
if (date > currentDate) {
|
|
|
|
formatted += 'in '
|
|
|
|
}
|
|
|
|
formatted += formatDistance(date, currentDate)
|
|
|
|
if(date < currentDate) {
|
|
|
|
formatted += ' ago'
|
|
|
|
}
|
|
|
|
|
|
|
|
return formatted;
|
|
|
|
},
|
2020-03-02 21:55:22 +01:00
|
|
|
formatDate: date => format(date, 'PPPPpppp'),
|
2020-03-02 21:19:26 +01:00
|
|
|
error: (e, context, actions = []) => message.error(e, context, actions),
|
|
|
|
success: (s, context, actions = []) => message.success(s, context, actions),
|
2020-07-07 22:07:13 +02:00
|
|
|
colorIsDark: colorIsDark,
|
|
|
|
setTitle: setTitle,
|
2020-01-30 21:49:00 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2020-05-08 20:43:51 +02:00
|
|
|
// Vuex
|
|
|
|
import {store} from './store'
|
|
|
|
|
2018-08-28 22:50:22 +02:00
|
|
|
new Vue({
|
2020-01-30 22:47:08 +01:00
|
|
|
router,
|
2020-05-08 20:43:51 +02:00
|
|
|
store,
|
2020-01-30 22:47:08 +01:00
|
|
|
render: h => h(App)
|
2018-08-28 22:50:22 +02:00
|
|
|
}).$mount('#app')
|