fix(monitors): PR feedback -layout rhythm, pagination memory leak, error alerts, and mobile cards

This commit is contained in:
ashu130698 committed 2026-05-14 15:46:33 +05:30
1 parent 010ef9661f
commit 656c04d0e4
4 files changed
+28 -41

No files matched your search

@@ -7,6 +7,7 @@ import Typography from "@mui/material/Typography";
import IconButton from "@mui/material/IconButton";
import Slide from "@mui/material/Slide";
import { X } from "lucide-react";
import { LAYOUT } from "@/Utils/Theme/constants";
interface FloatingActionBarProps {
selectedCount: number;
@@ -34,31 +35,32 @@ export const FloatingActionBar: React.FC<FloatingActionBarProps> = ({
elevation={6}
sx={{
position: "fixed",
bottom: theme.spacing(4),
bottom: theme.spacing(LAYOUT.XS),
left: "50%",
transform: "translateX(-50%)",
zIndex: theme.zIndex.snackbar,
padding: theme.spacing(1.5, 3),
px: LAYOUT.MD,
py: LAYOUT.XS,
borderRadius: theme.shape.borderRadius,
backgroundColor: theme.palette.background.paper,
border: `1px solid ${theme.palette.divider}`,
display: "flex",
alignItems: "center",
gap: theme.spacing(4),
gap: LAYOUT.XS,
boxShadow: theme.shadows[8],
}}
>
<Stack
direction="row"
alignItems="center"
gap={theme.spacing(1)}
gap={LAYOUT.XS}
>
<Typography
variant="body1"
fontWeight={600}
color={theme.palette.text.primary}
>
{selectedCount} {t("common.selected", { defaultValue: "selected" })}
{selectedCount} {t("common.selected")}
</Typography>
<IconButton
size="small"
@@ -73,7 +75,7 @@ export const FloatingActionBar: React.FC<FloatingActionBarProps> = ({
<Stack
direction="row"
alignItems="center"
gap={theme.spacing(2)}
gap={LAYOUT.XS}
>
{children}
</Stack>
@@ -6,6 +6,7 @@ import Stack from "@mui/material/Stack";
import RadioGroup from "@mui/material/RadioGroup";
import MenuItem from "@mui/material/MenuItem";
import Typography from "@mui/material/Typography";
import Alert from "@mui/material/Alert";
import { useGet, usePatch } from "@/Hooks/UseApi";
import type { Notification } from "@/Types/Notification";
@@ -37,7 +38,7 @@ export const BulkEditNotificationsModal: React.FC<BulkEditNotificationsModalProp
}
);
const { patch, loading: isPatching } = usePatch();
const { patch, loading: isPatching, error } = usePatch();
// Reset state when modal opens
useEffect(() => {
@@ -65,9 +66,7 @@ export const BulkEditNotificationsModal: React.FC<BulkEditNotificationsModalProp
return (
<Dialog
open={open}
title={t("pages.common.monitors.bulkEdit.title", {
defaultValue: "Edit Notifications",
})}
title={t("pages.common.monitors.bulkEdit.title")}
onCancel={onClose}
onConfirm={isMissingSelection ? undefined : handleConfirm}
loading={isPatching}
@@ -78,10 +77,10 @@ export const BulkEditNotificationsModal: React.FC<BulkEditNotificationsModalProp
spacing={theme.spacing(4)}
mt={theme.spacing(2)}
>
{error && <Alert severity="error">{error}</Alert>}
<Typography variant="body1">
{t("pages.common.monitors.bulkEdit.selectedText", {
count: selectedMonitors.length,
defaultValue: `You are applying changes to {{count}} monitor(s).`,
})}
</Typography>
@@ -91,31 +90,18 @@ export const BulkEditNotificationsModal: React.FC<BulkEditNotificationsModalProp
>
<RadioWithDescription
value="add"
label={t("pages.common.monitors.bulkEdit.actionAdd", { defaultValue: "Add" })}
description={t("pages.common.monitors.bulkEdit.actionAddDesc", {
defaultValue:
"Adds the selected notifications to these monitors without removing existing ones.",
})}
label={t("pages.common.monitors.bulkEdit.actionAdd")}
description={t("pages.common.monitors.bulkEdit.actionAddDesc")}
/>
<RadioWithDescription
value="remove"
label={t("pages.common.monitors.bulkEdit.actionRemove", {
defaultValue: "Remove",
})}
description={t("pages.common.monitors.bulkEdit.actionRemoveDesc", {
defaultValue:
"Removes exclusively the selected notifications from these monitors.",
})}
label={t("pages.common.monitors.bulkEdit.actionRemove")}
description={t("pages.common.monitors.bulkEdit.actionRemoveDesc")}
/>
<RadioWithDescription
value="set"
label={t("pages.common.monitors.bulkEdit.actionSet", {
defaultValue: "Replace all",
})}
description={t("pages.common.monitors.bulkEdit.actionSetDesc", {
defaultValue:
"Replaces all existing notifications. Leave empty to clear all notifications.",
})}
label={t("pages.common.monitors.bulkEdit.actionSet")}
description={t("pages.common.monitors.bulkEdit.actionSetDesc")}
/>
</RadioGroup>
@@ -123,12 +109,8 @@ export const BulkEditNotificationsModal: React.FC<BulkEditNotificationsModalProp
multiple
value={notificationIds}
onChange={(e) => setNotificationIds(e.target.value as string[])}
fieldLabel={t("pages.common.monitors.bulkEdit.selectLabel", {
defaultValue: "Notification Channels",
})}
placeholder={t("pages.common.monitors.bulkEdit.selectPlaceholder", {
defaultValue: "Select channels...",
})}
fieldLabel={t("pages.common.monitors.bulkEdit.selectLabel")}
placeholder={t("pages.common.monitors.bulkEdit.selectPlaceholder")}
>
{notifications?.map((n) => (
<MenuItem
@@ -14,6 +14,7 @@ import { ArrowDown, ArrowUp } from "lucide-react";
import { useTranslation } from "react-i18next";
import { useTheme } from "@mui/material/styles";
import useMediaQuery from "@mui/material/useMediaQuery";
import { useNavigate } from "react-router-dom";
import { usePost } from "@/Hooks/UseApi";
import { useSelector } from "react-redux";
@@ -44,9 +45,6 @@ export const MonitorTable = ({
monitors,
refetch,
setSelectedMonitor,
selectedMonitors,
onSelectMonitor,
onSelectAll,
sortField,
setSortField,
sortOrder,
@@ -61,6 +59,7 @@ export const MonitorTable = ({
}: MonitorTableProps) => {
const { t } = useTranslation();
const theme = useTheme();
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
const navigate = useNavigate();
const chartType = useSelector((state: RootState) => state.ui?.chartType ?? "histogram");
const { post } = usePost<Record<string, never>, Monitor>();
+6 -2
View File
@@ -236,8 +236,10 @@ const UptimeMonitorsPage = () => {
refetch={refetch}
setSelectedMonitor={setSelectedMonitor}
count={count || 0}
page={page}
setPage={setPage}
setPage={(newPage) => {
setPage(newPage);
setSelectedRows([]);
}}
rowsPerPage={rowsPerPage}
sortField={sortField}
setSortField={setSortField}
@@ -251,6 +253,7 @@ const UptimeMonitorsPage = () => {
})
);
setPage(0);
setSelectedRows([]);
}}
selectedRows={selectedRows}
onSelectionChange={setSelectedRows}
@@ -263,6 +266,7 @@ const UptimeMonitorsPage = () => {
onCancel={handleCancel}
loading={isDeleting}
/>
<BulkEditNotificationsModal
open={isBulkEditModalOpen}
onClose={() => setIsBulkEditModalOpen(false)}