Skip to content

Commit d1342b5

Browse files
committed
Implemented review suggestions
1 parent 78c3af3 commit d1342b5

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

packages/frontendmu-nuxt/components/cards/EventCard.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ const photoAlbumSource = appConfig.photoAlbumSource as string
1313
interface Props {
1414
event: Meetup
1515
isNextMeetup: boolean
16-
isMeetupToday?: boolean
16+
isMeetupToday: boolean
1717
}
1818
19+
const isHighlightedEvent = computed(() =>
20+
(!areThereMeetupsToday && isNextMeetup) || isMeetupToday,
21+
)
22+
1923
function hasAlbum() {
2024
return Boolean(event && event.album && event?.album.toString() === 'null')
2125
}
@@ -57,7 +61,7 @@ function formatDate(date: Date, formatString: string) {
5761
class="group group/event in-card bg-white dark:bg-verse-700/30 dark:backdrop-blur-sm border-2 rounded-xl overflow-hidden hover:border-verse-500 transition-all duration-300"
5862
:class="[
5963
event?.album ? 'col-span-2 md:col-span-1' : 'md:col-span-1 col-span-2',
60-
(!areThereMeetupsToday && isNextMeetup) || isMeetupToday ? 'border-green-600 dark:border-green-500' : 'border-verse-50 dark:border-white/10 ',
64+
isHighlightedEvent ? 'border-green-600 dark:border-green-500' : 'border-verse-50 dark:border-white/10 ',
6165
]"
6266
>
6367
<div
@@ -105,7 +109,10 @@ function formatDate(date: Date, formatString: string) {
105109
</template>
106110

107111
<template v-if="isMeetupToday">
108-
<span class="flex flex-row items-center gap-1 text-sm font-mono justify-end text-red-800 dark:text-red-300 ps-2 pe-3 rounded-md font-bold outline outline-1">
112+
<span
113+
aria-label="This meetup is happening today"
114+
class="flex flex-row items-center gap-1 text-sm font-mono justify-end text-red-800 dark:text-red-300 ps-2 pe-3 rounded-md font-bold outline outline-1"
115+
>
109116
<Icon name="fad:armrecording" size="0.875em" class="motion-safe:animate-pulse" />
110117
<span>TODAY</span>
111118
</span>

packages/frontendmu-nuxt/utils/helpers.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ export function getGithubUrl(username?: string) {
9696
return speaker_photo
9797
}
9898

99+
/**
100+
* Returns the timestamp in milliseconds for the given date at midnight.
101+
* @param {Date} date - The date to convert
102+
* @returns {number} Timestamp in milliseconds
103+
*/
99104
function dateAtMidnightInMs(date: Date) {
100105
const clonedDate = new Date(date)
101106

@@ -104,14 +109,32 @@ function dateAtMidnightInMs(date: Date) {
104109
return clonedDate.getTime()
105110
}
106111

112+
/**
113+
* Checks if the given date is in the future relative to the reference date.
114+
* @param {Date} date - The date to check
115+
* @param {Date} now - The reference date (defaults to the current date)
116+
* @returns {boolean} True if the date is in the future, false otherwise
117+
*/
107118
export function isDateInFuture(date: Date, now: Date = new Date()) {
108119
return dateAtMidnightInMs(date) > dateAtMidnightInMs(now)
109120
}
110121

122+
/**
123+
* Checks if the given date is in the past relative to the reference date.
124+
* @param {Date} date - The date to check
125+
* @param {Date} now - The reference date (defaults to the current date)
126+
* @returns {boolean} True if the date is in the past, false otherwise
127+
*/
111128
export function isDateInPast(date: Date, now: Date = new Date()) {
112129
return dateAtMidnightInMs(date) < dateAtMidnightInMs(now)
113-
};
130+
}
114131

132+
/**
133+
* Checks if the given date is the same as the reference date.
134+
* @param {Date} date - The date to check
135+
* @param {Date} now - The reference date (defaults to the current date)
136+
* @returns {boolean} True if the date is the same as the reference date, false otherwise
137+
*/
115138
export function isDateToday(date: Date, now: Date = new Date()) {
116139
return dateAtMidnightInMs(date) === dateAtMidnightInMs(now)
117-
};
140+
}

0 commit comments

Comments
 (0)