diff --git a/ui/src/pages/Calendar.vue b/ui/src/pages/Calendar.vue
index ea93dfc..ca1d6ef 100644
--- a/ui/src/pages/Calendar.vue
+++ b/ui/src/pages/Calendar.vue
@@ -9,6 +9,7 @@ import { getCalendarEvent, getMonthCalendarEvents } from '@/api/calendar'
import { CalendarEvent, CalendarEventShort } from '@shared/types/calendar'
import { Calendar } from '@fullcalendar/core'
import ViewCalendarEvent from '@/components/calendar/ViewCalendarEvent.vue'
+import { useRouter, useRoute } from 'vue-router'
const monthLabels = [
'January', 'February', 'March', 'April', 'May', 'June',
@@ -23,6 +24,9 @@ function api() {
return calendarRef.value?.getApi()
}
+const router = useRouter();
+const route = useRoute();
+
// keep dropdowns in sync whenever the calendar navigates
function onDatesSet() {
const d = api()?.getDate() ?? new Date()
@@ -87,15 +91,7 @@ const calendarRef = ref | null>(null)
async function onEventClick(arg: any) {
const targetEvent = arg.event.id;
- activeEvent.value = await getCalendarEvent(targetEvent);
- console.log(activeEvent.value);
- // activeEvent.value = {
- // id: arg.event.id,
- // title: arg.event.title,
- // start: arg.event.startStr,
- // end: arg.event.endStr,
- // extendedProps: arg.event.extendedProps
- // }
+ router.push(`/calendar/event/${targetEvent}`)
panelOpen.value = true
}
@@ -170,6 +166,15 @@ const calendarOptions = ref({
//@ts-ignore (shhh)
calendarOptions.value.datesSet = onDatesSet
+watch(() => route.params.id, async (newID) => {
+ console.log(newID);
+ if (newID === undefined) {
+ panelOpen.value = false;
+ } else {
+ panelOpen.value = true;
+ }
+})
+
watch(panelOpen, async () => {
await nextTick()
@@ -245,10 +250,11 @@ onMounted(() => {