feat(modulo): sort search items

This commit is contained in:
Federico Terzi 2021-08-24 20:05:00 +02:00
parent 9b52a06a8b
commit 0cc52ccf63

View File

@ -21,7 +21,7 @@ use crate::search::config::SearchConfig;
use crate::sys::search::types; use crate::sys::search::types;
pub fn generate(config: SearchConfig) -> types::Search { pub fn generate(config: SearchConfig) -> types::Search {
let items = config let mut items: Vec<types::SearchItem> = config
.items .items
.into_iter() .into_iter()
.map(|item| types::SearchItem { .map(|item| types::SearchItem {
@ -32,6 +32,8 @@ pub fn generate(config: SearchConfig) -> types::Search {
}) })
.collect(); .collect();
items.sort_by(|a, b| a.label.as_str().cmp(b.label.as_str()));
types::Search { types::Search {
title: config.title, title: config.title,
items, items,