mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Sort labels in the left menu alphabetically
This commit is contained in:
parent
ec1b14796a
commit
ebbc14f841
1 changed files with 7 additions and 1 deletions
|
|
@ -203,6 +203,12 @@ function Labels(props: LibraryFilterMenuProps): JSX.Element {
|
|||
initialValue: false,
|
||||
})
|
||||
|
||||
const sortedLabels = useMemo(() => {
|
||||
return labels.sort((left: Label, right: Label) =>
|
||||
left.name.localeCompare(right.name)
|
||||
)
|
||||
}, [labels])
|
||||
|
||||
return (
|
||||
<MenuPanel
|
||||
title="Labels"
|
||||
|
|
@ -212,7 +218,7 @@ function Labels(props: LibraryFilterMenuProps): JSX.Element {
|
|||
window.location.href = '/settings/labels'
|
||||
}}
|
||||
>
|
||||
{labels.slice(0, viewAll ? undefined : 4).map((item) => {
|
||||
{sortedLabels.slice(0, viewAll ? undefined : 4).map((item) => {
|
||||
return <LabelButton key={item.id} label={item} {...props} />
|
||||
})}
|
||||
<ViewAllButton state={viewAll} setState={setViewAll} />
|
||||
|
|
|
|||
Loading…
Reference in a new issue