From 31614fa9a6632a3ac86530c546d0a9c8c51d5b55 Mon Sep 17 00:00:00 2001 From: Tom <20648924+moT01@users.noreply.github.com> Date: Mon, 1 Jun 2020 12:33:53 -0500 Subject: [PATCH] fix(client): remove auto redirect on report user page (#38974) --- client/src/client-only-routes/ShowUser.js | 52 +++++----------------- client/src/client-only-routes/showuser.css | 4 ++ 2 files changed, 14 insertions(+), 42 deletions(-) create mode 100644 client/src/client-only-routes/showuser.css diff --git a/client/src/client-only-routes/ShowUser.js b/client/src/client-only-routes/ShowUser.js index 226c09fb44..ab9794333c 100644 --- a/client/src/client-only-routes/ShowUser.js +++ b/client/src/client-only-routes/ShowUser.js @@ -13,7 +13,7 @@ import { } from '@freecodecamp/react-bootstrap'; import Helmet from 'react-helmet'; -import { apiLocation } from '../../config/env.json'; +import Login from '../components/Header/components/Login'; import { hardGoTo as navigate, @@ -24,6 +24,8 @@ import { } from '../redux'; import { Spacer, Loader, FullWidthRow } from '../components/helpers'; +import './showuser.css'; + const propTypes = { email: PropTypes.string, isSignedIn: PropTypes.bool, @@ -57,21 +59,13 @@ class ShowUser extends Component { constructor(props) { super(props); - this.timer = null; this.state = { - textarea: '', - time: 5 + textarea: '' }; this.handleChange = this.handleChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); } - componentWillUnmount() { - if (this.timer) { - clearInterval(this.timer); - } - } - handleChange(e) { const textarea = e.target.value.slice(); return this.setState({ @@ -86,17 +80,6 @@ class ShowUser extends Component { return reportUser({ username, reportDescription }); } - setNavigationTimer(navigate) { - if (!this.timer) { - this.timer = setInterval(() => { - if (this.state.time <= 0) { - navigate(`${apiLocation}/signin`); - } - this.setState({ time: this.state.time - 1 }); - }, 1000); - } - } - render() { const { username, isSignedIn, userFetchState, email } = this.props; const { pending, complete, errored } = userFetchState; @@ -105,37 +88,22 @@ class ShowUser extends Component { } if ((complete || errored) && !isSignedIn) { - const { navigate } = this.props; - this.setNavigationTimer(navigate); return (
- + You need to be signed in to report a user - -

- You will be redirected to sign in to freeCodeCamp.org - automatically in {this.state.time} seconds -

-

- -

- + + + Click here to sign in + +
diff --git a/client/src/client-only-routes/showuser.css b/client/src/client-only-routes/showuser.css new file mode 100644 index 0000000000..a7277af904 --- /dev/null +++ b/client/src/client-only-routes/showuser.css @@ -0,0 +1,4 @@ +/* remove bootstrap margin*/ +.row { + margin: 0; +}