mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-12 18:20:28 +03:00
Emoji ordering in emoji board (#2057)
* feat: sort emojis inside emoji picker * feat: sort autocomplete emojis Fixes #1632 * fix: sort function after concat * fix: sort result instead of searchList
This commit is contained in:
parent
35f0e400ad
commit
b8d9c4bdd6
2 changed files with 10 additions and 8 deletions
|
|
@ -57,14 +57,16 @@ export function EmoticonAutocomplete({
|
|||
|
||||
const searchList = useMemo(() => {
|
||||
const list: Array<EmoticonSearchItem> = [];
|
||||
return list.concat(
|
||||
imagePacks.flatMap((pack) => pack.getImagesFor(PackUsage.Emoticon)),
|
||||
emojis
|
||||
);
|
||||
return list
|
||||
.concat(
|
||||
imagePacks.flatMap((pack) => pack.getImagesFor(PackUsage.Emoticon)),
|
||||
emojis
|
||||
)
|
||||
}, [imagePacks]);
|
||||
|
||||
const [result, search, resetSearch] = useAsyncSearch(searchList, getEmoticonStr, SEARCH_OPTIONS);
|
||||
const autoCompleteEmoticon = result ? result.items : recentEmoji;
|
||||
const autoCompleteEmoticon = (result ? result.items : recentEmoji)
|
||||
.sort((a, b) => a.shortcode.localeCompare(b.shortcode));
|
||||
|
||||
useEffect(() => {
|
||||
if (query.text) search(query.text);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue