22import { useEventModal } from ' @/composables/modals/useEventModal' ;
33import type { CalendarEvent } from ' @/types/core' ;
44import { getCurrentViewDatetime } from ' @/utils' ;
5+ import { DateTime } from ' luxon' ;
56import { computed } from ' vue' ;
67import { useRoute } from ' vue-router' ;
7- import AllDayEvent from ' . /AllDayEvent.vue' ;
8+ import AllDayEvent from ' @/components /AllDayEvent.vue' ;
89import { getTag } from ' @/services/calendarCache' ;
910
1011const route = useRoute ();
@@ -20,6 +21,20 @@ const props = defineProps<{
2021// Must be computed so route changes properly invalidate compEvents
2122const currentDate = computed (() => getCurrentViewDatetime (route .params ).startOf (' day' ));
2223
24+ const todayGridColumn = computed (() => {
25+ const today = DateTime .now ()
26+ .setZone (currentDate .value .zoneName ?? undefined )
27+ .startOf (' day' );
28+
29+ for (let i = 0 ; i < props .numOfDays ; i ++ ) {
30+ if (currentDate .value .plus ({ days: i }).hasSame (today , ' day' )) {
31+ return ` ${i + 1 } / span 1 ` ;
32+ }
33+ }
34+
35+ return ' ' ;
36+ });
37+
2338const compEvents = computed (() => {
2439 const date = currentDate .value ;
2540
@@ -76,11 +91,13 @@ const compEvents = computed(() => {
7691 :color =" getTag (v .event .calendar , v .event .tagId ?? ' ' )?.color "
7792 @click =" eventModal .open (v .event )"
7893 />
94+ <div v-if =" todayGridColumn" class =" today-highlighter" :style =" { gridColumn: todayGridColumn }" />
7995 </div >
8096</template >
8197
8298<style scoped>
8399#allday-bar {
100+ position : relative ;
84101 display : grid ;
85102 grid-template-columns : repeat (v-bind( ' props.numOfDays' ), minmax (0 , 1fr ));
86103 grid-auto-rows : 1.2rem ;
@@ -90,4 +107,14 @@ const compEvents = computed(() => {
90107 gap : 2.5px ;
91108 padding-bottom : 1.5% ;
92109}
110+
111+ .today-highlighter {
112+ position : absolute ;
113+ top : 0 ;
114+ bottom : 0 ;
115+ left : -1px ;
116+ right : -1px ;
117+ background-color : color-mix(in srgb , var (--git-color-real ) 8% , transparent );
118+ pointer-events : none ;
119+ }
93120 </style >
0 commit comments