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
|
|
|
|
2021-07-19 20:20:49 +02:00
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
API_URL: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-24 01:24:57 +02:00
|
|
|
import {formatDate, 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
|
|
|
// Register the modal
|
2021-07-19 20:20:49 +02:00
|
|
|
// @ts-ignore
|
2020-09-05 22:35:52 +02:00
|
|
|
import Modal from './components/modal/modal'
|
|
|
|
// Add CSS
|
|
|
|
import './styles/vikunja.scss'
|
|
|
|
// Notifications
|
|
|
|
import Notifications from 'vue-notification'
|
|
|
|
// Icons
|
|
|
|
import {library} from '@fortawesome/fontawesome-svg-core'
|
|
|
|
import {
|
|
|
|
faAlignLeft,
|
|
|
|
faAngleRight,
|
|
|
|
faBars,
|
|
|
|
faCalendar,
|
|
|
|
faCalendarWeek,
|
|
|
|
faCheck,
|
|
|
|
faCheckDouble,
|
|
|
|
faChevronDown,
|
|
|
|
faCloudDownloadAlt,
|
|
|
|
faCloudUploadAlt,
|
|
|
|
faCog,
|
|
|
|
faEllipsisV,
|
|
|
|
faExclamation,
|
|
|
|
faFillDrip,
|
|
|
|
faFilter,
|
|
|
|
faHistory,
|
|
|
|
faKeyboard,
|
|
|
|
faLayerGroup,
|
|
|
|
faList,
|
|
|
|
faListOl,
|
|
|
|
faLock,
|
|
|
|
faPaperclip,
|
|
|
|
faPaste,
|
|
|
|
faPen,
|
|
|
|
faPencilAlt,
|
|
|
|
faPercent,
|
|
|
|
faPlus,
|
|
|
|
faPowerOff,
|
|
|
|
faSearch,
|
|
|
|
faSignOutAlt,
|
|
|
|
faSort,
|
|
|
|
faSortUp,
|
|
|
|
faStar as faStarSolid,
|
|
|
|
faTachometerAlt,
|
|
|
|
faTags,
|
|
|
|
faTasks,
|
|
|
|
faTh,
|
|
|
|
faTimes,
|
|
|
|
faTrashAlt,
|
|
|
|
faUser,
|
|
|
|
faUsers,
|
2020-11-28 14:59:27 +01:00
|
|
|
faForward,
|
|
|
|
faChessKnight,
|
|
|
|
faCoffee,
|
|
|
|
faCocktail,
|
2021-01-30 17:17:04 +01:00
|
|
|
faEllipsisH,
|
|
|
|
faArchive,
|
|
|
|
faShareAlt,
|
|
|
|
faImage,
|
2021-02-14 20:18:51 +01:00
|
|
|
faBell,
|
2020-09-05 22:35:52 +02:00
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
2021-06-24 01:24:57 +02:00
|
|
|
import {
|
|
|
|
faCalendarAlt,
|
|
|
|
faClock,
|
|
|
|
faComments,
|
|
|
|
faSave,
|
|
|
|
faStar,
|
|
|
|
faTimesCircle,
|
|
|
|
faSun,
|
2021-07-19 11:18:22 +02:00
|
|
|
faBellSlash,
|
2021-06-24 01:24:57 +02:00
|
|
|
} from '@fortawesome/free-regular-svg-icons'
|
2020-09-05 22:35:52 +02:00
|
|
|
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'
|
|
|
|
// PWA
|
|
|
|
import './registerServiceWorker'
|
|
|
|
|
|
|
|
// Shortcuts
|
2021-07-19 20:20:49 +02:00
|
|
|
// @ts-ignore - no types available
|
2020-09-05 22:35:52 +02:00
|
|
|
import vueShortkey from 'vue-shortkey'
|
|
|
|
// Mixins
|
|
|
|
import message from './message'
|
2021-01-17 11:51:07 +01:00
|
|
|
import {colorIsDark} from './helpers/color/colorIsDark'
|
2020-09-05 22:35:52 +02:00
|
|
|
import {setTitle} from './helpers/setTitle'
|
2021-07-09 10:22:20 +02:00
|
|
|
import {getNamespaceTitle} from './helpers/getNamespaceTitle'
|
|
|
|
import {getListTitle} from './helpers/getListTitle'
|
2020-09-05 22:35:52 +02:00
|
|
|
// Vuex
|
|
|
|
import {store} from './store'
|
2021-06-24 01:24:57 +02:00
|
|
|
// i18n
|
2021-07-19 20:20:49 +02:00
|
|
|
import VueI18n from 'vue-i18n' // types
|
2021-06-24 01:24:57 +02:00
|
|
|
import {i18n} from './i18n/setup'
|
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)
|
|
|
|
}
|
|
|
|
|
2018-09-12 08:22:17 +02:00
|
|
|
Vue.component('modal', Modal)
|
|
|
|
|
2018-08-28 22:50:22 +02:00
|
|
|
Vue.config.productionTip = false
|
|
|
|
|
2018-09-08 21:43:16 +02:00
|
|
|
Vue.use(Notifications)
|
|
|
|
|
2018-09-09 17:23:06 +02:00
|
|
|
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)
|
2020-07-25 16:52:04 +02:00
|
|
|
library.add(faKeyboard)
|
2020-09-04 22:01:02 +02:00
|
|
|
library.add(faSave)
|
2020-09-05 22:16:17 +02:00
|
|
|
library.add(faStarSolid)
|
2020-11-28 14:59:27 +01:00
|
|
|
library.add(faForward)
|
|
|
|
library.add(faSun)
|
|
|
|
library.add(faChessKnight)
|
|
|
|
library.add(faCoffee)
|
|
|
|
library.add(faCocktail)
|
2021-01-30 17:17:04 +01:00
|
|
|
library.add(faEllipsisH)
|
|
|
|
library.add(faArchive)
|
|
|
|
library.add(faShareAlt)
|
|
|
|
library.add(faImage)
|
2021-02-14 20:18:51 +01:00
|
|
|
library.add(faBell)
|
|
|
|
library.add(faBellSlash)
|
2018-09-09 17:23:06 +02:00
|
|
|
|
|
|
|
Vue.component('icon', FontAwesomeIcon)
|
|
|
|
|
2021-06-24 01:24:57 +02:00
|
|
|
Vue.use(vueShortkey, {prevent: ['input', 'textarea', '.input']})
|
2020-07-25 16:52:04 +02:00
|
|
|
|
2021-07-25 15:27:15 +02:00
|
|
|
import focus from './directives/focus'
|
2020-11-02 21:52:07 +01:00
|
|
|
Vue.directive('focus', focus)
|
2018-12-25 16:03:51 +01:00
|
|
|
|
2021-07-25 15:27:15 +02:00
|
|
|
import tooltip from './directives/tooltip'
|
2021-04-22 14:26:48 +02:00
|
|
|
|
2021-07-19 20:20:49 +02:00
|
|
|
// @ts-ignore
|
2021-06-24 01:24:57 +02:00
|
|
|
Vue.directive('tooltip', tooltip)
|
2020-11-28 14:59:27 +01:00
|
|
|
|
2021-07-19 20:20:49 +02:00
|
|
|
// @ts-ignore
|
2021-07-25 15:27:15 +02:00
|
|
|
import Button from './components/input/button'
|
2021-01-17 18:57:57 +01:00
|
|
|
Vue.component('x-button', Button)
|
|
|
|
|
2021-07-19 20:20:49 +02:00
|
|
|
// @ts-ignore
|
2021-07-25 15:27:15 +02:00
|
|
|
import Card from './components/misc/card'
|
2021-01-17 18:57:57 +01:00
|
|
|
Vue.component('card', Card)
|
|
|
|
|
2020-01-30 21:49:00 +01:00
|
|
|
Vue.mixin({
|
|
|
|
methods: {
|
2021-06-24 01:24:57 +02:00
|
|
|
formatDateSince(date) {
|
2021-07-19 20:20:49 +02:00
|
|
|
return formatDateSince(date, (p: VueI18n.Path, params?: VueI18n.Values) => this.$t(p, params))
|
2021-06-24 01:24:57 +02:00
|
|
|
},
|
|
|
|
formatDate(date) {
|
|
|
|
return formatDate(date, 'PPPPpppp', this.$t('date.locale'))
|
|
|
|
},
|
|
|
|
formatDateShort(date) {
|
|
|
|
return formatDate(date, 'PPpp', this.$t('date.locale'))
|
2020-03-23 18:46:33 +01:00
|
|
|
},
|
2021-07-09 10:22:20 +02:00
|
|
|
getNamespaceTitle(n) {
|
2021-07-19 20:20:49 +02:00
|
|
|
return getNamespaceTitle(n, (p: VueI18n.Path) => this.$t(p))
|
2021-07-09 10:22:20 +02:00
|
|
|
},
|
|
|
|
getListTitle(l) {
|
2021-07-19 20:20:49 +02:00
|
|
|
return getListTitle(l, (p: VueI18n.Path) => this.$t(p))
|
2021-07-09 10:22:20 +02:00
|
|
|
},
|
2021-06-22 22:07:57 +02:00
|
|
|
error(e, actions = []) {
|
2021-07-19 20:20:49 +02:00
|
|
|
return message.error(e, this, (p: VueI18n.Path) => this.$t(p), actions)
|
2021-06-22 22:07:57 +02:00
|
|
|
},
|
|
|
|
success(s, actions = []) {
|
2021-07-19 20:20:49 +02:00
|
|
|
return message.success(s, this, (p: VueI18n.Path) => this.$t(p), actions)
|
2021-06-22 22:07:57 +02:00
|
|
|
},
|
2020-07-07 22:07:13 +02:00
|
|
|
colorIsDark: colorIsDark,
|
|
|
|
setTitle: setTitle,
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
2020-01-30 21:49:00 +01:00
|
|
|
})
|
|
|
|
|
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,
|
2021-06-24 01:24:57 +02:00
|
|
|
i18n,
|
2020-09-05 22:35:52 +02:00
|
|
|
render: h => h(App),
|
2018-08-28 22:50:22 +02:00
|
|
|
}).$mount('#app')
|