From 183b54af847d41029f5b825a3e9660462453c213 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Tue, 1 Nov 2016 20:37:00 +0100 Subject: [PATCH] Go to Accounts Page if Tooltips are displayed (#3054) (#3063) --- js/src/ui/Tooltips/tooltips.css | 2 +- js/src/ui/Tooltips/tooltips.js | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/js/src/ui/Tooltips/tooltips.css b/js/src/ui/Tooltips/tooltips.css index b5b0f361c20..9b63487e61b 100644 --- a/js/src/ui/Tooltips/tooltips.css +++ b/js/src/ui/Tooltips/tooltips.css @@ -25,7 +25,7 @@ left: 0; bottom: 0; right: 0; - background: transparent; + background: rgba(0, 0, 0, 0.25); z-index: 499; } diff --git a/js/src/ui/Tooltips/tooltips.js b/js/src/ui/Tooltips/tooltips.js index 70160a3245b..2261ffe5d32 100644 --- a/js/src/ui/Tooltips/tooltips.js +++ b/js/src/ui/Tooltips/tooltips.js @@ -23,6 +23,10 @@ import { nextTooltip } from './actions'; import styles from './tooltips.css'; class Tooltips extends Component { + static contextTypes = { + router: PropTypes.object.isRequired + }; + static propTypes = { currentId: PropTypes.number, closed: PropTypes.bool, @@ -33,6 +37,23 @@ class Tooltips extends Component { const { onNextTooltip } = this.props; onNextTooltip(); + this.redirect(); + } + + componentWillReceiveProps (nextProps) { + if (nextProps.currentId !== this.props.currentId) { + this.redirect(nextProps); + } + } + + redirect (props = this.props) { + const { currentId } = props; + + console.log('c', { currentId }); + if (currentId !== undefined && currentId !== -1) { + const viewLink = '/accounts/'; + this.context.router.push(viewLink); + } } render () {