File tree Expand file tree Collapse file tree 4 files changed +8
-4
lines changed
Expand file tree Collapse file tree 4 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ loadMoreLabel | Text to be shown on the bottom load more component | string | "L
9999hideHeader | Flag to hide or show the header | boolean | false |
100100hideClearAll | Flag to hide or show the clear all button | boolean | false |
101101darkMode | Flag to enable dark mode | boolean | false |
102+ itemsPerFetch | Number of notifications fetch per api request (have a max cap of 50) | number | 20 |
102103windowViewOnly | Flag to enable window view | boolean | false |
103104notificationIcon | Option to use custom notification Icon | JSX Element | null |
104105noOfNotificationsPerFetch | Number of notifications to fetch per page | number | 10 |
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { useSirenContext } from "./SirenProvider";
66import type { SirenProps } from "../types" ;
77import { Constants } from "../utils" ;
88import { applyTheme , calculateModalPosition } from "../utils/commonUtils" ;
9- import { BadgeType , ThemeMode } from "../utils/constants" ;
9+ import { BadgeType , MAXIMUM_ITEMS_PER_FETCH , ThemeMode } from "../utils/constants" ;
1010import "../styles/sirenInbox.css" ;
1111
1212const { DEFAULT_WINDOW_TITLE } = Constants ;
@@ -55,8 +55,10 @@ const SirenInbox: FC<SirenProps> = ({
5555 customNotificationCard,
5656 onNotificationCardClick,
5757 onError,
58- noOfNotificationsPerFetch = 10 ,
58+ itemsPerFetch = 20 ,
5959} ) => {
60+ const notificationsPerPage =
61+ itemsPerFetch > MAXIMUM_ITEMS_PER_FETCH ? MAXIMUM_ITEMS_PER_FETCH : itemsPerFetch ;
6062 const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
6163 const { siren } = useSirenContext ( ) ;
6264 const iconRef = useRef < HTMLDivElement > ( null ) ;
@@ -155,7 +157,7 @@ const SirenInbox: FC<SirenProps> = ({
155157 < SirenPanel
156158 title = { title }
157159 styles = { styles }
158- noOfNotificationsPerFetch = { noOfNotificationsPerFetch }
160+ noOfNotificationsPerFetch = { notificationsPerPage }
159161 hideHeader = { hideHeader }
160162 cardProps = { cardProps }
161163 customFooter = { customFooter }
Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ export type SirenInboxProps = {
1313 hideHeader ?: boolean ;
1414 hideClearAll ?: boolean ;
1515 darkMode ?: boolean ;
16+ itemsPerFetch ?: number ;
1617 cardProps ?: CardProps ;
1718 listEmptyComponent ?: JSX . Element ;
1819 loadMoreComponent ?:JSX . Element ;
1920 customFooter ?: JSX . Element ;
2021 customHeader ?: JSX . Element ;
2122 customLoader ?: JSX . Element ;
2223 customErrorWindow ?: JSX . Element ;
23- noOfNotificationsPerFetch ?: number ;
2424 customNotificationCard ?: ( notification : NotificationDataType ) => JSX . Element ;
2525 onNotificationCardClick ?: ( notification : NotificationDataType ) => void ;
2626 onError ?: ( error : SirenErrorType ) => void ;
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ export const DEFAULT_WINDOW_TITLE = "Notifications";
101101export const RETRY_BUTTON_LABEL = "Retry" ;
102102export const CLEAR_ALL_LABEL = "Clear All" ;
103103export const TOKEN_VERIFICATION_FAILED = 'TOKEN_VERIFICATION_FAILED' ;
104+ export const MAXIMUM_ITEMS_PER_FETCH = 50 ;
104105
105106export const errorMap = {
106107 SIREN_OBJECT_NOT_FOUND : {
You can’t perform that action at this time.
0 commit comments