add inline replies, ui improvements, rename ViewPersistence->ViewController, add scroll method and highlight
This commit is contained in:
@@ -17,6 +17,7 @@ export default class ChatMessageViewModel {
|
||||
sender: string;
|
||||
dateSent: string;
|
||||
body: React.State<string> = new React.State("");
|
||||
inlineReply: ChatMessageViewModel | undefined = undefined;
|
||||
status: React.State<ChatMessageStatuses | any> = new React.State<any>(
|
||||
undefined,
|
||||
);
|
||||
@@ -80,6 +81,15 @@ export default class ChatMessageViewModel {
|
||||
this.messagePageViewModel.decryptMessage(this);
|
||||
};
|
||||
|
||||
reply = (): void => {
|
||||
this.messagePageViewModel.replyingMessage.value = this;
|
||||
this.hideInfoModal();
|
||||
};
|
||||
cancelReply = (): void => {
|
||||
if (this.messagePageViewModel.replyingMessage.value != this) return;
|
||||
this.messagePageViewModel.replyingMessage.value = undefined;
|
||||
};
|
||||
|
||||
// view
|
||||
showInfoModal = (): void => {
|
||||
this.isPresentingInfoModal.value = true;
|
||||
@@ -119,6 +129,10 @@ export default class ChatMessageViewModel {
|
||||
this.dateSent = new Date(this.chatMessage.dateSent).toLocaleString();
|
||||
this.body.value = this.chatMessage.body;
|
||||
this.status.value = this.chatMessage.status;
|
||||
|
||||
if (this.chatMessage.inlineReplyId) {
|
||||
this.inlineReply = this.messagePageViewModel.chatMessageViewModels.value.get(this.chatMessage.inlineReplyId);
|
||||
}
|
||||
};
|
||||
|
||||
// init
|
||||
|
||||
@@ -318,9 +318,18 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
this.registerKeyStroke(CommonKeys.Apply, this.hideSettings);
|
||||
this.registerKeyStroke(CommonKeys.Create, this.createTask);
|
||||
|
||||
this.registerKeyStroke("j", ()=>this.selectedPage.value = BoardPageTypes.List);
|
||||
this.registerKeyStroke("k", ()=>this.selectedPage.value = BoardPageTypes.Kanban);
|
||||
this.registerKeyStroke("l", ()=>this.selectedPage.value = BoardPageTypes.StatusGrid);
|
||||
this.registerKeyStroke(
|
||||
"j",
|
||||
() => (this.selectedPage.value = BoardPageTypes.List),
|
||||
);
|
||||
this.registerKeyStroke(
|
||||
"k",
|
||||
() => (this.selectedPage.value = BoardPageTypes.Kanban),
|
||||
);
|
||||
this.registerKeyStroke(
|
||||
"l",
|
||||
() => (this.selectedPage.value = BoardPageTypes.StatusGrid),
|
||||
);
|
||||
|
||||
this.taskPageViewModel.registerContext(this.boardInfo.fileId, this);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ export default class MessagePageViewModel extends Context {
|
||||
reactionFilter = new React.State<ReactionSymbols | undefined>(undefined);
|
||||
isFilterActive: React.State<boolean>;
|
||||
|
||||
replyingMessageId = new React.State<string|undefined>(undefined)
|
||||
replyingMessage = new React.State<ChatMessageViewModel | undefined>(
|
||||
undefined,
|
||||
);
|
||||
composingMessage = new React.State<string>("");
|
||||
|
||||
// guards
|
||||
@@ -38,8 +40,15 @@ export default class MessagePageViewModel extends Context {
|
||||
};
|
||||
|
||||
sendMessageFromBody = (body: string): void => {
|
||||
this.chatViewModel.chatModel.sendMessage(body, this.replyingMessageId.value);
|
||||
this.replyingMessageId.value = undefined;
|
||||
let replyId: string|undefined = undefined;
|
||||
if (this.replyingMessage.value) {
|
||||
replyId = this.replyingMessage.value.chatMessage.id;
|
||||
}
|
||||
this.chatViewModel.chatModel.sendMessage(
|
||||
body,
|
||||
replyId,
|
||||
);
|
||||
this.replyingMessage.value = undefined;
|
||||
};
|
||||
|
||||
decryptMessage = async (
|
||||
|
||||
Reference in New Issue
Block a user