Always show favs first in sidebar
This commit is contained in:
parent
bf953699fd
commit
c564621e91
@ -62,15 +62,24 @@ export const sortTags = (
|
|||||||
tagToExclude?: string,
|
tagToExclude?: string,
|
||||||
) => tags
|
) => tags
|
||||||
.filter(({ tag }) => tag!== tagToExclude)
|
.filter(({ tag }) => tag!== tagToExclude)
|
||||||
.sort(({ tag: a }, { tag: b }) => isTagFavs(a) ? -1 : a.localeCompare(b));
|
.sort(({ tag: a }, { tag: b }) =>
|
||||||
|
isTagFavs(a)
|
||||||
|
? -1
|
||||||
|
: isTagFavs(b)
|
||||||
|
? 1
|
||||||
|
: a.localeCompare(b));
|
||||||
|
|
||||||
export const sortTagsByCount = (
|
export const sortTagsByCount = (
|
||||||
tags: Tags,
|
tags: Tags,
|
||||||
tagToExclude?: string,
|
tagToExclude?: string,
|
||||||
) => tags
|
) => tags
|
||||||
.filter(({ tag }) => tag !== tagToExclude)
|
.filter(({ tag }) => tag !== tagToExclude)
|
||||||
.sort(({ tag: tagA, count: a }, { count: b }) =>
|
.sort(({ tag: tagA, count: countA }, { tag: tagB, count: countB }) =>
|
||||||
isTagFavs(tagA) ? -1 : b - a);
|
isTagFavs(tagA)
|
||||||
|
? -1
|
||||||
|
: isTagFavs(tagB)
|
||||||
|
? 1
|
||||||
|
: countB - countA);
|
||||||
|
|
||||||
export const sortTagsWithoutFavs = (tags: string[]) =>
|
export const sortTagsWithoutFavs = (tags: string[]) =>
|
||||||
sortTagsArray(tags, TAG_FAVS);
|
sortTagsArray(tags, TAG_FAVS);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user