Skip to content

Commit 1541dbb

Browse files
committed
➕ ADDS: unseen_count on Lists dropdown
1 parent e062588 commit 1541dbb

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

client/layout/sidebar/expandable-heading.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { decodeEntities } from 'calypso/lib/formatting';
1010
const ExpandableSidebarHeading = ( {
1111
title,
1212
count,
13+
compactCount,
1314
icon,
1415
customIcon,
1516
materialIcon,
@@ -42,7 +43,7 @@ const ExpandableSidebarHeading = ( {
4243
{ undefined !== customIcon && customIcon }
4344
<span className="sidebar__expandable-title">
4445
{ decodeEntities( title ) }
45-
{ undefined !== count && <Count count={ count } /> }
46+
{ undefined !== count && <Count count={ count } compact={ compactCount } /> }
4647
{ inlineText && <span className="sidebar__inline-text">{ inlineText }</span> }
4748
</span>
4849
{ appendContent }
@@ -74,6 +75,7 @@ const ExpandableSidebarHeading = ( {
7475
ExpandableSidebarHeading.propTypes = {
7576
title: PropTypes.oneOfType( [ TranslatableString, PropTypes.element ] ).isRequired,
7677
count: PropTypes.number,
78+
compactCount: PropTypes.bool,
7779
onClick: PropTypes.func,
7880
customIcon: PropTypes.node,
7981
icon: PropTypes.string,

client/layout/sidebar/expandable.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const ExpandableSidebarMenu = ( menuProps ) => {
4141
className,
4242
title,
4343
count,
44+
compactCount,
4445
onClick,
4546
icon,
4647
materialIcon,
@@ -112,6 +113,7 @@ export const ExpandableSidebarMenu = ( menuProps ) => {
112113
<ExpandableSidebarHeading
113114
title={ title }
114115
count={ count }
116+
compactCount={ compactCount }
115117
onClick={ ( event ) => {
116118
setSubmenuHovered( false );
117119
onClick( event );
@@ -144,6 +146,7 @@ ExpandableSidebarMenu.propTypes = {
144146
className: PropTypes.string,
145147
title: PropTypes.oneOfType( [ TranslatableString, PropTypes.element ] ).isRequired,
146148
count: PropTypes.number,
149+
compactCount: PropTypes.bool,
147150
onClick: PropTypes.func,
148151
customIcon: PropTypes.node,
149152
icon: PropTypes.string,

client/reader/sidebar/reader-sidebar-lists/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface ReaderSidebarListsProps {
1717
}
1818

1919
const ReaderSidebarLists = ( {
20+
lists,
2021
isOpen,
2122
onClick,
2223
path,
@@ -30,17 +31,22 @@ const ReaderSidebarLists = ( {
3031
recordReaderTracksEvent( 'calypso_reader_sidebar_lists_dropdown_title_clicked' );
3132
}
3233

34+
const totalUnseenCount: number =
35+
lists?.reduce( ( total, list ) => total + ( list.unseen_count ?? 0 ), 0 ) || 0;
36+
3337
return (
3438
<li>
3539
<ExpandableSidebarMenu
36-
expanded={ isOpen }
40+
expanded={ isOpen ?? false }
3741
title={ translate( 'Lists' ) }
42+
count={ totalUnseenCount }
43+
compactCount
3844
onClick={ navigateToLists }
3945
disableFlyout
4046
className={ path === '/reader/lists' ? 'sidebar__menu--selected' : '' }
4147
expandableIconClick={ onClick }
4248
>
43-
<ReaderSidebarListsList path={ path } { ...passedProps } />
49+
<ReaderSidebarListsList path={ path } lists={ lists } { ...passedProps } />
4450
</ExpandableSidebarMenu>
4551
</li>
4652
);

0 commit comments

Comments
 (0)