Merge branch 'master' into no-yarn-generate-introspection

This commit is contained in:
Kim Gardner
2017-07-26 21:02:28 -04:00
committed by GitHub
8 changed files with 39 additions and 20 deletions
@@ -54,6 +54,13 @@ export default (reaction) => (WrappedComponent) => {
id: fragmentId
});
if (!data) {
if (self) {
throw new Error(`Comment ${action.item_id} was not found`);
}
return;
}
// Add our comment from the mutation to the end.
let idx = data.action_summaries.findIndex(isReaction);
@@ -96,6 +103,13 @@ export default (reaction) => (WrappedComponent) => {
id: fragmentId
});
if (!data) {
if (self) {
throw new Error(`Comment ${action.item_id} was not found`);
}
return;
}
// Check whether we liked this comment.
const idx = data.action_summaries.findIndex(isReaction);
@@ -8,10 +8,10 @@
}
.tag {
background: #3D73D5;
background: #D2D7D3;
font-size: 12px;
font-weight: bold;
color: white;
color: #4A4A4A;
display: inline-block;
margin: 0px 5px;
padding: 5px 5px;
@@ -1,9 +1,9 @@
import {VIEWING_OPTIONS_OPEN, VIEWING_OPTIONS_CLOSE} from './constants';
import {OPEN_MENU, CLOSE_MENU} from './constants';
export const openViewingOptions = () => ({
type: VIEWING_OPTIONS_OPEN
export const openMenu = () => ({
type: OPEN_MENU,
});
export const closeViewingOptions = () => ({
type: VIEWING_OPTIONS_CLOSE
export const closeMenu = () => ({
type: CLOSE_MENU,
});
@@ -8,15 +8,15 @@ import {Slot, ClickOutside} from 'plugin-api/beta/client/components';
const ViewingOptions = (props) => {
const toggleOpen = () => {
if (!props.open) {
props.openViewingOptions();
props.openMenu();
} else {
props.closeViewingOptions();
props.closeMenu();
}
};
const handleClickOutside = () => {
if (props.open) {
props.closeViewingOptions();
props.closeMenu();
}
};
@@ -1,2 +1,5 @@
export const VIEWING_OPTIONS_OPEN = 'VIEWING_OPTIONS_OPEN';
export const VIEWING_OPTIONS_CLOSE = 'VIEWING_OPTIONS_CLOSE';
const prefix = 'TALK_VIEWING_OPTIONS';
export const OPEN_MENU = `${prefix}_OPEN_MENU`;
export const CLOSE_MENU = `${prefix}_CLOSE_MENU`;
@@ -1,13 +1,13 @@
import {connect} from 'plugin-api/beta/client/hocs';
import {bindActionCreators} from 'redux';
import ViewingOptions from '../components/ViewingOptions';
import {openViewingOptions, closeViewingOptions} from '../actions';
import {openMenu, closeMenu} from '../actions';
const mapStateToProps = ({coralPluginViewingOptions: state}) => ({
open: state.open
});
const mapDispatchToProps = (dispatch) =>
bindActionCreators({openViewingOptions, closeViewingOptions}, dispatch);
bindActionCreators({openMenu, closeMenu}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(ViewingOptions);
@@ -1,17 +1,17 @@
import {VIEWING_OPTIONS_OPEN, VIEWING_OPTIONS_CLOSE} from './constants';
import {OPEN_MENU, CLOSE_MENU} from './constants';
const initialState = {
open: false
};
export default function offTopic (state = initialState, action) {
export default function reducer(state = initialState, action) {
switch (action.type) {
case VIEWING_OPTIONS_OPEN:
case OPEN_MENU:
return {
...state,
open: true
};
case VIEWING_OPTIONS_CLOSE:
case CLOSE_MENU:
return {
...state,
open: false
@@ -1,2 +1,4 @@
export const SHOW_TOOLTIP = 'SHOW_TOOLTIP';
export const HIDE_TOOLTIP = 'HIDE_TOOLTIP';
const prefix = 'TALK_FEATURED_COMMENTS';
export const SHOW_TOOLTIP = `${prefix}_SHOW_TOOLTIP`;
export const HIDE_TOOLTIP = `${prefix}_HIDE_TOOLTIP`;