diff --git a/dist/index.js b/dist/index.js index 39f6bab3..1d8ea4ed 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5596,6 +5596,19 @@ ); } + // src/View/Components/deletableListItem.tsx + function DeletableListItem(coreViewModel2, text, primaryButton, ondelete) { + return /* @__PURE__ */ createElement("div", { class: "tile flex-row justify-apart align-center padding-0" }, /* @__PURE__ */ createElement("span", { class: "padding-h ellipsis" }, text), /* @__PURE__ */ createElement("div", { class: "flex-row justify-end" }, primaryButton, /* @__PURE__ */ createElement( + "button", + { + class: "danger", + "aria-label": coreViewModel2.translations.general.deleteItemButtonAudioLabel, + "on:click": ondelete + }, + /* @__PURE__ */ createElement("span", { class: "icon" }, "delete") + ))); + } + // src/View/Modals/searchModal.tsx function SearchModal(coreViewModel2, searchViewModel, headline, isOpen) { function close() { @@ -5670,24 +5683,21 @@ function applySuggestion() { searchViewModel.search(suggestion); } - return /* @__PURE__ */ createElement("div", { class: "flex-row surface align-center" }, /* @__PURE__ */ createElement("span", { class: "width-100 flex-1 padding-h" }, suggestion), /* @__PURE__ */ createElement( - "button", - { - class: "danger", - "aria-label": coreViewModel2.translations.general.deleteButton, - "on:click": deleteSuggestion - }, - /* @__PURE__ */ createElement("span", { class: "icon" }, "delete") - ), /* @__PURE__ */ createElement( - "button", - { - class: "primary", - "aria-label": coreViewModel2.translations.general.applyButton, - "on:click": applySuggestion, - "toggle:disabled": isApplied - }, - /* @__PURE__ */ createElement("span", { class: "icon" }, "check") - )); + return DeletableListItem( + coreViewModel2, + suggestion, + /* @__PURE__ */ createElement( + "button", + { + class: "primary", + "aria-label": coreViewModel2.translations.general.applyButton, + "on:click": applySuggestion, + "toggle:disabled": isApplied + }, + /* @__PURE__ */ createElement("span", { class: "icon" }, "check") + ), + deleteSuggestion + ); } // src/View/Components/colorPicker.tsx @@ -5982,19 +5992,6 @@ ); } - // src/View/Components/deletableListItem.tsx - function DeletableListItem(coreViewModel2, text, primaryButton, ondelete) { - return /* @__PURE__ */ createElement("div", { class: "tile flex-row justify-apart align-center padding-0" }, /* @__PURE__ */ createElement("span", { class: "padding-h ellipsis" }, text), /* @__PURE__ */ createElement("div", { class: "flex-row justify-end" }, primaryButton, /* @__PURE__ */ createElement( - "button", - { - class: "danger", - "aria-label": coreViewModel2.translations.general.deleteItemButtonAudioLabel, - "on:click": ondelete - }, - /* @__PURE__ */ createElement("span", { class: "icon" }, "delete") - ))); - } - // src/View/ChatPages/settingsPage.tsx function SettingsPage(coreViewModel2, settingsPageViewModel) { settingsPageViewModel.loadData(); diff --git a/src/Model/Chat/.chatModel.ts.swp b/src/Model/Chat/.chatModel.ts.swp deleted file mode 100644 index da4d6d14..00000000 Binary files a/src/Model/Chat/.chatModel.ts.swp and /dev/null differ diff --git a/src/ViewModel/Chat/.chatListViewModel.ts.swp b/src/ViewModel/Chat/.chatListViewModel.ts.swp new file mode 100644 index 00000000..a06ecfa1 Binary files /dev/null and b/src/ViewModel/Chat/.chatListViewModel.ts.swp differ diff --git a/src/ViewModel/Chat/chatListViewModel.ts b/src/ViewModel/Chat/chatListViewModel.ts index cf62d219..4617b37f 100644 --- a/src/ViewModel/Chat/chatListViewModel.ts +++ b/src/ViewModel/Chat/chatListViewModel.ts @@ -102,4 +102,14 @@ export default class ChatListViewModel { this.loadChats(); } + + // utility + stripNamespace = (fullChannel: string): string => { + for (const vm of this.chatViewModels.value) { + const fullReference = vm.chatModel.info.namespace + vm.chatModel.info.primaryChannel; + if (fullReference == fullChannel) return vm.chatModel.info.primaryChannel; + } + + return fullChannel; + } } diff --git a/src/ViewModel/Global/.notificationViewModel.ts.swp b/src/ViewModel/Global/.notificationViewModel.ts.swp new file mode 100644 index 00000000..80eeaedd Binary files /dev/null and b/src/ViewModel/Global/.notificationViewModel.ts.swp differ diff --git a/src/ViewModel/Global/notificationViewModel.ts b/src/ViewModel/Global/notificationViewModel.ts index 0f90e922..5b5594f9 100644 --- a/src/ViewModel/Global/notificationViewModel.ts +++ b/src/ViewModel/Global/notificationViewModel.ts @@ -13,12 +13,11 @@ export default class NotificationViewModel { // main showNotification = (message: ChatMessage): void => { - const notification: Notification = - NotificationViewModel.createNotification(message); if (this.seenMessageIds.has(message.id)) return; - if (this.chatListViewModel.selectedChat.value == undefined) return; + const notification: Notification = + this.createNotification(message); const currentChat = this.chatListViewModel.selectedChat.value.chatModel .unwrappedPrimaryChannel; @@ -83,13 +82,15 @@ export default class NotificationViewModel { }; // init - constructor(public readonly chatListViewModel: ChatListViewModel) {} + constructor(public chatListViewModel: ChatListViewModel) {} // util - static createNotification(message: ChatMessage): Notification { + createNotification(message: ChatMessage): Notification { + const fullChannel = ChatModel.splitChannel(message.channel)[0]; + const chat = this.chatListViewModel.stripNamespace(fullChannel); return { messageId: message.id, - chat: ChatModel.splitChannel(message.channel)[0], + chat, sender: message.sender, body: message.body, };