add CoreViewModel for drag&drop

This commit is contained in:
marlon-erler
2024-07-25 16:02:49 +02:00
parent be6f609ea2
commit 0ed71600c6
13 changed files with 71 additions and 14 deletions
+7 -2
View File
@@ -3,6 +3,7 @@ import * as React from "bloatless-react";
import { ChatMessage } from "../../Model/Chat/chatModel";
import ChatMessageViewModel from "../Chat/chatMessageViewModel";
import ChatViewModel from "../Chat/chatViewModel";
import CoreViewModel from "../Global/coreViewModel";
export default class MessagePageViewModel {
chatViewModel: ChatViewModel;
@@ -39,6 +40,7 @@ export default class MessagePageViewModel {
// view
showChatMessage = (chatMessage: ChatMessage): void => {
const chatMessageModel = new ChatMessageViewModel(
this.coreViewModel,
this,
chatMessage,
chatMessage.sender == this.chatViewModel.settingsViewModel.username.value
@@ -62,9 +64,12 @@ export default class MessagePageViewModel {
};
// init
constructor(chatViewModel: ChatViewModel) {
constructor(
public coreViewModel: CoreViewModel,
chatViewModel: ChatViewModel
) {
this.chatViewModel = chatViewModel;
this.cannotSendMessage = React.createProxyState(
[this.chatViewModel.settingsViewModel.username, this.composingMessage],
() =>