Skip to content
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

feat: add new options to Time Reference filter #645

Merged
merged 1 commit into from
Feb 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
10 changes: 10 additions & 0 deletions src/components/Event/ListEvents/ListEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ const dateItems = [
description: "",
value: EventTimeReference.NEXT_MONTH,
},
{
title: EventTimeReference.NEXT_90_DAYS,
description: "",
value: EventTimeReference.NEXT_90_DAYS,
},
{
title: EventTimeReference.NEXT_120_DAYS,
description: "",
value: EventTimeReference.NEXT_120_DAYS,
},
]

export const ListEvents = React.memo((props: ListEventsProps) => {
Expand Down
2 changes: 2 additions & 0 deletions src/entities/Event/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ export enum EventTimeReference {
TOMORROW = "Tomorrow",
NEXT_WEEK = "Next 7 days",
NEXT_MONTH = "Next 30 days",
NEXT_90_DAYS = "Next 90 days",
NEXT_120_DAYS = "Next 120 days",
}

export const MAX_CATAGORIES_ALLOWED = 1
Expand Down
4 changes: 4 additions & 0 deletions src/hooks/useListEventsFiltered.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export default function useListEventsFiltered(
return eventDate.isSameOrBefore(eventCompareDate.add(1, "week"))
} else if (timeReference === EventTimeReference.NEXT_MONTH) {
return eventDate.isSameOrBefore(eventCompareDate.add(1, "month"))
} else if (timeReference === EventTimeReference.NEXT_90_DAYS) {
return eventDate.isSameOrBefore(eventCompareDate.add(3, "month"))
} else if (timeReference === EventTimeReference.NEXT_120_DAYS) {
return eventDate.isSameOrBefore(eventCompareDate.add(4, "month"))
}
return false
})
Expand Down
Loading