This commit is contained in:
marlon-erler
2024-07-22 23:44:37 +02:00
parent 852acffb7c
commit 48b4a0e941
3 changed files with 15 additions and 18 deletions
+7 -10
View File
@@ -55,15 +55,6 @@ export default class MessagePageViewModel {
// load
loadData = (): void => {
this.cannotSendMessage = React.createProxyState(
[this.chatViewModel.settingsViewModel.username, this.composingMessage],
() =>
this.chatViewModel.settingsViewModel.username.value == "" ||
this.composingMessage.value == ""
);
};
loadMessages = (): void => {
for (const chatMessage of this.chatViewModel.chatModel.messages) {
this.addChatMessage(chatMessage);
}
@@ -72,6 +63,12 @@ export default class MessagePageViewModel {
// init
constructor(chatViewModel: ChatViewModel) {
this.chatViewModel = chatViewModel;
this.loadData();
this.cannotSendMessage = React.createProxyState(
[this.chatViewModel.settingsViewModel.username, this.composingMessage],
() =>
this.chatViewModel.settingsViewModel.username.value == "" ||
this.composingMessage.value == ""
);
}
}
+7 -7
View File
@@ -89,13 +89,6 @@ export default class SettingsPageViewModel {
this.chatViewModel.chatModel.info.primaryChannel;
this.color.value = this.chatViewModel.chatModel.color;
this.cannotSetEncryptionKey = React.createProxyState(
[this.encryptionKeyInput],
() =>
this.encryptionKeyInput.value ==
this.chatViewModel.chatModel.info.encryptionKey
);
};
loadData = (): void => {
@@ -120,5 +113,12 @@ export default class SettingsPageViewModel {
constructor(chatViewModel: ChatViewModel) {
this.chatViewModel = chatViewModel;
this.loadListRelevantData();
this.cannotSetEncryptionKey = React.createProxyState(
[this.encryptionKeyInput],
() =>
this.encryptionKeyInput.value ==
this.chatViewModel.chatModel.info.encryptionKey
);
}
}