From d354c91d7cb4dbc4a3b7c4f18039ea40b9e81173 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 29 Mar 2023 22:40:50 +0200 Subject: [PATCH] sort icons by how much they are used, #3784 --- src/public/app/widgets/icon_list.js | 16 +++++++++ src/public/app/widgets/note_icon.js | 52 ++++++++++++++++++----------- src/routes/api/other.js | 29 ++++++++++++++++ src/routes/routes.js | 2 ++ 4 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 src/routes/api/other.js diff --git a/src/public/app/widgets/icon_list.js b/src/public/app/widgets/icon_list.js index 1ad713b10..32fe21a95 100644 --- a/src/public/app/widgets/icon_list.js +++ b/src/public/app/widgets/icon_list.js @@ -11175,6 +11175,22 @@ const icons = [ } ]; +function getIconClass(icon) { + if (icon.type_of_icon === 'LOGO') { + return `bxl-${icon.name}`; + } + else if (icon.type_of_icon === 'SOLID') { + return `bxs-${icon.name}`; + } + else { + return `bx-${icon.name}`; + } +} + +for (const icon of icons) { + icon.className = getIconClass(icon); +} + export default { categories, icons diff --git a/src/public/app/widgets/note_icon.js b/src/public/app/widgets/note_icon.js index 20bdeed79..ba2bbb683 100644 --- a/src/public/app/widgets/note_icon.js +++ b/src/public/app/widgets/note_icon.js @@ -1,5 +1,6 @@ import NoteContextAwareWidget from "./note_context_aware_widget.js"; import attributeService from "../services/attributes.js"; +import server from "../services/server.js"; const TPL = `