diff --git a/dist/index.js b/dist/index.js
index 65e8078e..a4e4b46b 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -3155,6 +3155,16 @@
this.messagesInMarquee.push(notification);
this.startLoop();
};
+ this.openNotification = () => {
+ const notification = this.marquee.value;
+ if (notification == void 0) return;
+ const chat = [
+ ...this.chatListViewModel.chatViewModels.value.values()
+ ].find(
+ (chat2) => chat2.chatModel.info.primaryChannel == notification.chat
+ );
+ chat.open();
+ };
// loop
this.loop = () => {
if (this.messagesInMarquee.length == 0) {
@@ -3176,6 +3186,10 @@
clearInterval(this.interval);
this.interval = void 0;
};
+ this.skipLoop = () => {
+ this.stopLoop();
+ this.startLoop();
+ };
this.chatListViewModel = chatListViewModel2;
}
// util
@@ -3246,6 +3260,7 @@
// view
this.openChat = (chatViewModel) => {
this.selectedChat.value = chatViewModel;
+ this.notificationViewModel.skipLoop();
};
this.closeChat = () => {
this.selectedChat.value = void 0;
@@ -4623,7 +4638,7 @@
() => {
const value = chatViewModel.notificationViewModel.marquee.value;
if (value == void 0) return /* @__PURE__ */ createElement("span", null);
- return /* @__PURE__ */ createElement("span", null, /* @__PURE__ */ createElement("b", null, value.sender), /* @__PURE__ */ createElement("span", { class: "secondary" }, value.chat, ": "), /* @__PURE__ */ createElement("span", null, value.body));
+ return /* @__PURE__ */ createElement("span", { "on:click": chatViewModel.notificationViewModel.openNotification }, /* @__PURE__ */ createElement("b", null, value.sender), /* @__PURE__ */ createElement("span", { class: "secondary" }, value.chat, ": "), /* @__PURE__ */ createElement("span", null, value.body));
}
);
return /* @__PURE__ */ createElement(
diff --git a/src/View/chatPage.tsx b/src/View/chatPage.tsx
index 66bc16f5..970ce14f 100644
--- a/src/View/chatPage.tsx
+++ b/src/View/chatPage.tsx
@@ -40,7 +40,7 @@ export function ChatPage(chatViewModel: ChatViewModel) {
const value = chatViewModel.notificationViewModel.marquee.value;
if (value == undefined) return ;
return (
-
+
{value.sender}
{value.chat}:
{value.body}
diff --git a/src/ViewModel/Chat/chatListViewModel.ts b/src/ViewModel/Chat/chatListViewModel.ts
index 93e324ff..52883009 100644
--- a/src/ViewModel/Chat/chatListViewModel.ts
+++ b/src/ViewModel/Chat/chatListViewModel.ts
@@ -9,7 +9,6 @@ import SettingsViewModel from "../Global/settingsViewModel";
import StorageModel from "../../Model/Global/storageModel";
import ConnectionViewModel from "../Global/connectionViewModel";
import NotificationViewModel from "../Global/notificationViewModel";
-import NotificationModel from "../../Model/Global/notificationModel";
export default class ChatListViewModel {
storageModel: StorageModel;
@@ -82,6 +81,7 @@ export default class ChatListViewModel {
// view
openChat = (chatViewModel: ChatViewModel): void => {
this.selectedChat.value = chatViewModel;
+ this.notificationViewModel.skipLoop();
};
closeChat = (): void => {
diff --git a/src/ViewModel/Global/notificationViewModel.ts b/src/ViewModel/Global/notificationViewModel.ts
index e488bbe6..107667bd 100644
--- a/src/ViewModel/Global/notificationViewModel.ts
+++ b/src/ViewModel/Global/notificationViewModel.ts
@@ -17,13 +17,27 @@ export default class NotificationViewModel {
const notification = NotificationViewModel.createNotification(message);
if (this.seenMessageIds.has(message.id)) return;
- const currentChat = this.chatListViewModel.selectedChat.value.chatModel.info.primaryChannel;
+ const currentChat =
+ this.chatListViewModel.selectedChat.value.chatModel.info
+ .primaryChannel;
if (notification.chat == currentChat) return;
this.messagesInMarquee.push(notification);
this.startLoop();
};
+ openNotification = () => {
+ const notification = this.marquee.value;
+ if (notification == undefined) return;
+
+ const chat = [
+ ...this.chatListViewModel.chatViewModels.value.values(),
+ ].find(
+ (chat) => chat.chatModel.info.primaryChannel == notification.chat,
+ );
+ chat.open();
+ };
+
// loop
loop = () => {
if (this.messagesInMarquee.length == 0) {
@@ -50,6 +64,11 @@ export default class NotificationViewModel {
this.interval = undefined;
};
+ skipLoop = () => {
+ this.stopLoop();
+ this.startLoop();
+ }
+
// init
constructor(chatListViewModel: ChatListViewModel) {
this.chatListViewModel = chatListViewModel;