From ba63dbe13bcfb7dc0153e41a93f3461479c1164c Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Mon, 12 Mar 2018 16:37:49 -0500 Subject: [PATCH 1/4] Fix mutation fields --- shared/graphql/mutations/community/disableBrandedLogin.js | 4 ++-- shared/graphql/mutations/community/enableBrandedLogin.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/graphql/mutations/community/disableBrandedLogin.js b/shared/graphql/mutations/community/disableBrandedLogin.js index fefce07516..95ad4d70bb 100644 --- a/shared/graphql/mutations/community/disableBrandedLogin.js +++ b/shared/graphql/mutations/community/disableBrandedLogin.js @@ -9,7 +9,7 @@ export type DisableBrandedLoginType = { slug: string, brandedLogin: { isEnabled: boolean, - customMessage: ?string, + message: ?string, }, }, }, @@ -22,7 +22,7 @@ export const disableBrandedLoginMutation = gql` slug brandedLogin { isEnabled - customMessage + message } } } diff --git a/shared/graphql/mutations/community/enableBrandedLogin.js b/shared/graphql/mutations/community/enableBrandedLogin.js index e81eae7a07..52fba68c14 100644 --- a/shared/graphql/mutations/community/enableBrandedLogin.js +++ b/shared/graphql/mutations/community/enableBrandedLogin.js @@ -9,7 +9,7 @@ export type EnableBrandedLoginType = { slug: string, brandedLogin: { isEnabled: boolean, - customMessage: ?string, + message: ?string, }, }, }, @@ -22,7 +22,7 @@ export const enableBrandedLoginMutation = gql` slug brandedLogin { isEnabled - customMessage + message } } } From 457e274185fa5b4db4144b729af0d126fd4f938d Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Mon, 12 Mar 2018 16:45:33 -0500 Subject: [PATCH 2/4] Add loading state to save button --- .../communitySettings/components/brandedLogin.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/views/communitySettings/components/brandedLogin.js b/src/views/communitySettings/components/brandedLogin.js index 53373f8086..23e355c377 100644 --- a/src/views/communitySettings/components/brandedLogin.js +++ b/src/views/communitySettings/components/brandedLogin.js @@ -35,12 +35,14 @@ type Props = { type State = { messageValue: ?string, messageLengthError: boolean, + isLoading: boolean, }; class BrandedLogin extends React.Component { state = { messageValue: null, messageLengthError: false, + isLoading: false, }; componentDidUpdate(prevProps) { @@ -69,17 +71,21 @@ class BrandedLogin extends React.Component { }); } + this.setState({ + isLoading: true, + }); + return this.props .saveBrandedLoginSettings({ message: messageValue, id: this.props.data.community.id, }) .then(() => { - this.setState({ messageLengthError: false }); + this.setState({ messageLengthError: false, isLoading: false }); return this.props.dispatch(addToastWithTimeout('success', 'Saved!')); }) .catch(err => { - this.setState({ messageLengthError: false }); + this.setState({ messageLengthError: false, isLoading: false }); return this.props.dispatch(addToastWithTimeout('error', err)); }); }; @@ -87,7 +93,7 @@ class BrandedLogin extends React.Component { render() { const { data: { community }, isLoading } = this.props; const { messageLengthError } = this.state; - + console.log(this.state.isLoading); if (community) { const { brandedLogin } = community; return ( @@ -127,6 +133,7 @@ class BrandedLogin extends React.Component { onSubmit={this.saveCustomMessage} onClick={this.saveCustomMessage} disabled={messageLengthError} + loading={this.state.isLoading} > Save From 0dc517a17195eae05d8f92dbb431231a7289a605 Mon Sep 17 00:00:00 2001 From: uberbryn Date: Mon, 12 Mar 2018 14:52:26 -0700 Subject: [PATCH 3/4] fixes line wrapping in loginView --- src/views/communityLogin/style.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/communityLogin/style.js b/src/views/communityLogin/style.js index 7a9ed6a4ba..15e9217cca 100644 --- a/src/views/communityLogin/style.js +++ b/src/views/communityLogin/style.js @@ -24,7 +24,7 @@ export const Subtitle = styled.h2` margin-bottom: 16px; padding: 0 32px; text-align: center; - white-space: pre; + white-space: pre-wrap; b { font-weight: 700; From 0ac88d1a97c77761c8b092aef94932bf4af141b3 Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Mon, 12 Mar 2018 19:42:49 -0500 Subject: [PATCH 4/4] Remove console log --- src/views/communitySettings/components/brandedLogin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/communitySettings/components/brandedLogin.js b/src/views/communitySettings/components/brandedLogin.js index 23e355c377..ea59254299 100644 --- a/src/views/communitySettings/components/brandedLogin.js +++ b/src/views/communitySettings/components/brandedLogin.js @@ -93,7 +93,7 @@ class BrandedLogin extends React.Component { render() { const { data: { community }, isLoading } = this.props; const { messageLengthError } = this.state; - console.log(this.state.isLoading); + if (community) { const { brandedLogin } = community; return (