Allow plugins to add custom icons

This commit is contained in:
yflory 2025-10-01 18:25:37 +02:00
parent af522fd0fe
commit 6943524d5c
3 changed files with 10 additions and 14 deletions

View File

@ -1,8 +1,7 @@
define([
'jquery',
'/common/hyperscript.js',
'/customize/lucide.js'
], function ($, h, Lucide) {
], function (h, Lucide) {
const Icons = {};
const map = {
@ -243,19 +242,17 @@ define([
"badge-moderator": "life-buoy",
"badge-premium": "ticket-check",
"badge-error": "circle-alert",
// Accounts
"pricing": "circle-star",
"subscribe": "ticket",
"trophy": "trophy",
"credit-card": "credit-card",
"circle-left": "circle-chevron-left",
"user": "user-round",
"notebook":"notepad-text",
"sso": "id-card",
// Other
"maintenance": "construction",
"release-notes": "notepad-text"
};
Icons.add = (newIcons) => {
Object.keys(newIcons).forEach(k => {
map[k] = newIcons[k];
});
};
Icons.get = (name, attrs = {}) => {
if (!map[name]) {
alert(`Invalid icon: ${name}`);

View File

@ -11,7 +11,6 @@ define([
'/components/chainpad/chainpad.dist.js',
'/common/common-realtime.js',
'/common/common-constants.js',
'/common/common-interface.js',
'/common/common-feedback.js',
'/common/outer/local-store.js',
'/customize/messages.js',
@ -22,7 +21,7 @@ define([
'/components/tweetnacl/nacl-fast.min.js',
'/components/scrypt-async/scrypt-async.min.js', // better load speed
], function (Listmap, Crypto, Util, NetConfig, Cred, ChainPad, Realtime, Constants, UI,
], function (Listmap, Crypto, Util, NetConfig, Cred, ChainPad, Realtime, Constants,
Feedback, LocalStore, Messages, nThen, Block, Hash, ServerCommand) {
var Nacl = window.nacl;

View File

@ -17,7 +17,7 @@ define([
'/common/events-channel.js',
'/common/outer/login-block.js',
'/common/common-credential.js',
'/customize/login.js',
'/common/common-login.js',
'/common/store-interface.js',
'/common/pad-types.js',