From 393c5c673acc8f674c9beb052754c0ff08453a2a Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Thu, 23 Jun 2022 17:44:17 +0100 Subject: Change login screen layout (#345) --- src/api/apiBase.ts | 23 +++++++++++++++++++++++ src/components/auth/Welcome.js | 32 ++++++++++++++++++++++---------- src/i18n/locales/en-US.json | 3 ++- src/styles/welcome.scss | 28 +++++++++++++++++++++------- 4 files changed, 68 insertions(+), 18 deletions(-) diff --git a/src/api/apiBase.ts b/src/api/apiBase.ts index 80ab99ac6..d7cc9b810 100644 --- a/src/api/apiBase.ts +++ b/src/api/apiBase.ts @@ -54,3 +54,26 @@ export function serverBase() { return fixUrl(terms); } + +export function serverName(): string { + + const serverType = (window as any).ferdium.stores.settings.all.app.server; + const noServer = 'You are using Ferdium without a server'; + + let nameServer; + switch (serverType) { + case LIVE_FRANZ_API: + nameServer = 'Franz Server'; + break; + case LIVE_FERDIUM_API: + nameServer = 'Ferdium Server'; + break; + case noServer: + nameServer = 'no Server'; + break; + default: + nameServer = 'a Custom Server'; + } + + return nameServer; +} diff --git a/src/components/auth/Welcome.js b/src/components/auth/Welcome.js index d595aef3d..18b506eba 100644 --- a/src/components/auth/Welcome.js +++ b/src/components/auth/Welcome.js @@ -5,6 +5,7 @@ import { observer, PropTypes as MobxPropTypes, inject } from 'mobx-react'; import { defineMessages, injectIntl } from 'react-intl'; import serverlessLogin from '../../helpers/serverless-helpers'; import { shuffleArray } from '../../helpers/array-helpers'; +import { serverName } from '../../api/apiBase'; import Link from '../ui/Link'; import { H1 } from '../ui/headline'; @@ -18,9 +19,13 @@ const messages = defineMessages({ id: 'welcome.loginButton', defaultMessage: 'Login to your account', }, + changeServerMessage: { + id: 'login.changeServerMessage', + defaultMessage: 'You are using {serverNameParse}, do you want to switch?' + }, changeServer: { id: 'login.changeServer', - defaultMessage: 'Change server' + defaultMessage: 'Change here!' }, serverless: { id: 'services.serverless', @@ -47,6 +52,9 @@ class Welcome extends Component { let { recipes } = this.props; recipes = shuffleArray(recipes); recipes.length = 8 * 2; + + const serverNameParse = serverName(); + return (