From 803db345accc668eee96d193ea7161d782b6c0de Mon Sep 17 00:00:00 2001 From: Benjamin Goering Date: Fri, 7 Apr 2017 10:54:18 -0700 Subject: [PATCH] TopRightMenu no longer shows a list of choices, just IgnoreUserWizard --- client/coral-embed-stream/src/Comment.js | 60 ++++++------------------ 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index b3dfc5f8e..b0f83a684 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -185,9 +185,8 @@ class Comment extends React.Component { ); - const ignoreUserAndGotoStep3 = async () => { + const onClickIgnoreUser = async () => { await ignoreUser({id: user.id}); - goToStep(3); }; const step2Confirmation = (
@@ -195,7 +194,7 @@ class Comment extends React.Component {

Are you sure you want to ignore { user.name }?

- +
); @@ -219,8 +218,9 @@ class Comment extends React.Component { } } - // Menu of actions in top right of Comment. - // When you choose 'Ignore User', the menu choices are replaced with the Ignore User flow + // TopRightMenu appears as a dropdown in the top right of the comment. + // when you click the down cehvron, it expands and shows IgnoreUserWizard + // when you click 'cancel' in the wizard, it closes the menu class TopRightMenu extends React.Component { static propTypes = { @@ -234,54 +234,24 @@ class Comment extends React.Component { ignoreUser: PropTypes.func, } constructor(props) { - - // console.log('TopRightMenu#constructor', props) super(props); this.state = { - chosenItem: null + timesReset: 0 }; } - componentWillUnmount() { - - // console.log('TopRightMenu#componentWillUnmount') - } - componentDidMount() { - - // console.log('TopRightMenu#componentDidMount') - } - componentWillReceiveProps(nextProps) { - - // console.log('TopRightMenu#componentWillReceiveProps', nextProps) - } render() { - const {chosenItem} = this.state; const {comment, ignoreUser} = this.props; - let child; - const chooseIgnoreUser = () => { - this.setState({chosenItem: 'IGNORE_USER'}); - }; - const reset = () => this.setState({chosenItem: null}); - switch (chosenItem) { - case 'IGNORE_USER': - child = ( - - ); - break; - default: - child = ( - - Ignore User - - ); - } + + // timesReset is used as Toggleable key so it re-renders on reset (closing the toggleable) + const reset = () => this.setState({timesReset: this.state.timesReset + 1}); return ( - +
- { child } +
);