feat: grey unicode icons without UI freezes

This commit is contained in:
Lauri Ojansivu 2025-12-22 23:26:30 +02:00
commit 4408eae158
9 changed files with 198 additions and 1 deletions

View file

@ -173,6 +173,13 @@ Users.attachSchema(
type: Boolean,
optional: true,
},
'profile.GreyIcons': {
/**
* per-user preference to render unicode icons in grey
*/
type: Boolean,
optional: true,
},
'profile.cardMaximized': {
/**
* has user clicked maximize card?
@ -709,6 +716,7 @@ Users.safeFields = {
'profile.initials': 1,
'profile.zoomLevel': 1,
'profile.mobileMode': 1,
'profile.GreyIcons': 1,
orgs: 1,
teams: 1,
authenticationMethod: 1,
@ -1062,6 +1070,11 @@ Users.helpers({
return profile.showDesktopDragHandles || false;
},
hasGreyIcons() {
const profile = this.profile || {};
return profile.GreyIcons || false;
},
hasCustomFieldsGrid() {
const profile = this.profile || {};
return profile.customFieldsGrid || false;
@ -1486,6 +1499,13 @@ Users.mutations({
},
};
},
toggleGreyIcons(value = false) {
return {
$set: {
'profile.GreyIcons': !value,
},
};
},
addNotification(activityId) {
return {
@ -1689,6 +1709,23 @@ Meteor.methods({
Users.update(this.userId, updateObject);
},
toggleGreyIcons(value) {
if (!this.userId) {
throw new Meteor.Error('not-logged-in', 'User must be logged in');
}
if (value !== undefined) check(value, Boolean);
const user = Users.findOne(this.userId);
if (!user) {
throw new Meteor.Error('user-not-found', 'User not found');
}
const current = (user.profile && user.profile.GreyIcons) || false;
const newValue = value !== undefined ? value : !current;
Users.update(this.userId, { $set: { 'profile.GreyIcons': newValue } });
return newValue;
},
toggleDesktopDragHandles() {
const user = ReactiveCache.getCurrentUser();
user.toggleDesktopHandles(user.hasShowDesktopDragHandles());