29 lines
858 B
TypeScript
29 lines
858 B
TypeScript
import * as React from "bloatless-react";
|
|||
|
|
|
||
|
|
import { Chat, MessageObject } from "../../Model/chatModel";
|
||
|
|
|
||
|
|
import { ObjectGridView } from "./objectGridView";
|
||
|
|
|
||
|
|
export function CalendarView(
|
||
|
|
chat: Chat,
|
||
|
|
messageObjects: React.MapState<MessageObject>,
|
||
|
|
selectedObject: React.State<MessageObject | undefined>,
|
||
|
|
isShowingObjectModal: React.State<boolean>
|
||
|
|
) {
|
||
|
|
const notes = new React.ListState<MessageObject>();
|
||
|
|
messageObjects.handleAddition((messageObject) => {
|
||
|
|
const latest = chat.getMostRecentContent(messageObject);
|
||
|
|
if (!latest) return;
|
||
|
|
if (!latest.date) return;
|
||
|
|
|
||
|
|
notes.add(messageObject);
|
||
|
|
messageObjects.handleRemoval(messageObject, () =>
|
||
|
|
notes.remove(messageObject)
|
||
|
|
);
|
||
|
|
});
|
||
|
|
|
||
|
|
return <div class="width-100 height-100 scroll-v padding">
|
||
|
|
{ObjectGridView(chat, notes, selectedObject, isShowingObjectModal)}
|
||
|
|
</div>;
|
||
|
|
}
|