1 import { Component } from 'inferno';
2 import { PrivateMessageForm } from './private-message-form';
3 import { WebSocketService } from '../services';
4 import { PrivateMessageFormParams } from '../interfaces';
5 import { i18n } from '../i18next';
7 export class CreatePrivateMessage extends Component<any, any> {
8 constructor(props: any, context: any) {
10 this.handlePrivateMessageCreate = this.handlePrivateMessageCreate.bind(
16 document.title = `${i18n.t('create_private_message')} - ${
17 WebSocketService.Instance.site.name
23 <div class="container">
25 <div class="col-12 col-lg-6 offset-lg-3 mb-4">
26 <h5>{i18n.t('create_private_message')}</h5>
28 onCreate={this.handlePrivateMessageCreate}
37 get params(): PrivateMessageFormParams {
38 let urlParams = new URLSearchParams(this.props.location.search);
39 let params: PrivateMessageFormParams = {
40 recipient_id: Number(urlParams.get('recipient_id')),
46 handlePrivateMessageCreate() {
47 alert(i18n.t('message_sent'));
49 // Navigate to the front
50 this.props.history.push(`/`);