Skip to content

Commit

Permalink
Fix subtitle pluralization in search
Browse files Browse the repository at this point in the history
  • Loading branch information
jmetrikat committed Feb 14, 2025
1 parent 84c28b8 commit 56245e9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/search-anytype.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ function Search() {
)
.map((object) => processObjectWithSpaceIcon(object, false));

const subtitle = pluralize(processedRegularObjects.length, viewType.replace(/s$/, ""), {
withNumber: true,
});

return (
<List
isLoading={isLoadingSpaces || isLoadingPinnedObjects || isLoadingObjects}
Expand All @@ -182,10 +186,7 @@ function Search() {
}
>
{processedPinnedObjects.length > 0 && (
<List.Section
title="Pinned"
subtitle={`${pluralize(processedPinnedObjects.length, viewType, { withNumber: true })}`}
>
<List.Section title="Pinned" subtitle={subtitle}>
{processedPinnedObjects.map((object) => (
<ObjectListItem
key={object.key}
Expand All @@ -206,10 +207,7 @@ function Search() {
</List.Section>
)}
{processedRegularObjects.length > 0 ? (
<List.Section
title={searchText ? "Search Results" : `${getShortDateLabel()} Recently`}
subtitle={`${pluralize(processedRegularObjects.length, viewType, { withNumber: true })}`}
>
<List.Section title={searchText ? "Search Results" : `${getShortDateLabel()} Recently`} subtitle={subtitle}>
{processedRegularObjects.map((object) => (
<ObjectListItem
key={object.key}
Expand Down

0 comments on commit 56245e9

Please sign in to comment.