Skip to content

Bug: Fixed regression from the fix made in #146 #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/frontendmu-nuxt/components/cards/EventCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<template v-if="event.Date">
<div :class="[
!isUpcoming(event.Date) ? 'text-green-600 font-bold' : 'text-verse-900 dark:text-verse-300',
isUpcoming(event.Date) ? 'text-green-600 font-bold' : 'text-verse-900 dark:text-verse-300',
'flex flex-col font-mono text-sm font-medium gap-2 w-full justify-between',
]">

Expand Down
18 changes: 2 additions & 16 deletions packages/frontendmu-nuxt/components/cards/EventTilt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@ const props = defineProps({
},
});

const dateInPast = function (firstDate: Date, secondDate: Date) {
if (firstDate.setHours(0, 0, 0, 0) <= secondDate.setHours(0, 0, 0, 0)) {
return true;
}
return false;
};

const isUpcoming = (currentEventDate: string) => {
const past = new Date(currentEventDate);
const today = new Date();
const verifyValue = dateInPast(past, today);
return verifyValue;
};

const tiltOptions = {
reverse: false,
speed: 1000,
Expand All @@ -46,8 +32,8 @@ const tiltOptions = {

<div class="flex flex-col md:flex-row w-full justify-between gap-4 border-gray-100">
<span v-if="props.event.Date" class="inline-flex rounded-lg p-3 ring-4 ring-white dark:ring-white/10" :class="isUpcoming(props.event.Date)
? 'bg-gray-50 text-gray-700'
: 'bg-green-50 text-green-600 font-bold dark:bg-verse-900'
? 'bg-green-50 text-green-600 font-bold dark:bg-verse-900'
: 'bg-gray-50 text-gray-700'
">
<Icon name="carbon:calendar" class="mr-2 h-6 w-6" />
<span>{{ new Date(props.event.Date).toDateString() }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<div v-if="event.Date" class="">
<span :title="isUpcoming(event.Date) ? 'Upcoming' : 'Past'" :class="[
isUpcoming(event.Date)
? 'bg-gray-50 dark:bg-transparent text-verse-500 dark:text-verse-400 dark:font-bold'
: 'bg-green-50 text-green-600 font-bold',
? 'bg-green-50 text-green-600 font-bold'
: 'bg-gray-50 dark:bg-transparent text-verse-500 dark:text-verse-400 dark:font-bold',
'inline-flex rounded-lg p-[0.35rem] md:p-3 font-mono text-sm font-medium items-center',
]">
<Icon name="carbon:calendar" class="mr-2 h-6 w-6" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const props = defineProps({
class="mt-4 md:mt-0 relative rounded-xl flex flex-col gap-2 group bg-white dark:bg-verse-700/40 p-6 shadow-md transition-all hover:shadow-lg">
<div v-if="event.Date" class="">
<span class="inline-flex rounded-lg p-3 ring-4 ring-white dark:ring-white/5" :class="isUpcoming(event.Date)
? 'bg-gray-50 text-gray-700 '
: 'bg-verse-50 text-verse-600 dark:text-verse-400 font-bold dark:bg-verse-900/10'
? 'bg-verse-50 text-verse-600 dark:text-verse-400 font-bold dark:bg-verse-900/10'
: 'bg-gray-50 text-gray-700'
">
<div class="mr-2 h-6 w-6">
<Icon name="carbon:calendar" />
Expand Down
24 changes: 13 additions & 11 deletions packages/frontendmu-nuxt/composables/useMeetups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ export default function useMeetups() {
return acc;
}, {}));

const sortedMeetups = computed(() => {
return (allMeetups || []).sort((a, b) => {
return (
new Date(b.Date).getTime() - new Date(a.Date).getTime()
);
});
})

function upcomingMeetups() {
if (!allMeetups) return [];
const sortedData = allMeetups.sort((a, b) => {
return new Date(b.Date).getTime() - new Date(a.Date).getTime();
});

return sortedData.filter((item) => {
return !isUpcoming(item.Date);
return sortedMeetups.value.filter((item) => {
return isUpcoming(item.Date);
});
};

Expand All @@ -29,15 +34,12 @@ export default function useMeetups() {

const pastMeetups = computed(() => {
if (!allMeetups) return [];
const sortedData = allMeetups.sort((a, b) => {
return new Date(b.Date).getTime() - new Date(a.Date).getTime();
});

const withoutUpcoming = sortedData.filter((item) => {
return isUpcoming(item.Date);
const pastMeetupsData = sortedMeetups.value.filter((item) => {
return !isUpcoming(item.Date);
});

return withoutUpcoming.slice(0, 10);
return pastMeetupsData.slice(0, 10);
})


Expand Down
Loading