add navigation for chat page
This commit is contained in:
@@ -1,13 +1,36 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import ChatListViewModel from "./chatListViewModel";
|
||||
import { ChatModel } from "../Model/chatModel";
|
||||
import StorageModel from "../Model/storageModel";
|
||||
|
||||
export default class ChatViewModel {
|
||||
chatModel: ChatModel;
|
||||
chatModel: ChatModel;
|
||||
chatListViewModel: ChatListViewModel;
|
||||
|
||||
// init
|
||||
constructor(storageModel: StorageModel) {
|
||||
|
||||
}
|
||||
}
|
||||
// state
|
||||
primaryChannel: React.State<string> = new React.State("");
|
||||
primaryChannelInput: React.State<string> = new React.State("");
|
||||
|
||||
// guards
|
||||
cannotSetPrimaryChannel: React.State<boolean> = React.createProxyState(
|
||||
[this.primaryChannel, this.primaryChannelInput],
|
||||
() =>
|
||||
this.primaryChannelInput.value == "" ||
|
||||
this.primaryChannelInput.value == this.primaryChannel.value
|
||||
);
|
||||
|
||||
// methods
|
||||
open = () => {
|
||||
this.chatListViewModel.openChat(this);
|
||||
}
|
||||
|
||||
// init
|
||||
constructor(chatListViewModel: ChatListViewModel, chatModel: ChatModel) {
|
||||
this.chatModel = chatModel;
|
||||
this.chatListViewModel = chatListViewModel;
|
||||
|
||||
this.primaryChannel.value = chatModel.info.primaryChannel;
|
||||
this.primaryChannelInput.value = chatModel.info.primaryChannel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user