Skip to content

Commit

Permalink
Only show spaces in sidebar which are in pageListIds
Browse files Browse the repository at this point in the history
- Only a small condition change. The other changes are simply JS cleanups
  • Loading branch information
poltak authored and blackforestboi committed Feb 15, 2024
1 parent 379899d commit 23967e0
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions src/sidebar/annotations-sidebar/components/AnnotationsSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1390,12 +1390,12 @@ export class AnnotationsSidebar extends React.Component<
: undefined
const allLists = normalizedStateToArray(lists).filter(
(listData) =>
listData.unifiedAnnotationIds?.length > 0 ||
listData.hasRemoteAnnotationsToLoad ||
(listData.type === 'page-link' &&
listData.normalizedPageUrl === normalizedPageUrl) ||
pageListIds.has(listData.unifiedId) ||
pageActiveListIds.includes(listData.unifiedId),
pageListIds.has(listData.unifiedId) &&
(listData.unifiedAnnotationIds?.length > 0 ||
listData.hasRemoteAnnotationsToLoad ||
(listData.type === 'page-link' &&
listData.normalizedPageUrl === normalizedPageUrl) ||
pageActiveListIds.includes(listData.unifiedId)),
)

if (allLists?.length === 0) {
Expand Down Expand Up @@ -1429,9 +1429,9 @@ export class AnnotationsSidebar extends React.Component<
<SpaceTypeSection>
<SpaceTypeSectionHeader>
Page Links{' '}
<SpacesCounter>{pageLinkLists?.length}</SpacesCounter>
<SpacesCounter>{pageLinkLists.length}</SpacesCounter>
</SpaceTypeSectionHeader>
{pageLinkLists?.length > 0 && (
{pageLinkLists.length > 0 && (
<SpaceTypeSectionContainer>
{pageLinkLists.map((listData) => {
this.maybeCreateContextBtnRef(listData)
Expand All @@ -1448,9 +1448,9 @@ export class AnnotationsSidebar extends React.Component<
<SpaceTypeSection>
<SpaceTypeSectionHeader>
My Spaces{' '}
<SpacesCounter>{myLists?.length}</SpacesCounter>
<SpacesCounter>{myLists.length}</SpacesCounter>
</SpaceTypeSectionHeader>
{myLists?.length > 0 ? (
{myLists.length > 0 && (
<SpaceTypeSectionContainer>
{myLists.map((listData) => {
this.maybeCreateContextBtnRef(listData)
Expand All @@ -1461,15 +1461,15 @@ export class AnnotationsSidebar extends React.Component<
)
})}
</SpaceTypeSectionContainer>
) : undefined}
)}
</SpaceTypeSection>

<SpaceTypeSection>
<SpaceTypeSectionHeader>
Followed Spaces{' '}
<SpacesCounter>{followedLists?.length}</SpacesCounter>
<SpacesCounter>{followedLists.length}</SpacesCounter>
</SpaceTypeSectionHeader>
{followedLists?.length > 0 ? (
{followedLists.length > 0 && (
<SpaceTypeSectionContainer>
{followedLists.map((listData) =>
this.renderSpacesItem(
Expand All @@ -1478,15 +1478,15 @@ export class AnnotationsSidebar extends React.Component<
),
)}
</SpaceTypeSectionContainer>
) : undefined}
)}
</SpaceTypeSection>

<SpaceTypeSection>
<SpaceTypeSectionHeader>
Joined Spaces{' '}
<SpacesCounter>{joinedLists?.length}</SpacesCounter>
<SpacesCounter>{joinedLists.length}</SpacesCounter>
</SpaceTypeSectionHeader>
{joinedLists?.length > 0 ? (
{joinedLists.length > 0 && (
<SpaceTypeSectionContainer>
{joinedLists.map((listData) =>
this.renderSpacesItem(
Expand All @@ -1495,7 +1495,7 @@ export class AnnotationsSidebar extends React.Component<
),
)}
</SpaceTypeSectionContainer>
) : undefined}
)}
</SpaceTypeSection>
</>
)
Expand Down Expand Up @@ -3459,9 +3459,8 @@ export class AnnotationsSidebar extends React.Component<
),
)}

{this.props.activeTab === 'spaces' && (
<>{this.renderSharedNotesByList()}</>
)}
{this.props.activeTab === 'spaces' &&
this.renderSharedNotesByList()}
</AnnotationsSectionStyled>
)}
<UpdateNotifBanner
Expand Down Expand Up @@ -5881,7 +5880,7 @@ const FollowedListRow = styled(Margin)<{
cursor: pointer;
border-radius: 8px;
height: 44px;
padding: 0px 15px 0px 10px;
z-index: ${(props) => 1000 - props.zIndex};
Expand Down

0 comments on commit 23967e0

Please sign in to comment.