import UserIcon from "../UserIcon"; import { Username } from "../UserShort"; import Markdown from "../../markdown/Markdown"; import { Children } from "../../../types/Preact"; import { attachContextMenu } from "preact-context-menu"; import { useUser } from "../../../context/revoltjs/hooks"; import { MessageObject } from "../../../context/revoltjs/util"; import MessageBase, { MessageContent, MessageDetail, MessageInfo } from "./MessageBase"; interface Props { attachContext?: boolean message: MessageObject contrast?: boolean content?: Children head?: boolean } export default function Message({ attachContext, message, contrast, content, head }: Props) { // TODO: Can improve re-renders here by providing a list // TODO: of dependencies. We only need to update on u/avatar. let user = useUser(message.author); return ( { head ? : } { head && } { content ?? } ) }