Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 1x 1x 3x 3x 3x 8x 1x 2x 2x 2x 3x | import { Box, Stack } from "@mui/material";
import { GiveNotificationItem } from "./components/GiveNotificationItem";
import Header from "./components/Header";
import { TReceiver } from "./GiveNotificationCenterTypes";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import MobileSkeleton from "./components/Skeletons/MobileSkeleton";
import DesktopSkeleton from "./components/Skeletons/DesktopSkeleton";
import GiveMotionWrapper from "@shared/Motion/GiveMotionWrapper";
import useNotificationTab from "@components/ProfileMenu/modals/hooks/useNotificationTab";
import { styled } from "@theme/v2/Provider";
const INITIAL_TAB = "submerchant";
type Props = {
setDisabled: React.Dispatch<React.SetStateAction<boolean>>;
};
const GiveNotificationsCenter = ({ setDisabled }: Props) => {
const {
tabs,
activeTab,
setActiveTab,
customData,
isLoading,
handleChange,
handleCheckAll,
handleSubmit,
} = useNotificationTab({ setIsDisabled: setDisabled });
const alerts = customData?.alerts;
return (
<form id="account-profile-form" onSubmit={handleSubmit}>
<Stack display="flex" flexDirection="column">
<Header
tabs={tabs}
setCurrentTab={
setActiveTab as React.Dispatch<React.SetStateAction<TReceiver>>
}
currentTab={activeTab?.value || INITIAL_TAB}
isLoading={isLoading}
handleCheckAll={handleCheckAll}
totalAssigned={customData?.totalAssigned}
alerts={customData?.alerts}
/>
<AlertsContainer>
{isLoading ? (
<CheckboxesSkeleton />
) : (
alerts?.map((alert, idx) => (
<GiveMotionWrapper key={idx} delay={(idx + 1) * 50}>
<GiveNotificationItem
alert={alert}
handleChange={handleChange}
/>
</GiveMotionWrapper>
))
)}
</AlertsContainer>
</Stack>
</form>
);
};
export default GiveNotificationsCenter;
const CheckboxesSkeleton = () => {
const { isMobileView } = useCustomThemeV2();
Iif (isMobileView) {
return <MobileSkeleton />;
}
return <DesktopSkeleton />;
};
const AlertsContainer = styled(Box)(() => ({
display: "flex",
flexDirection: "column",
gap: "24px",
alignItems: "center",
marginTop: "24px",
width: "100%",
}));
|