2021-08-20 15:46:41 +02:00
|
|
|
import { createApp, configureCompat } from 'vue'
|
|
|
|
|
|
|
|
configureCompat({
|
|
|
|
COMPONENT_V_MODEL: false,
|
|
|
|
COMPONENT_ASYNC: false,
|
|
|
|
RENDER_FUNCTION: false,
|
|
|
|
WATCH_ARRAY: false, // TODO: check this again; this might lead to some problemes
|
|
|
|
})
|
2021-08-19 20:09:45 +02:00
|
|
|
|
2018-08-28 22:50:22 +02:00
|
|
|
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
|
|
|
|
2021-08-25 12:28:29 +02:00
|
|
|
import {error, success} from './message'
|
|
|
|
|
2021-07-19 20:20:49 +02:00
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
API_URL: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-07 12:20:52 +02:00
|
|
|
import {formatDate, formatDateShort, formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
2021-07-19 20:20:49 +02:00
|
|
|
// @ts-ignore
|
2020-05-09 21:39:46 +02:00
|
|
|
import {VERSION} from './version.json'
|
2021-04-22 14:26:48 +02:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
// Add CSS
|
|
|
|
import './styles/vikunja.scss'
|
|
|
|
// Notifications
|
2021-08-20 15:46:41 +02:00
|
|
|
import Notifications from '@kyvg/vue3-notification'
|
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
// PWA
|
|
|
|
import './registerServiceWorker'
|
|
|
|
|
|
|
|
// Shortcuts
|
2021-08-20 15:46:41 +02:00
|
|
|
import shortkey from '@/plugins/shortkey'
|
2020-09-05 22:35:52 +02:00
|
|
|
// Vuex
|
|
|
|
import {store} from './store'
|
2021-06-24 01:24:57 +02:00
|
|
|
// i18n
|
2021-08-20 15:38:16 +02:00
|
|
|
import {i18n} from './i18n'
|
2020-09-05 22:35:52 +02:00
|
|
|
|
2020-05-09 21:39:46 +02:00
|
|
|
console.info(`Vikunja frontend version ${VERSION}`)
|
|
|
|
|
2020-10-11 12:13:35 +02:00
|
|
|
// Check if we have an api url in local storage and use it if that's the case
|
|
|
|
const apiUrlFromStorage = localStorage.getItem('API_URL')
|
|
|
|
if (apiUrlFromStorage !== null) {
|
|
|
|
window.API_URL = apiUrlFromStorage
|
|
|
|
}
|
|
|
|
|
2020-05-10 18:26:33 +02:00
|
|
|
// Make sure the api url does not contain a / at the end
|
2020-09-05 22:35:52 +02:00
|
|
|
if (window.API_URL.substr(window.API_URL.length - 1, window.API_URL.length) === '/') {
|
2020-05-10 18:26:33 +02:00
|
|
|
window.API_URL = window.API_URL.substr(0, window.API_URL.length - 1)
|
|
|
|
}
|
|
|
|
|
2021-08-19 20:09:45 +02:00
|
|
|
const app = createApp(App)
|
2018-08-28 22:50:22 +02:00
|
|
|
|
2021-08-20 15:46:41 +02:00
|
|
|
app.use(Notifications)
|
2018-09-08 21:43:16 +02:00
|
|
|
|
2018-09-09 17:23:06 +02:00
|
|
|
|
2020-07-25 16:52:04 +02:00
|
|
|
|
2021-08-20 15:46:41 +02:00
|
|
|
app.use(shortkey, {prevent: ['input', 'textarea', '.input', '[contenteditable]']})
|
2021-08-25 12:28:29 +02:00
|
|
|
|
2021-08-19 20:09:45 +02:00
|
|
|
// directives
|
2021-07-25 15:27:15 +02:00
|
|
|
import focus from './directives/focus'
|
|
|
|
import tooltip from './directives/tooltip'
|
2021-08-19 20:09:45 +02:00
|
|
|
app.directive('focus', focus)
|
|
|
|
app.directive('tooltip', tooltip)
|
2021-04-22 14:26:48 +02:00
|
|
|
|
2021-08-19 20:09:45 +02:00
|
|
|
// global components
|
|
|
|
import FontAwesomeIcon from './icons'
|
|
|
|
import Button from './components/input/button.vue'
|
|
|
|
import Modal from './components/modal/modal.vue'
|
|
|
|
import Card from './components/misc/card.vue'
|
|
|
|
app.component('icon', FontAwesomeIcon)
|
|
|
|
app.component('x-button', Button)
|
|
|
|
app.component('modal', Modal)
|
|
|
|
app.component('card', Card)
|
2021-01-17 18:57:57 +01:00
|
|
|
|
2021-08-19 20:09:45 +02:00
|
|
|
// Mixins
|
|
|
|
import {getNamespaceTitle} from './helpers/getNamespaceTitle'
|
|
|
|
import {getListTitle} from './helpers/getListTitle'
|
|
|
|
import {colorIsDark} from './helpers/color/colorIsDark'
|
|
|
|
import {setTitle} from './helpers/setTitle'
|
|
|
|
app.mixin({
|
2020-01-30 21:49:00 +01:00
|
|
|
methods: {
|
2021-08-20 15:38:16 +02:00
|
|
|
formatDateSince,
|
2021-10-07 12:20:52 +02:00
|
|
|
format: formatDate,
|
2021-08-20 15:38:16 +02:00
|
|
|
formatDate: formatDateLong,
|
|
|
|
formatDateShort: formatDateShort,
|
|
|
|
getNamespaceTitle,
|
|
|
|
getListTitle,
|
|
|
|
colorIsDark,
|
|
|
|
setTitle,
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
2020-01-30 21:49:00 +01:00
|
|
|
})
|
|
|
|
|
2021-08-20 15:46:41 +02:00
|
|
|
app.config.errorHandler = (err, vm, info) => {
|
|
|
|
error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
app.config.globalProperties.$message = {
|
|
|
|
error,
|
|
|
|
success,
|
|
|
|
}
|
|
|
|
|
2021-08-19 20:09:45 +02:00
|
|
|
app.use(router)
|
|
|
|
app.use(store)
|
|
|
|
app.use(i18n)
|
|
|
|
|
|
|
|
app.mount('#app')
|