From 63e179d0152d2f8f2ee764443785efa24e5f7dce Mon Sep 17 00:00:00 2001 From: stew-ro <60453211+stew-ro@users.noreply.github.com> Date: Fri, 17 Jul 2020 16:44:55 -0700 Subject: [PATCH] fix: prevent user from leaving while composing (#422) --- .../pages/modelCompose/modelCompose.tsx | 171 +++++++++--------- 1 file changed, 89 insertions(+), 82 deletions(-) diff --git a/src/react/components/pages/modelCompose/modelCompose.tsx b/src/react/components/pages/modelCompose/modelCompose.tsx index dbc3543d..93693f07 100644 --- a/src/react/components/pages/modelCompose/modelCompose.tsx +++ b/src/react/components/pages/modelCompose/modelCompose.tsx @@ -38,6 +38,7 @@ import IApplicationActions, * as applicationActions from "../../../../redux/acti import IAppTitleActions, * as appTitleActions from "../../../../redux/actions/appTitleActions"; import ComposeModelView from "./composeModelView"; import { ViewSelection } from "./viewSelection"; +import PreventLeaving from "../../common/preventLeaving/preventLeaving"; export interface IModelComposePageProps extends RouteComponentProps, React.Props { recentProjects: IProject[]; @@ -252,89 +253,95 @@ export default class ModelComposePage extends React.Component - -
- -
-
- - + + +
+ - {this.state.isComposing ? - - : -
- - - {this.state.nextLink && this.state.nextLink !== "*" && !this.state.hasText && -
- { - this.state.isLoading ? - - - : - - - - Load next page - - } -
} -
- } - - -
- -
-
+ isLoading={this.state.isLoading} + hasText={this.state.hasText} + handleCompose={this.onComposeButtonClick} + handleRefresh={this.onRefreshButtonClick} + filterTextChange={this.onTextChange} + /> +
+
+ + + {this.state.isComposing ? + + : +
+ + + {this.state.nextLink && this.state.nextLink !== "*" && !this.state.hasText && +
+ { + this.state.isLoading ? + + + : + + + + Load next page + + } +
} +
+ } +
+
+
+ +
+ + + } private getKey = (item: any, index?: number): string => {