import React from 'react'; import PropTypes from 'prop-types'; import Stream from '../tabs/stream/containers/Stream'; import Configure from '../tabs/configure/containers/Configure'; import Slot from 'coral-framework/components/Slot'; import {can} from 'coral-framework/services/perms'; import t from 'coral-framework/services/i18n'; import ExtendableTabPanel from '../containers/ExtendableTabPanel'; import {Tab, TabPane} from 'coral-ui'; import ProfileContainer from 'coral-settings/containers/ProfileContainer'; import Popup from 'coral-framework/components/Popup'; import IfSlotIsNotEmpty from 'coral-framework/components/IfSlotIsNotEmpty'; import ConfigureStreamContainer from 'coral-configure/containers/ConfigureStreamContainer'; import cn from 'classnames'; export default class Embed extends React.Component { changeTab = (tab) => { // TODO: move data fetching to appropiate containers. switch (tab) { case 'profile': this.props.data.refetch(); break; case 'config': this.props.data.refetch(); break; } this.props.setActiveTab(tab); }; getTabs() { const {user} = this.props.auth; const tabs = [ {t('embed_comments_tab')} , {t('framework.my_profile')} , ]; if (can(user, 'UPDATE_CONFIG')) { tabs.push( {t('framework.configure_stream')} ); tabs.push( {t('framework.configure_stream')} ); } return tabs; } render() { const {activeTab, commentId, root, data, auth: {showSignInDialog, signInDialogFocus}, blurSignInDialog, focusSignInDialog, hideSignInDialog, router: {location: {query: {parentUrl}}}} = this.props; const hasHighlightedComment = !!commentId; return (
, , , , ]} />
); } } Embed.propTypes = { data: PropTypes.shape({ loading: PropTypes.bool, error: PropTypes.object }).isRequired };