enh: sort functions list by type

This commit is contained in:
Timothy Jaeryang Baek 2024-11-13 21:22:13 -08:00
parent 9cdd66ca59
commit f5f2215348

View File

@ -50,12 +50,14 @@
let showDeleteConfirm = false; let showDeleteConfirm = false;
let filteredItems = []; let filteredItems = [];
$: filteredItems = $functions.filter( $: filteredItems = $functions
.filter(
(f) => (f) =>
query === '' || query === '' ||
f.name.toLowerCase().includes(query.toLowerCase()) || f.name.toLowerCase().includes(query.toLowerCase()) ||
f.id.toLowerCase().includes(query.toLowerCase()) f.id.toLowerCase().includes(query.toLowerCase())
); )
.sort((a, b) => a.type.localeCompare(b.type) || a.name.localeCompare(b.name));
const shareHandler = async (func) => { const shareHandler = async (func) => {
const item = await getFunctionById(localStorage.token, func.id).catch((error) => { const item = await getFunctionById(localStorage.token, func.id).catch((error) => {