Skip to content

Commit

Permalink
Fix completed events loading issue after refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavberi committed Oct 31, 2024
1 parent e586dd1 commit bb5c89c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/components/events/EventCards.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export function EventCards({
events,
loading,
noEventsMessage,
loadingIndicator = true,
}) {
if (loading) {
return (
Expand All @@ -16,7 +15,7 @@ export function EventCards({
height="100%"
mt={3}
>
{loadingIndicator ? <CircularProgress /> : null}
<CircularProgress />
</Box>
);
}
Expand Down
26 changes: 16 additions & 10 deletions src/components/events/PaginatedEventGrid.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"use client";

import { useEffect, useState, useCallback, useRef } from "react";
import {
Typography,
Divider,
} from "@mui/material";
import { Typography, Divider } from "@mui/material";
import { EventCards, LoadingIndicator } from "./EventCards";

export default function PaginatedEventGrid({
Expand Down Expand Up @@ -221,12 +218,21 @@ export default function PaginatedEventGrid({
Completed Events
</Typography>
</Divider>
<EventCards
events={completedevents}
loading={loadingPast}
loadingIndicator={false}
noEventsMessage="No events found."
/>
{!loadingPast && !completedevents.length ? (
<Typography
variant="h4"
color="text.secondary"
sx={{ flexGrow: 1, textAlign: "center", mt: 5 }}
>
No events found.
</Typography>
) : (
<EventCards
events={completedevents}
loading={false}
noEventsMessage=""
/>
)}
</>
)}

Expand Down

0 comments on commit bb5c89c

Please sign in to comment.