Skip to content

Commit

Permalink
fix: filter function
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiragSinghal2001 committed Aug 15, 2024
1 parent bb7d70d commit 8771ef9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions components/userDashboard/Bookings.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ const Bookings = () => {
const year = date.getFullYear();
return `${day} ${month} ${year}`;
};
const filterFunction = (session, activeTab) => {
return (
(activeTab.toLowerCase() === "pending" && session.isbooked) ||
(activeTab.toLowerCase() === "completed" && !session.isbooked)
);
};

// Filter sessions based on the active tab and format data for the table
const sessionData = sessions
Expand All @@ -50,13 +56,6 @@ const Bookings = () => {
time: session.sessionTime,
}));

const filterFunction = (session) => {
return (
(activeTab.toLowerCase() === "pending" && session.isbooked) ||
(activeTab.toLowerCase() === "completed" && !session.isbooked)
);
};

return (
<div className="tw-p-3 md:tw-p-8 tw-w-full">
<h1 className="tw-text-2xl sm:tw-text-3xl lg:tw-text-4xl tw-font-semibold tw-mb-4 lg:tw-mb-8">
Expand Down

0 comments on commit 8771ef9

Please sign in to comment.