-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qalendar fixes #587
Qalendar fixes #587
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<script setup> | ||
import { | ||
ref, computed, inject, toRefs, watch, | ||
ref, computed, inject, toRefs, watch, onMounted | ||
} from 'vue'; | ||
import { Qalendar } from 'qalendar'; | ||
import 'qalendar/dist/style.css'; | ||
|
@@ -274,7 +274,7 @@ const calendarEvents = computed(() => { | |
}); | ||
|
||
/** | ||
* Calculate the start and end times, and then space them our by 2 hours for style! | ||
* Calculate the start and end times, and then space them out by 2 hours for style! | ||
* @type {ComputedRef<TimeNumeric>} | ||
*/ | ||
const dayBoundary = computed(() => { | ||
|
@@ -300,6 +300,9 @@ const dayBoundary = computed(() => { | |
}; | ||
}); | ||
|
||
// For now we only support English and German | ||
const locale = getLocale(); | ||
|
||
/** | ||
* Calendar Config Object | ||
*/ | ||
|
@@ -308,7 +311,7 @@ const config = ref({ | |
showEventsOnMobileView: false, | ||
}, | ||
week: { | ||
startsOn: 'sunday', | ||
startsOn: locale === 'de' ? 'monday' : 'sunday', | ||
}, | ||
style: { | ||
// Just the pre-calculated list from tailwind, could use some fine-tuning. | ||
|
@@ -329,19 +332,17 @@ const config = ref({ | |
length: timeSlotDuration.value, // Accepts [15, 30, 60] | ||
height: timeSlotHeight.value, // pixel height of each length | ||
}, | ||
dayBoundaries: dayBoundary, | ||
dayBoundaries: { | ||
start: dayBoundary.value.start, | ||
end: dayBoundary.value.end | ||
}, | ||
eventDialog: { | ||
// We roll our own | ||
isDisabled: true, | ||
}, | ||
locale: locale === 'de' ? 'de-DE' : 'en-US' | ||
}); | ||
|
||
// We only support two locales right now so just stick this in. | ||
const locale = getLocale(); | ||
if (locale) { | ||
config.value.locale = locale === 'de' ? 'de-DE' : 'en-US'; | ||
} | ||
|
||
/** | ||
* Qalendar's selectedDate is only set on init and never updated. So we have to poke at their internals... | ||
*/ | ||
|
@@ -360,6 +361,7 @@ watch(dayBoundary, () => { | |
return; | ||
} | ||
|
||
// TODO: This does update the boundary values, but does NOT update the container height! | ||
qalendarRef.value.time.DAY_START = dayBoundary.value.start * 100; | ||
qalendarRef.value.time.DAY_END = dayBoundary.value.end * 100; | ||
Comment on lines
+364
to
366
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any ideas how to trigger a UI rerender of Qalendar at this point? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might need to adjust our fork, and then pull in our fork. But I'm not sure 🤔 |
||
}); | ||
|
@@ -378,7 +380,6 @@ watch(route, () => { | |
</script> | ||
<template> | ||
<div | ||
class="w-full" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was also set on the parent. Removing the duplicated class here. |
||
:style="{'color-scheme': preferredTheme === ColorSchemes.Dark ? 'dark' : null}" | ||
:class="{'is-light-mode': preferredTheme === ColorSchemes.Light}" | ||
> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the point of initializing this config object, dayBoundary.value holds the default values 0, 24 making Qalendar span the container element over that range. Updating the boundary later in the watcher causes Qalendar to recalculate the displayed time rows, but it doesn't update the row height.