change tree attribute to be called badge

This commit is contained in:
milan 2024-03-07 16:25:07 +01:00
parent a572815fdb
commit 556757ae5d
2 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,7 @@ export type TreeItemData = SelectOption & {
tooltip: String, tooltip: String,
userdata: any[] userdata: any[]
//here we can store the number of unread messages, if there are any //here we can store the number of unread messages, if there are any
unreadMessages?: number; badge?: String;
} }
/** /**
@ -343,9 +343,9 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
this.onselect = _handler; this.onselect = _handler;
} }
public set_unreadCounter(_id: string, _value: number) public set_badge(_id: string, _value: string)
{ {
this.getNode(_id).unreadMessages = _value; this.getNode(_id).badge = _value;
this.requestUpdate(); this.requestUpdate();
} }
@ -697,9 +697,9 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
<span class="tree-item__label"> <span class="tree-item__label">
${selectOption.label ?? selectOption.text} ${selectOption.label ?? selectOption.text}
</span> </span>
${selectOption.unreadMessages ? ${selectOption.badge ?
html` html`
<sl-badge pill variant="danger">${selectOption.unreadMessages}</sl-badge> <sl-badge pill variant="danger">${selectOption.badge}</sl-badge>
` : nothing} ` : nothing}
${selectOption.children ? repeat(selectOption.children, this._optionTemplate) : (selectOption.item ? repeat(selectOption.item, this._optionTemplate) : nothing)} ${selectOption.children ? repeat(selectOption.children, this._optionTemplate) : (selectOption.item ? repeat(selectOption.item, this._optionTemplate) : nothing)}

View File

@ -1949,7 +1949,7 @@ app.classes.mail = AppJS.extend(
// display folder-name bold for unseen mails // display folder-name bold for unseen mails
if(_status[folderId]["unseenCount"]) if(_status[folderId]["unseenCount"])
{ {
ftree.set_unreadCounter(folderId,_status[folderId]["unseenCount"]); ftree.set_badge(folderId,_status[folderId]["unseenCount"]);
ftree.setStyle(folderId, 'font-weight: bold !important'); ftree.setStyle(folderId, 'font-weight: bold !important');
} }