Skip to content

Commit

Permalink
new1
Browse files Browse the repository at this point in the history
  • Loading branch information
gurramkarthiknetha committed Dec 13, 2024
1 parent cd38a0c commit f4384bd
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/components/EventCalendar/EventCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ const Calendar: React.FC<InterfaceCalendarProps> = ({
): InterfaceEventListCardProps[] => {
const data: InterfaceEventListCardProps[] = [];
if (userRole === Role.SUPERADMIN) return eventData;
// Hard to test all the cases
/* istanbul ignore next */
if (userRole === Role.ADMIN) {
eventData?.forEach((event) => {
if (event.isPublic) data.push(event);
Expand Down Expand Up @@ -123,16 +121,11 @@ const Calendar: React.FC<InterfaceCalendarProps> = ({
setEvents(data);
}, [eventData, orgData, userRole, userId]);

/**
* Moves the calendar view to the previous month.
*/
const handlePrevMonth = (): void => {
/*istanbul ignore next*/
if (currentMonth === 0) {
setCurrentMonth(11);
const isJanuary = currentMonth === 0;
setCurrentMonth(isJanuary ? 11 : currentMonth - 1);
if (isJanuary) {
setCurrentYear(currentYear - 1);
} else {
setCurrentMonth(currentMonth - 1);
}
};

Expand Down

0 comments on commit f4384bd

Please sign in to comment.