From 0a718d36c2718a394ba48c0b2bc58a4a9be79f48 Mon Sep 17 00:00:00 2001 From: ajdj100 Date: Sun, 23 Nov 2025 23:12:58 -0500 Subject: [PATCH] split event view into seperate component --- .../components/calendar/ViewCalendarEvent.vue | 105 ++++++++++++++++++ .../ui/button-group/ButtonGroup.vue | 22 ++++ .../ui/button-group/ButtonGroupSeparator.vue | 28 +++++ .../ui/button-group/ButtonGroupText.vue | 29 +++++ ui/src/components/ui/button-group/index.js | 22 ++++ ui/src/pages/Calendar.vue | 99 +---------------- 6 files changed, 211 insertions(+), 94 deletions(-) create mode 100644 ui/src/components/calendar/ViewCalendarEvent.vue create mode 100644 ui/src/components/ui/button-group/ButtonGroup.vue create mode 100644 ui/src/components/ui/button-group/ButtonGroupSeparator.vue create mode 100644 ui/src/components/ui/button-group/ButtonGroupText.vue create mode 100644 ui/src/components/ui/button-group/index.js diff --git a/ui/src/components/calendar/ViewCalendarEvent.vue b/ui/src/components/calendar/ViewCalendarEvent.vue new file mode 100644 index 0000000..6035542 --- /dev/null +++ b/ui/src/components/calendar/ViewCalendarEvent.vue @@ -0,0 +1,105 @@ + + + \ No newline at end of file diff --git a/ui/src/components/ui/button-group/ButtonGroup.vue b/ui/src/components/ui/button-group/ButtonGroup.vue new file mode 100644 index 0000000..21b93d3 --- /dev/null +++ b/ui/src/components/ui/button-group/ButtonGroup.vue @@ -0,0 +1,22 @@ + + + diff --git a/ui/src/components/ui/button-group/ButtonGroupSeparator.vue b/ui/src/components/ui/button-group/ButtonGroupSeparator.vue new file mode 100644 index 0000000..4fdcdc4 --- /dev/null +++ b/ui/src/components/ui/button-group/ButtonGroupSeparator.vue @@ -0,0 +1,28 @@ + + + diff --git a/ui/src/components/ui/button-group/ButtonGroupText.vue b/ui/src/components/ui/button-group/ButtonGroupText.vue new file mode 100644 index 0000000..489cfe7 --- /dev/null +++ b/ui/src/components/ui/button-group/ButtonGroupText.vue @@ -0,0 +1,29 @@ + + + diff --git a/ui/src/components/ui/button-group/index.js b/ui/src/components/ui/button-group/index.js new file mode 100644 index 0000000..d9676c3 --- /dev/null +++ b/ui/src/components/ui/button-group/index.js @@ -0,0 +1,22 @@ +import { cva } from "class-variance-authority"; + +export { default as ButtonGroup } from "./ButtonGroup.vue"; +export { default as ButtonGroupSeparator } from "./ButtonGroupSeparator.vue"; +export { default as ButtonGroupText } from "./ButtonGroupText.vue"; + +export const buttonGroupVariants = cva( + "flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2", + { + variants: { + orientation: { + horizontal: + "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none", + vertical: + "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none", + }, + }, + defaultVariants: { + orientation: "horizontal", + }, + }, +); diff --git a/ui/src/pages/Calendar.vue b/ui/src/pages/Calendar.vue index 1ad7875..459017e 100644 --- a/ui/src/pages/Calendar.vue +++ b/ui/src/pages/Calendar.vue @@ -8,6 +8,7 @@ import CreateCalendarEvent from '@/components/calendar/CreateCalendarEvent.vue' 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' const monthLabels = [ 'January', 'February', 'March', 'April', 'May', 'June', @@ -87,7 +88,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); + console.log(activeEvent.value); // activeEvent.value = { // id: arg.event.id, // title: arg.event.title, @@ -176,24 +177,6 @@ watch(panelOpen, async () => { }) - -const startFmt = new Intl.DateTimeFormat(undefined, { - weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', - hour: 'numeric', minute: '2-digit' -}) -const endFmt = new Intl.DateTimeFormat(undefined, { - hour: 'numeric', minute: '2-digit' -}) - -const whenText = computed(() => { - if (!activeEvent.value?.start) return '' - const s = new Date(activeEvent.value.start) - const e = activeEvent.value?.end ? new Date(activeEvent.value.end) : null - return e - ? `${startFmt.format(s)} – ${endFmt.format(e)}` - : `${startFmt.format(s)}` -}) - function onCreateEvent() { const iso = new Date().toISOString().slice(0, 10) // YYYY-MM-DD onDateClick({ dateStr: iso }) @@ -262,82 +245,10 @@ onMounted(() => { -