Merge branch 'master' into featured-comments

This commit is contained in:
Kim Gardner
2017-07-11 16:33:34 -04:00
committed by GitHub
19 changed files with 474 additions and 36 deletions
@@ -9,6 +9,7 @@ import Count from 'coral-plugin-comment-count/CommentCount';
import ProfileContainer from 'coral-settings/containers/ProfileContainer';
import ConfigureStreamContainer
from 'coral-configure/containers/ConfigureStreamContainer';
import cn from 'classnames';
export default class Embed extends React.Component {
changeTab = (tab) => {
@@ -37,34 +38,36 @@ export default class Embed extends React.Component {
const {activeTab, viewAllComments, commentId} = this.props;
const {asset: {totalCommentCount}} = this.props.root;
const {user} = this.props.auth;
const hasHighlightedComment = !!commentId;
return (
<div>
<div className="commentStream">
<TabBar onChange={this.changeTab} activeTab={activeTab} className='talk-stream-tabbar'>
<Tab className={'talk-stream-comment-count-tab'} id='stream'><Count count={totalCommentCount}/></Tab>
<Tab className={'talk-stream-profile-tab'} id='profile'>{t('framework.my_profile')}</Tab>
<Tab className={'talk-stream-configuration-tab'} id='config' restricted={!can(user, 'UPDATE_CONFIG')}>{t('framework.configure_stream')}</Tab>
</TabBar>
{commentId &&
<Button
cStyle="darkGrey"
style={{float: 'right'}}
onClick={viewAllComments}
>
{t('framework.show_all_comments')}
</Button>}
<Slot fill="embed" />
<TabContent show={activeTab === 'stream'}>
<Stream data={this.props.data} root={this.props.root} />
</TabContent>
<TabContent show={activeTab === 'profile'}>
<ProfileContainer />
</TabContent>
<TabContent show={activeTab === 'config'}>
<ConfigureStreamContainer />
</TabContent>
</div>
<div className={cn('talk-embed-stream', {'talk-embed-stream-highlight-comment': hasHighlightedComment})}>
<TabBar onChange={this.changeTab} activeTab={activeTab} className='talk-embed-stream-tab-bar'>
<Tab className={'talk-embed-stream-comments-tab'} id='stream'><Count count={totalCommentCount}/></Tab>
<Tab className={'talk-embed-stream-profile-tab'} id='profile'>{t('framework.my_profile')}</Tab>
<Tab className={'talk-embed-stream-configuration-tab'} id='config' restricted={!can(user, 'UPDATE_CONFIG')}>
{t('framework.configure_stream')}
</Tab>
</TabBar>
{commentId &&
<Button
cStyle="darkGrey"
style={{float: 'right'}}
onClick={viewAllComments}
className={'talk-stream-show-all-comments-button'}
>
{t('framework.show_all_comments')}
</Button>}
<Slot fill="embed" />
<TabContent show={activeTab === 'stream'}>
<Stream data={this.props.data} root={this.props.root} />
</TabContent>
<TabContent show={activeTab === 'profile'}>
<ProfileContainer />
</TabContent>
<TabContent show={activeTab === 'config'}>
<ConfigureStreamContainer />
</TabContent>
</div>
);
}
+1 -1
View File
@@ -48,5 +48,5 @@ render(
<ApolloProvider client={client} store={store}>
<AppRouter />
</ApolloProvider>
, document.querySelector('#coralStream')
, document.querySelector('#talk-embed-stream-container')
);
+4 -4
View File
@@ -15,9 +15,9 @@ function getSlotComponents(slot) {
// Filter out components that have been disabled in `plugin_config`
return flatten(plugins
// Filter out components that have been disabled in `plugin_config`
.filter((o) => !pluginConfig || !pluginConfig[o.plugin] || !pluginConfig[o.plugin].disable_components)
// Filter out components that have slots and have been disabled in `plugin_config`
.filter((o) => o.module.slots && (!pluginConfig || !pluginConfig[o.plugin] || !pluginConfig[o.plugin].disable_components))
.filter((o) => o.module.slots[slot])
.map((o) => o.module.slots[slot]));
@@ -78,7 +78,7 @@ export function getSlotsFragments(slots) {
}
const components = uniq(flattenDeep(slots.map((slot) => {
return plugins
.filter((o) => o.module.slots[slot])
.filter((o) => o.module.slots ? o.module.slots[slot] : false)
.map((o) => o.module.slots[slot]);
})));
@@ -148,7 +148,7 @@ export default class FlagButton extends Component {
<button
ref={(ref) => this.flagButton = ref}
onClick={!this.props.banned && !flaggedByCurrentUser && !localPost ? this.onReportClick : null}
className={cn(`${name}-button`, styles.button)}>
className={cn(`${name}-button`, {[`${name}-button-flagged`]: flagged}, styles.button)}>
{
flagged
? <span className={`${name}-button-text`}>{t('reported')}</span>