feat: replace our home-grown gantt implementation with ganttastic #2180

Merged
konrad merged 78 commits from feature/ganttastic into main 2022-10-27 16:03:27 +00:00
1 changed files with 27 additions and 30 deletions
Showing only changes of commit e1f49f2ff1 - Show all commits

View File

@ -1,4 +1,3 @@
import {computed, ref, watch} from 'vue'
import {createI18n} from 'vue-i18n'
import langEN from './lang/en.json'
@ -89,35 +88,33 @@ export function setLanguage() {
return loadLanguageAsync(getCurrentLanguage())
}
import type dayjs from 'dayjs'
// FIXME: This function is not used at the moment because it does not seem to work.
// It should be reworked and cleaned up. An even better way would be to get rid of
// this completely by using date-fns for everything.
export function useDayjsLanguageSync(dayjsGlobal: typeof dayjs) {
const dayjsLanguageLoaded = ref(false)
watch(
() => i18n.global.locale,
async (currentLanguage: string) => {
if (!dayjsGlobal) {
return
}
const dayjsLanguageCode = DAYJS_LOCALE_MAPPING[currentLanguage.toLowerCase()] || currentLanguage.toLowerCase()
dayjsLanguageLoaded.value = dayjsGlobal.locale() === dayjsLanguageCode
if (dayjsLanguageLoaded.value) {
return
}
console.log('foo')
await import(`../../node_modules/dayjs/locale/${dayjsLanguageCode}.js`)
console.log('bar')
dayjsGlobal.locale(dayjsLanguageCode)
dayjsLanguageLoaded.value = true
},
{immediate: true},
)
// we export the loading state since that's easier to work with
const isLoading = computed(() => !dayjsLanguageLoaded.value)
return isLoading
}
// export function useDayjsLanguageSync(dayjsGlobal: typeof dayjs) {
// const dayjsLanguageLoaded = ref(false)
// watch(
// () => i18n.global.locale,
// async (currentLanguage: string) => {
// if (!dayjsGlobal) {
// return
// }
// const dayjsLanguageCode = DAYJS_LOCALE_MAPPING[currentLanguage.toLowerCase()] || currentLanguage.toLowerCase()
// dayjsLanguageLoaded.value = dayjsGlobal.locale() === dayjsLanguageCode
// if (dayjsLanguageLoaded.value) {
// return
// }
// console.log('foo')
// await import(`../../node_modules/dayjs/locale/${dayjsLanguageCode}.js`)

This statement did not work in my tests. IMHO we could merge the gantt chart without proper locale support and rework that later. This PR is already a lot bigger than it should be.

This statement did not work in my tests. IMHO we could merge the gantt chart without proper locale support and rework that later. This PR is already a lot bigger than it should be.

Agree!

I found out how to make this work. Turned out that more work is needed since after the locale support works the weekdayFromTimeLabel doesn't anymore. So better to add this at a later point.

Agree! I found out how to make this work. Turned out that more work is needed since after the locale support works the `weekdayFromTimeLabel` doesn't anymore. So better to add this at a later point.
// console.log('bar')
// dayjsGlobal.locale(dayjsLanguageCode)
// dayjsLanguageLoaded.value = true
// },
// {immediate: true},
// )
//
// // we export the loading state since that's easier to work with
// const isLoading = computed(() => !dayjsLanguageLoaded.value)
//
// return isLoading
// }