diff --git a/app/globals-calendar.css b/app/globals-calendar.css index 8ae58e0..5a8f5a9 100755 --- a/app/globals-calendar.css +++ b/app/globals-calendar.css @@ -1,5 +1,5 @@ :root { - --fc-neutral-bg-color: #efe2ff; + --fc-neutral-bg-color: rgba(149, 52, 244, 0.2); --fc-page-bg-color: theme("colors.base"); --fc-border-color: theme("colors.inactive/0.5"); --fc-list-event-hover-bg-color: theme("colors.primary.hover"); @@ -11,17 +11,13 @@ --fc-button-text-color: theme("colors.text.main"); } -.dark { - --fc-neutral-bg-color: #31273b; -} - .fc { .fc-timegrid-slot-minor { @apply border-t-0; } .fc-timegrid-slot-label { - @apply relative top-[-0.5rem] border-t-0 pr-1 align-top text-xs text-inactive; + @apply relative top-[-0.5rem] border-t-0 pr-1 align-top text-xs text-gray-500; } .fc-header-toolbar.fc-toolbar { @@ -48,10 +44,18 @@ } } - .fc-col-header-cell-cushion, + .fc-col-header-cell-cushion { + @apply text-lg text-gray-500; + } + + .fc-day-today { + .fc-col-header-cell-cushion { + @apply font-medium text-text-main; + } + } + .week-cell { - /* Force word wrapping */ - word-spacing: 3000px; + @apply text-xs text-gray-500; } .fc-list-empty-cushion { @@ -83,7 +87,23 @@ @apply hidden; } - .fc-timeGridWeek-view .fc-daygrid-body { - @apply bg-[var(--fc-neutral-bg-color)]; + .fc-timegrid-now-indicator-line { + @apply rounded-full !border-2; + } + + .fc-timegrid-now-indicator-arrow { + @apply w-full border-none pr-2 text-right text-xs font-medium text-[red]; + } + + .fc-day-today { + background-color: unset !important; + } + + .fc-day-today .fc-daygrid-day-number { + @apply inline-flex h-7 w-fit items-center justify-center rounded-md bg-red-500 px-1 font-medium text-white; + } + + .fc-timegrid-event-harness-inset .fc-timegrid-event { + @apply shadow-none; } } diff --git a/components/common/calendar/Calendar.tsx b/components/common/calendar/Calendar.tsx index f5af34e..ef63a71 100644 --- a/components/common/calendar/Calendar.tsx +++ b/components/common/calendar/Calendar.tsx @@ -129,9 +129,23 @@ function Calendar({ eventContent: renderEventListMonth, }, timeGridWeek: { - // Show weekday and date in day header - dayHeaderFormat: "ddd D", eventContent: renderEventTimeGridWeek, + weekNumbers: false, + // Show weekday and date in day header + dayHeaderContent: (arg) => { + if (!arg.isToday) { + return moment(arg.date).format("ddd D"); + } + // If today, show date in red circle + return ( + <> + {moment(arg.date).format("ddd")}{" "} +
+ {moment(arg.date).format("D")} +
+ + ); + }, }, dayGridMonth: { eventContent: renderEventDayGridMonth, @@ -140,6 +154,29 @@ function Calendar({ allDayText="" // Remove text in all day row // displayEventEnd={true} // Display end time nowIndicator={true} // Display current time as line + nowIndicatorContent={(arg) => { + if ( + arg.date.getUTCHours() === 0 && + arg.date.getUTCMinutes() === 0 && + arg.date.getUTCSeconds() === 0 + ) + return null; // It's a line, not a label + // Fix timezone + const text = moment(Number(arg.date) - 3 * 60 * 60 * 1000).format( + "HH:mm", + ); + const isNearTimeLabel = + arg.date.getUTCMinutes() < 15 || arg.date.getUTCMinutes() > 45; + if (!isNearTimeLabel) { + return
{text}
; + } else { + return ( +
+ {text} +
+ ); + } + }} firstDay={1} // From Monday navLinks={false} // Dates are clickable weekNumbers={true} // Display numbers of weeks @@ -150,7 +187,7 @@ function Calendar({ contentHeight="auto" // Do not add scrollbar stickyHeaderDates={false} eventInteractive={true} // Make event tabbable - eventClassNames="cursor-pointer text-sm" // Show that events are clickable + eventClassNames="cursor-pointer text-sm rounded-md !bg-transparent border-0 overflow-clip" eventClick={(info) => { info.jsEvent.preventDefault(); // We should check prev value via argument because 'eventElement' may be outdated in current closure @@ -199,10 +236,47 @@ function renderEventListMonth({ event }: EventContentArg) { ); } -function renderEventTimeGridWeek({ event }: EventContentArg) { +function renderEventTimeGridWeek({ + event, + borderColor, + backgroundColor, + timeText, +}: EventContentArg) { + const border = + borderColor !== "undefined" + ? borderColor + : backgroundColor !== "undefined" + ? backgroundColor + : "#9A2EFF"; + const background = + backgroundColor !== "undefined" + ? backgroundColor + : borderColor !== "undefined" + ? borderColor + : "#9A2EFF"; return ( -
- {event.title} +
+ + {event.title} + + {timeText && ( + + {" "} + {timeText} + + )} {event.extendedProps.location} @@ -222,7 +296,7 @@ function renderEventDayGridMonth({ className="fc-daygrid-event-dot" style={{ borderColor: borderColor || backgroundColor }} /> -
+
{event.title || <> }
{timeText && (