2024-03-12 04:32:20 +01:00
|
|
|
import { createApp } from 'vue'
|
2020-07-06 19:08:34 +02:00
|
|
|
import App from './App.vue'
|
2020-08-29 19:05:56 +02:00
|
|
|
import BootstrapVue from 'bootstrap-vue'
|
2024-03-04 15:12:40 +01:00
|
|
|
import { VueShowdownPlugin } from 'vue-showdown'
|
2020-08-29 19:05:56 +02:00
|
|
|
|
2020-08-27 18:30:45 +02:00
|
|
|
import store from './store'
|
2021-11-10 18:40:42 +01:00
|
|
|
import router from './router'
|
|
|
|
import i18n from './i18n'
|
2020-07-07 13:48:54 +02:00
|
|
|
|
2021-02-11 15:22:42 +01:00
|
|
|
import { registerGlobalErrorHandlers } from './api'
|
2021-11-10 18:40:42 +01:00
|
|
|
import { initDefaultLocales } from './i18n/helpers'
|
2021-02-11 15:22:42 +01:00
|
|
|
|
2024-03-03 18:08:10 +01:00
|
|
|
const app = createApp({
|
|
|
|
...App,
|
|
|
|
})
|
|
|
|
|
|
|
|
app.use(store)
|
|
|
|
app.use(router)
|
|
|
|
app.use(i18n)
|
|
|
|
|
2020-08-29 19:05:56 +02:00
|
|
|
// Styles are imported in `src/App.vue` <style>
|
2024-03-03 18:08:10 +01:00
|
|
|
app.use(BootstrapVue, {
|
2020-12-16 12:10:05 +01:00
|
|
|
BSkeleton: { animation: 'none' },
|
|
|
|
BAlert: { show: true },
|
2024-02-24 18:25:12 +01:00
|
|
|
BBadge: { pill: true },
|
2020-12-16 12:10:05 +01:00
|
|
|
})
|
2020-08-29 19:05:56 +02:00
|
|
|
|
2024-03-04 15:12:40 +01:00
|
|
|
app.use(VueShowdownPlugin, {
|
|
|
|
flavor: 'github',
|
2021-08-14 14:37:19 +02:00
|
|
|
options: {
|
2024-02-24 18:25:12 +01:00
|
|
|
emoji: true,
|
|
|
|
},
|
2021-08-14 14:37:19 +02:00
|
|
|
})
|
2021-02-11 15:22:42 +01:00
|
|
|
|
2020-12-16 12:11:31 +01:00
|
|
|
// Ugly wrapper for `$bvModal.msgBoxConfirm` to set default i18n button titles
|
|
|
|
// FIXME find or wait for a better way
|
2024-03-03 18:08:10 +01:00
|
|
|
app.config.globalProperties.$askConfirmation = function (message, props) {
|
2020-12-16 12:11:31 +01:00
|
|
|
return this.$bvModal.msgBoxConfirm(message, {
|
2021-03-17 15:35:01 +01:00
|
|
|
okTitle: this.$i18n.t('ok'),
|
2020-12-16 12:11:31 +01:00
|
|
|
cancelTitle: this.$i18n.t('cancel'),
|
2022-10-28 15:17:43 +02:00
|
|
|
bodyBgVariant: 'warning',
|
|
|
|
centered: true,
|
2024-02-24 18:25:12 +01:00
|
|
|
bodyClass: [
|
|
|
|
'font-weight-bold',
|
|
|
|
'rounded-top',
|
|
|
|
store.state.theme ? 'text-white' : 'text-black',
|
|
|
|
],
|
|
|
|
...props,
|
2020-12-16 12:11:31 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-03-03 18:08:10 +01:00
|
|
|
app.config.globalProperties.$askMdConfirmation = function (
|
|
|
|
markdown,
|
|
|
|
props,
|
|
|
|
ok = false,
|
|
|
|
) {
|
2022-11-23 16:18:16 +01:00
|
|
|
const content = this.$createElement('vue-showdown', {
|
2024-02-24 18:25:12 +01:00
|
|
|
props: { markdown, flavor: 'github', options: { headerLevelStart: 4 } },
|
2022-11-23 16:18:16 +01:00
|
|
|
})
|
|
|
|
return this.$bvModal['msgBox' + (ok ? 'Ok' : 'Confirm')](content, {
|
|
|
|
okTitle: this.$i18n.t('yes'),
|
|
|
|
cancelTitle: this.$i18n.t('cancel'),
|
|
|
|
headerBgVariant: 'warning',
|
|
|
|
headerClass: store.state.theme ? 'text-white' : 'text-black',
|
|
|
|
centered: true,
|
2024-02-24 18:25:12 +01:00
|
|
|
...props,
|
2022-11-23 16:18:16 +01:00
|
|
|
})
|
|
|
|
}
|
2021-02-11 15:22:42 +01:00
|
|
|
|
2020-07-08 14:35:22 +02:00
|
|
|
// Register global components
|
2024-02-24 18:25:12 +01:00
|
|
|
const globalComponentsModules = import.meta.glob(
|
|
|
|
['@/components/globals/*.vue', '@/components/globals/*/*.vue'],
|
|
|
|
{ eager: true },
|
|
|
|
)
|
2023-04-03 21:03:39 +02:00
|
|
|
Object.values(globalComponentsModules).forEach((module) => {
|
|
|
|
const component = module.default
|
2024-03-03 18:08:10 +01:00
|
|
|
app.component(component.name, component)
|
2020-10-23 17:18:34 +02:00
|
|
|
})
|
2020-07-08 14:35:22 +02:00
|
|
|
|
2021-02-11 15:22:42 +01:00
|
|
|
registerGlobalErrorHandlers()
|
|
|
|
|
2021-11-10 18:40:42 +01:00
|
|
|
// Load default locales translations files and setup store data
|
2022-10-10 17:27:36 +02:00
|
|
|
initDefaultLocales().then(() => {
|
2024-03-03 18:08:10 +01:00
|
|
|
app.mount('#app')
|
2021-05-31 05:30:18 +02:00
|
|
|
})
|