// Create new topic and invite users or send an invite. import React from 'react'; import { FormattedMessage } from 'react-intl'; import ContactList from '../widgets/contact-list.jsx'; import NewTopicById from '../widgets/new-topic-by-id.jsx'; import NewTopicGroup from '../widgets/new-topic-group.jsx'; import SearchContacts from '../widgets/search-contacts.jsx'; import HashNavigation from '../lib/navigation.js'; import { vcard } from '../lib/utils.js'; export default class NewTopicView extends React.Component { constructor(props) { super(props); this.state = { tabSelected: 'p2p' }; this.handleTabClick = this.handleTabClick.bind(this); this.handleContactSelected = this.handleContactSelected.bind(this); this.handleNewGroupSubmit = this.handleNewGroupSubmit.bind(this); this.handleGroupByID = this.handleGroupByID.bind(this); } componentDidMount() { this.props.onInitFind(); } handleTabClick(e) { e.preventDefault(); HashNavigation.navigateTo(HashNavigation.addUrlParam(window.location.hash, 'tab', e.currentTarget.dataset.id)); this.setState({tabSelected: e.currentTarget.dataset.id}); } handleContactSelected(sel) { if (this.state.tabSelected === 'p2p') { HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab')); this.props.onCreateTopic(sel, undefined); } } handleNewGroupSubmit(name, dataUrl, priv, tags) { HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab')); this.props.onCreateTopic(undefined, vcard(name, dataUrl), priv, tags); } handleGroupByID(topicName) { HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab')); this.props.onCreateTopic(topicName); } render() { return (
); } };