Merge pull request #27568 from mareklibra/FLPATH-1841.showTotalInTitle

feat(notifications): add title to the Notifications' table
This commit is contained in:
Johan Haals
2024-11-13 09:33:26 +01:00
committed by GitHub
4 changed files with 20 additions and 2 deletions
@@ -144,6 +144,15 @@ export const NotificationsPage = (props?: NotificationsPageProps) => {
const totalCount = value?.[0]?.totalCount;
const isUnread = !!value?.[1]?.unread;
let tableTitle = `All notifications (${totalCount})`;
if (saved) {
tableTitle = `Saved notifications (${totalCount})`;
} else if (unreadOnly === true) {
tableTitle = `Unread notifications (${totalCount})`;
} else if (unreadOnly === false) {
tableTitle = `Read notifications (${totalCount})`;
}
return (
<PageWithHeader
title={title}
@@ -172,6 +181,7 @@ export const NotificationsPage = (props?: NotificationsPageProps) => {
</Grid>
<Grid item xs={10}>
<NotificationsTable
title={tableTitle}
isLoading={loading}
isUnread={isUnread}
markAsReadOnLinkOpen={markAsReadOnLinkOpen}
@@ -61,7 +61,7 @@ const useStyles = makeStyles(theme => ({
/** @public */
export type NotificationsTableProps = Pick<
TableProps,
'onPageChange' | 'onRowsPerPageChange' | 'page' | 'totalCount'
'onPageChange' | 'onRowsPerPageChange' | 'page' | 'totalCount' | 'title'
> & {
markAsReadOnLinkOpen?: boolean;
isLoading?: boolean;
@@ -74,6 +74,7 @@ export type NotificationsTableProps = Pick<
/** @public */
export const NotificationsTable = ({
title,
markAsReadOnLinkOpen,
isLoading,
notifications = [],
@@ -334,6 +335,7 @@ export const NotificationsTable = ({
header: true,
sorting: false,
}}
title={title}
onPageChange={onPageChange}
onRowsPerPageChange={onRowsPerPageChange}
page={page}