Skip to content

Commit

Permalink
[MDS-5962] Update the filtering logic for the active alerts in homepa…
Browse files Browse the repository at this point in the history
…ge (#3163)

Update the filtering logic for the active alerts to consider end_date in homepage
  • Loading branch information
isuru-aot authored Jun 20, 2024
1 parent a9f0de8 commit fb01e16
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions services/core-web/src/components/homepage/HomeMineActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import * as routes from "@/constants/routes";
import { RootState } from "@/App";
import { ActionCreator } from "@mds/common/interfaces/actionCreator";
import * as router from "@/constants/routes";
import moment from "moment";

interface HomeMineActivityProps {
subscribedMines: IMine[];
Expand Down Expand Up @@ -146,11 +147,25 @@ const HomeMineActivity: FC<HomeMineActivityProps> = ({
Here are the latest mine alerts from across CORE.
</Typography.Paragraph>

{formattedAlerts.map((alert) => (
<Skeleton loading={!alertsLoaded} active key={`global-alerts-${alert.mine_alert_guid}`}>
<GlobalMineAlert key={alert.mine_alert_guid} alert={alert} />
</Skeleton>
))}
{formattedAlerts
.filter((alert, index) => {
return (
alert.is_active &&
(alert.end_date == null ||
moment(alert.end_date)
.startOf("day")
.diff(moment().startOf("day"), "days") >= 0)
);
})
.map((alert) => (
<Skeleton
loading={!alertsLoaded}
active
key={`global-alerts-${alert.mine_alert_guid}`}
>
<GlobalMineAlert key={alert.mine_alert_guid} alert={alert} />
</Skeleton>
))}
</div>
</Col>
</Row>
Expand Down

0 comments on commit fb01e16

Please sign in to comment.