From f09fbccc1917ff6d9da5d5169c795a9826c84381 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 23 Oct 2017 00:56:15 +0100 Subject: [PATCH] WIP --- src/UserSettingsStore.js | 15 ++++++ src/components/structures/login/Login.js | 37 ++++++++++----- src/components/views/login/LoginPageFooter.js | 30 ++++++++++++ src/components/views/login/LoginPageHeader.js | 47 +++++++++++++++++++ src/i18n/strings/en_EN.json | 1 + 5 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 src/components/views/login/LoginPageFooter.js create mode 100644 src/components/views/login/LoginPageHeader.js diff --git a/src/UserSettingsStore.js b/src/UserSettingsStore.js index 68f463c373..ede5a157a8 100644 --- a/src/UserSettingsStore.js +++ b/src/UserSettingsStore.js @@ -180,6 +180,21 @@ export default { }); }, + getTheme: function() { + let syncedSettings; + let theme; + if (MatrixClientPeg.get()) { + syncedSettings = this.getSyncedSettings(); + } + if (!syncedSettings || !syncedSettings.theme) { + theme = SdkConfig.get().default_theme || 'light'; + } + else { + theme = syncedSettings.theme; + } + return theme; + }, + getSyncedSettings: function() { const event = MatrixClientPeg.get().getAccountData('im.vector.web.settings'); return event ? event.getContent() : {}; diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js index 8ee6eafad4..eb131989a8 100644 --- a/src/components/structures/login/Login.js +++ b/src/components/structures/login/Login.js @@ -329,13 +329,17 @@ module.exports = React.createClass({ render: function() { const Loader = sdk.getComponent("elements.Spinner"); + const LoginPageHeader = sdk.getComponent("login.LoginPageHeader"); + const LoginPageFooter = sdk.getComponent("login.LoginPageFooter"); const LoginHeader = sdk.getComponent("login.LoginHeader"); const LoginFooter = sdk.getComponent("login.LoginFooter"); const ServerConfig = sdk.getComponent("login.ServerConfig"); const loader = this.state.busy ?
: null; + const theme = UserSettingsStore.getTheme(); + let loginAsGuestJsx; - if (this.props.enableGuest) { + if (this.props.enableGuest && theme !== 'status') { loginAsGuestJsx = { _t('Login as guest') } @@ -343,42 +347,49 @@ module.exports = React.createClass({ } let returnToAppJsx; - if (this.props.onCancelClick) { + if (this.props.onCancelClick && theme !== 'status') { returnToAppJsx = { _t('Return to app') } ; } + let serverConfig; + if (theme !== 'status') { + serverConfig = ; + } + return (
+
-

{ _t('Sign in') } +

{ theme !== 'status' ? _t('Sign in') : _t('Sign in to get started') } { loader }

- { this.componentForStep(this.state.currentFlow) } -
{ this.state.errorText }
+ { this.componentForStep(this.state.currentFlow) } + { serverConfig } { _t('Create an account') } { loginAsGuestJsx } { returnToAppJsx } - { this._renderLanguageSetting() } + { theme !== 'status' ? this._renderLanguageSetting() : '' }
+
); }, diff --git a/src/components/views/login/LoginPageFooter.js b/src/components/views/login/LoginPageFooter.js new file mode 100644 index 0000000000..e4eca9b8b3 --- /dev/null +++ b/src/components/views/login/LoginPageFooter.js @@ -0,0 +1,30 @@ +/* +Copyright 2015, 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +'use strict'; + +import { _t } from '../../../languageHandler'; +import React from 'react'; + +module.exports = React.createClass({ + displayName: 'LoginPageFooter', + + render: function() { + return ( +
+ ); + }, +}); diff --git a/src/components/views/login/LoginPageHeader.js b/src/components/views/login/LoginPageHeader.js new file mode 100644 index 0000000000..bef7fa5e0b --- /dev/null +++ b/src/components/views/login/LoginPageHeader.js @@ -0,0 +1,47 @@ +/* +Copyright 2015, 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +'use strict'; + +import UserSettingsStore from '../../../UserSettingsStore'; + +const React = require('react'); + +module.exports = React.createClass({ + displayName: 'LoginPageHeader', + + render: function() { + let themeBranding; + if (UserSettingsStore.getTheme() === 'status') { + themeBranding =
+
+ Status +
+
+

Status Community Chat

+
+ A safer, decentralised communication platform powered by Riot +
+
+
; + } + else { + themeBranding =
; + } + + return themeBranding; + }, +}); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index f071d42f56..db13972c9f 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -475,6 +475,7 @@ "Sign in with": "Sign in with", "Email address": "Email address", "Sign in": "Sign in", + "Sign in to get started": "Sign in to get started", "If you don't specify an email address, you won't be able to reset your password. Are you sure?": "If you don't specify an email address, you won't be able to reset your password. Are you sure?", "Email address (optional)": "Email address (optional)", "You are registering with %(SelectedTeamName)s": "You are registering with %(SelectedTeamName)s",