cordis/client/webapp/elements/message-text-continued.ts

21 lines
904 B
TypeScript
Raw Normal View History

2021-10-30 17:26:41 +00:00
import * as moment from 'moment';
import ClientController from '../client-controller.js';
import { Message } from '../data-types';
import IState from './require/elements-state.js';
import ElementsUtil from './require/elements-util.js';
import { $, $$, $$$, $$$$ } from './require/q-module';
export default function createTextMessageContinued(state: IState, server: ClientController, message: Message): HTMLElement {
const { document } = state;
$.setDocument(document);
return $.create({ class: 'message continued', 'meta-id': message.id, 'meta-member-id': message.member.id, 'meta-server-id': server.id, content: [
{ class: 'timestamp', content: moment(message.sent).format('HH:mm') },
{ class: 'right', content: [
{ class: 'content text', content: ElementsUtil.parseMessageText(message.text ?? '') }
] }
] }) as HTMLElement;
}