cleanup
This commit is contained in:
@@ -7,7 +7,7 @@ import MessagePageViewModel from "../../ViewModel/Pages/messagePageViewModel";
|
|||||||
import { translations } from "../translations";
|
import { translations } from "../translations";
|
||||||
|
|
||||||
export function MessagePage(messagePageViewModel: MessagePageViewModel) {
|
export function MessagePage(messagePageViewModel: MessagePageViewModel) {
|
||||||
messagePageViewModel.loadMessages();
|
messagePageViewModel.loadData();
|
||||||
|
|
||||||
const messageContainer = (
|
const messageContainer = (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -55,15 +55,6 @@ export default class MessagePageViewModel {
|
|||||||
|
|
||||||
// load
|
// load
|
||||||
loadData = (): void => {
|
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) {
|
for (const chatMessage of this.chatViewModel.chatModel.messages) {
|
||||||
this.addChatMessage(chatMessage);
|
this.addChatMessage(chatMessage);
|
||||||
}
|
}
|
||||||
@@ -72,6 +63,12 @@ export default class MessagePageViewModel {
|
|||||||
// init
|
// init
|
||||||
constructor(chatViewModel: ChatViewModel) {
|
constructor(chatViewModel: ChatViewModel) {
|
||||||
this.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 == ""
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,13 +89,6 @@ export default class SettingsPageViewModel {
|
|||||||
this.chatViewModel.chatModel.info.primaryChannel;
|
this.chatViewModel.chatModel.info.primaryChannel;
|
||||||
|
|
||||||
this.color.value = this.chatViewModel.chatModel.color;
|
this.color.value = this.chatViewModel.chatModel.color;
|
||||||
|
|
||||||
this.cannotSetEncryptionKey = React.createProxyState(
|
|
||||||
[this.encryptionKeyInput],
|
|
||||||
() =>
|
|
||||||
this.encryptionKeyInput.value ==
|
|
||||||
this.chatViewModel.chatModel.info.encryptionKey
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
loadData = (): void => {
|
loadData = (): void => {
|
||||||
@@ -120,5 +113,12 @@ export default class SettingsPageViewModel {
|
|||||||
constructor(chatViewModel: ChatViewModel) {
|
constructor(chatViewModel: ChatViewModel) {
|
||||||
this.chatViewModel = chatViewModel;
|
this.chatViewModel = chatViewModel;
|
||||||
this.loadListRelevantData();
|
this.loadListRelevantData();
|
||||||
|
|
||||||
|
this.cannotSetEncryptionKey = React.createProxyState(
|
||||||
|
[this.encryptionKeyInput],
|
||||||
|
() =>
|
||||||
|
this.encryptionKeyInput.value ==
|
||||||
|
this.chatViewModel.chatModel.info.encryptionKey
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user