[DEV-104] - Redirect to home/dashboard after ticket is created without user system (#1037)

* Redirect to home/dashboard after ticket is created without user system

* fix min-height in main-home-page-portal component

* Move success messagge

* querystring check
This commit is contained in:
Joel Elias Méndez 2021-09-27 19:00:43 -03:00 committed by GitHub
parent 59fb9eaef3
commit ae076de88f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 15 deletions

View File

@ -43,7 +43,7 @@ class DashboardCreateTicketPage extends React.Component {
} }
onCreateTicketSuccess(message) { onCreateTicketSuccess(message) {
history.push(`${(this.props.location.pathname !== '/create-ticket') ? "/dashboard" : "/create-ticket"}?message=${message}`); history.push(`${(this.props.location.pathname !== '/create-ticket') ? "/dashboard" : "/"}?message=${message}`);
} }
getClass() { getClass() {

View File

@ -17,4 +17,8 @@
&__create-ticket-form__hidden { &__create-ticket-form__hidden {
display: none; display: none;
} }
&__message {
margin-bottom: 30px;
}
} }

View File

@ -7,6 +7,8 @@ import Widget from 'core-components/widget';
import Card from 'core-components/card'; import Card from 'core-components/card';
import i18n from 'lib-app/i18n'; import i18n from 'lib-app/i18n';
import Header from 'core-components/header'; import Header from 'core-components/header';
import queryString from 'query-string';
import Message from 'core-components/message';
class MainHomePagePortal extends React.Component { class MainHomePagePortal extends React.Component {
static propTypes = { static propTypes = {
@ -14,23 +16,35 @@ class MainHomePagePortal extends React.Component {
}; };
render() { render() {
const currentSearchParams = queryString.parse(window.location.search) || {};
return ( return (
<Widget className={classNames('main-home-page-portal', this.props.className)}> <div className="">
<div className="main-home-page-portal__title"> {
<Header title={this.props.title || i18n('SUPPORT_CENTER')} description={i18n('SUPPORT_CENTER_DESCRIPTION')} /> currentSearchParams["message"] ?
</div> <Message className="dashboard-create-ticket-page__message" type="success">
<div className="main-home-page-portal__cards"> {i18n('TICKET_NUMBER_SENT')}
<div className="main-home-page-portal__card col-md-4"> </Message> :
<Card {...this.getTicketsCardProps()}/> null
}
<Widget className={classNames('main-home-page-portal', this.props.className)}>
<div className="main-home-page-portal__title">
<Header title={this.props.title || i18n('SUPPORT_CENTER')} description={i18n('SUPPORT_CENTER_DESCRIPTION')} />
</div> </div>
<div className="main-home-page-portal__card col-md-4"> <div className="main-home-page-portal__cards">
<Card {...((this.props.type === 'complete') ? this.getViewTicketCardProps() : this.getAccountCardProps())} /> <div className="main-home-page-portal__card col-md-4">
<Card {...this.getTicketsCardProps()}/>
</div>
<div className="main-home-page-portal__card col-md-4">
<Card {...((this.props.type === 'complete') ? this.getViewTicketCardProps() : this.getAccountCardProps())} />
</div>
<div className="main-home-page-portal__card col-md-4">
<Card {...this.getArticlesCardProps()} />
</div>
</div> </div>
<div className="main-home-page-portal__card col-md-4"> </Widget>
<Card {...this.getArticlesCardProps()} /> </div>
</div>
</div>
</Widget>
); );
} }