mirror of
https://github.com/wassname/talk.git
synced 2026-08-03 13:20:59 +08:00
Containers, reducer and constants
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export const SHOW_TOOLTIP = 'SHOW_TOOLTIP';
|
||||
export const HIDE_TOOLTIP = 'HIDE_TOOLTIP';
|
||||
@@ -1,8 +1,19 @@
|
||||
import {compose, gql} from 'react-apollo';
|
||||
import {withFragments, excludeIf} from 'plugin-api/beta/client/hocs';
|
||||
import Tab from '../components/Tab';
|
||||
import {bindActionCreators} from 'redux';
|
||||
import {showTooltip, hideTooltip} from '../actions';
|
||||
import {compose, gql} from 'react-apollo';
|
||||
import {withFragments, excludeIf, connect} from 'plugin-api/beta/client/hocs';
|
||||
|
||||
const mapStateToProps = ({talkPluginFeaturedComments: state}) => state;
|
||||
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
bindActionCreators({
|
||||
showTooltip,
|
||||
hideTooltip,
|
||||
}, dispatch);
|
||||
|
||||
const enhance = compose(
|
||||
connect(mapStateToProps, mapDispatchToProps),
|
||||
withFragments({
|
||||
asset: gql`
|
||||
fragment TalkFeaturedComments_Tab_asset on Asset {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import {bindActionCreators} from 'redux';
|
||||
import {showTooltip, hideTooltip} from '../actions';
|
||||
import {connect} from 'plugin-api/beta/client/hocs';
|
||||
import Tooltip from '../components/Tooltip';
|
||||
|
||||
const mapStateToProps = ({talkPluginFeaturedComments: state}) => state;
|
||||
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
bindActionCreators({
|
||||
showTooltip,
|
||||
hideTooltip,
|
||||
}, dispatch);
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Tooltip);
|
||||
@@ -1,14 +1,16 @@
|
||||
import Tab from './containers/Tab';
|
||||
import TabPane from './containers/TabPane';
|
||||
import Tag from './components/Tag';
|
||||
import Button from './components/Button';
|
||||
import TabPane from './containers/TabPane';
|
||||
import translations from './translations.yml';
|
||||
import update from 'immutability-helper';
|
||||
import reducer from './reducer';
|
||||
|
||||
import {findCommentInEmbedQuery} from 'coral-embed-stream/src/graphql/utils';
|
||||
import {insertCommentsSorted} from 'plugin-api/beta/client/utils';
|
||||
|
||||
export default {
|
||||
reducer,
|
||||
translations,
|
||||
slots: {
|
||||
streamTabs: [Tab],
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import {SHOW_TOOLTIP, HIDE_TOOLTIP} from './constants';
|
||||
|
||||
const initialState = {
|
||||
tooltip: false
|
||||
};
|
||||
|
||||
export default function featured (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case SHOW_TOOLTIP:
|
||||
return {
|
||||
...state,
|
||||
tooltip: true
|
||||
};
|
||||
case HIDE_TOOLTIP:
|
||||
return {
|
||||
...state,
|
||||
tooltip: false
|
||||
};
|
||||
default :
|
||||
return state;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user