Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(improvements) Add account section #635

Merged
merged 71 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
a61ec97
Enable isPersisted by default
Apr 11, 2023
65e5266
Adjust bfx logo size
Apr 11, 2023
5e907d0
Remove unused checkbox
Apr 11, 2023
88e81d7
Actualize add account section header
Apr 11, 2023
d0cfbb1
Improve auth dialog sizing
Apr 11, 2023
8240365
Actualize pwd protection description
Apr 11, 2023
6f92fbd
Lint fix
Apr 11, 2023
11f83c6
Improve checkbox styling
Apr 11, 2023
227705c
Actualize auth dialog spacing
Apr 11, 2023
d4f2561
Update platform logo styling
Apr 11, 2023
cb3a9ef
Adjust input key height
Apr 11, 2023
4fbbc85
Actualize secondary text color
Apr 11, 2023
c7025d6
Improve checkbox labels styling
Apr 11, 2023
5a8d386
[wip] LoginApiKey section
Apr 12, 2023
b52130a
Actualize fields and prop-types
Apr 12, 2023
2b08a00
Rework use api key with unified sub-section
Apr 12, 2023
5016e53
Improve input handler naming
Apr 12, 2023
c627ae4
Improve key_url handling
Apr 12, 2023
4771d77
Unused component cleanup
Apr 12, 2023
51a54df
Improve link splitting
Apr 12, 2023
11d196e
Rework api note without callout
Apr 12, 2023
908b64f
Improve api key note spacing
Apr 12, 2023
0a56a17
Update locales
Apr 12, 2023
32699e8
Actualize api key/secret fields labels
Apr 12, 2023
310affe
Add showLoginPassword checker
Apr 12, 2023
db9ff08
[wip] Login password sub-section
Apr 12, 2023
96e032e
Add pwd error labels, actualize prop-types
Apr 12, 2023
fba181d
Rework passwords with unified sub-component
Apr 12, 2023
be77cce
Lint fix
Apr 12, 2023
ee95493
Improve checkboxes aligning
Apr 12, 2023
2e6627a
Update spacing
Apr 12, 2023
4395fea
Add toggleUseApiKey handler
Apr 12, 2023
14294cd
Update auth keys & descriptions
Apr 12, 2023
c1ff93a
Improve footer items alighning
Apr 12, 2023
ee7d01e
Actualize mode switch link color
Apr 12, 2023
d18a39f
Implement login mode switch, cleanup
Apr 12, 2023
ffd3be6
Add mode switch dynamic labeling
Apr 12, 2023
1935e2e
Update auth btn size
Apr 12, 2023
bc0b452
Improve mode swicth aligning
Apr 12, 2023
42f19c0
Update footer sub-sections styling
Apr 12, 2023
2d50c2c
Update api key swicth classnames
Apr 13, 2023
846114b
Add api switch link styling
Apr 13, 2023
895696e
Improve footer actions section positioning
Apr 13, 2023
855370b
Update auth modes switcher
Apr 13, 2023
e525dd9
Lint fix
Apr 13, 2023
f80ca0d
Add sign in to existing acc key/description
Apr 13, 2023
42a432a
Update mode switcher link description
Apr 13, 2023
61c3fbc
Improve footer link spacing
Apr 13, 2023
bd72c10
Update swicth mode styling
Apr 13, 2023
363be2e
Add sign in section switch icon
Apr 13, 2023
3153a94
Adjust sign-in icon
Apr 13, 2023
3f1be30
Improve icon styling, unused styles cleanup
Apr 13, 2023
c87de20
Adjust signup elements
Apr 14, 2023
a0d7520
Fix sub-users list spacing
Apr 14, 2023
e53fd69
Remove remember me checkbox from sign in
Apr 14, 2023
95febf2
Improve checkox spacing
Apr 14, 2023
3fca76d
Remove redundant wrapper and unused element
Apr 14, 2023
88ea76b
Rework sub-accs mode switcher
Apr 14, 2023
e5a805a
Improve spacing
Apr 14, 2023
ac8c40f
Lint fix
Apr 14, 2023
36bae33
Add toggle api key render check
Apr 14, 2023
4a761f0
Implement unified auth mode switcher
Apr 17, 2023
5791fde
Remove unused import
Apr 17, 2023
d156ef8
Improve sign up mode switching
Apr 17, 2023
d055cdb
Cleanup
Apr 17, 2023
b4dc3c4
Make mode switcher icon customizable
Apr 17, 2023
5d576f0
Update sign up footer actions config
Apr 17, 2023
0d3b643
Wrap api note into callout
Apr 18, 2023
250445c
Adjust info icon
Apr 18, 2023
b9625f2
Add api callout icon
Apr 18, 2023
7bca358
Improve callout styling
Apr 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion public/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@
"invalidToken": "Invalid token, please try again",
"loginSessionExpired": "Your login session has expired, please try again"
},
"apiKey": "API Key",
"apiSecret": "API Secret",
"accWithApiKey": "Add account with API key",
"accWithoutApiKey": "Add account without API key",
"simpleAccounts": "Simple Accounts",
"multipleAccounts": "Multiple Accounts",
"signUp": "Sign Up",
"signIn": "Sign In",
"signInToExistingAcc": "Sign in to an existing account",
"selectMasterAccount": "Select Master Account",
"passwordRecovery": "Password Recovery",
"subAccount": "Sub Account",
Expand All @@ -57,7 +62,7 @@
"checkAuth": "Check Auth",
"note1": "Visit ",
"note2": " to get the readonly API key and secret pair.",
"passwordProtection": "Enable password protection",
"passwordProtection": "Require Password on Login",
"passwordLengthValidationError": "The password must be at least 8 characters long",
"passwordCharactersValidationError": "The password must include both uppercase and lowercase characters",
"passwordRepeatValidationError": "The password does not match",
Expand Down
1 change: 1 addition & 0 deletions src/components/Auth/InputKey/_InputKey.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
}

.bp3-input {
height: 40px;
padding: 0 15px;
font-size: 15px;

Expand Down
57 changes: 57 additions & 0 deletions src/components/Auth/LoginApiKey/LoginApiKey.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React, { memo } from 'react'
import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import { Callout } from '@blueprintjs/core'
import _split from 'lodash/split'

import Icon from 'icons'
import config from 'config'

import InputKey from '../InputKey'

const { KEY_URL } = config

export const LoginApiKey = ({
apiKey,
onChange,
apiSecret,
}) => {
const { t } = useTranslation()
return (
<>
<Callout icon={<Icon.INFO_CIRCLE />}>
<div className='api-key-note'>
{t('auth.note1')}
<a
href={KEY_URL}
target='_blank'
rel='noopener noreferrer'
>
{_split(KEY_URL, 'https://')[1]}
</a>
{t('auth.note2')}
</div>
</Callout>
<InputKey
name='apiKey'
value={apiKey}
label='auth.apiKey'
onChange={onChange}
/>
<InputKey
name='apiSecret'
value={apiSecret}
label='auth.apiSecret'
onChange={onChange}
/>
</>
)
}

LoginApiKey.propTypes = {
onChange: PropTypes.func.isRequired,
apiKey: PropTypes.string.isRequired,
apiSecret: PropTypes.string.isRequired,
}

export default memo(LoginApiKey)
1 change: 1 addition & 0 deletions src/components/Auth/LoginApiKey/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './LoginApiKey'
40 changes: 40 additions & 0 deletions src/components/Auth/LoginPassword/LoginPassword.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React, { memo } from 'react'
import PropTypes from 'prop-types'

import InputKey from '../InputKey'
import ErrorLabel from '../ErrorLabel'

export const LoginPassword = ({
onChange,
password,
passwordError,
passwordRepeat,
passwordRepeatError,
}) => (
<>
<InputKey
name='password'
value={password}
onChange={onChange}
label='auth.enterPassword'
/>
<ErrorLabel text={passwordError} />
<InputKey
onChange={onChange}
name='passwordRepeat'
value={passwordRepeat}
label='auth.repeatPassword'
/>
<ErrorLabel text={passwordRepeatError} />
</>
)

LoginPassword.propTypes = {
onChange: PropTypes.func.isRequired,
password: PropTypes.string.isRequired,
passwordError: PropTypes.string.isRequired,
passwordRepeat: PropTypes.string.isRequired,
passwordRepeatError: PropTypes.string.isRequired,
}

export default memo(LoginPassword)
1 change: 1 addition & 0 deletions src/components/Auth/LoginPassword/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './LoginPassword'
32 changes: 32 additions & 0 deletions src/components/Auth/ModeSwitcher/ModeSwitcher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { memo } from 'react'
import PropTypes from 'prop-types'

export const ModeSwitcher = ({
icon,
mode,
title,
switchMode,
}) => (
<div className='auth-mode-switch-wrapper'>
<div
onClick={() => switchMode(mode)}
className='bitfinex-auth-mode-switch'
>
{icon}
{title}
</div>
</div>
)

ModeSwitcher.propTypes = {
icon: PropTypes.node,
mode: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
switchMode: PropTypes.func.isRequired,
}

ModeSwitcher.defaultProps = {
icon: null,
}

export default memo(ModeSwitcher)
1 change: 1 addition & 0 deletions src/components/Auth/ModeSwitcher/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './ModeSwitcher'
27 changes: 8 additions & 19 deletions src/components/Auth/PasswordRecovery/PasswordRecovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ class PasswordRecovery extends PureComponent {
password,
passwordRepeat,
isPasswordProtected,
isPersisted,
passwordError,
passwordRepeatError,
useApiKey,
Expand Down Expand Up @@ -266,24 +265,14 @@ class PasswordRecovery extends PureComponent {
</>
)}
<div className='bitfinex-auth-checkboxes'>
<div className='bitfinex-auth-checkboxes--group'>
<Checkbox
name='useApiKey'
checked={useApiKey}
onChange={this.handleCheckboxChange}
className='bitfinex-auth-remember-me'
>
{t('auth.useApiKey')}
</Checkbox>
<Checkbox
className='bitfinex-auth-remember-me'
name='isPersisted'
checked={isPersisted}
onChange={this.handleCheckboxChange}
>
{t('auth.rememberMe')}
</Checkbox>
</div>
<Checkbox
name='useApiKey'
checked={useApiKey}
onChange={this.handleCheckboxChange}
className='bitfinex-auth-remember-me'
>
{t('auth.useApiKey')}
</Checkbox>
{showPasswordProtection && (
<Checkbox
className='bitfinex-auth-remember-me'
Expand Down
17 changes: 11 additions & 6 deletions src/components/Auth/RegisterSubAccounts/RegisterSubAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const prepareMasterAccUsers = (users) => _map(
user => user.email,
)

const { showFrameworkMode } = config

class RegisterSubAccounts extends PureComponent {
static propTypes = {
authType: PropTypes.string.isRequired,
Expand Down Expand Up @@ -136,12 +138,15 @@ class RegisterSubAccounts extends PureComponent {
</div>
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
{config.showFrameworkMode && users.length > 0 && (
<div
className='bitfinex-auth-mode-switch'
onClick={() => switchMode(MODES.SIGN_IN)}
>
{t('auth.signIn')}
{showFrameworkMode && users.length > 0 && (
<div className='auth-mode-switch-wrapper'>
<div
className='bitfinex-auth-mode-switch'
onClick={() => switchMode(MODES.SIGN_IN)}
>
<Icon.SIGN_IN />
{t('auth.signInToExistingAcc')}
</div>
</div>
)}
</div>
Expand Down
11 changes: 0 additions & 11 deletions src/components/Auth/SignIn/SignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ class SignIn extends PureComponent {
userShouldReLogin,
isMultipleAccsSelected,
isElectronBackendLoaded,
authData: { isPersisted },
} = this.props
const {
otp,
Expand Down Expand Up @@ -268,16 +267,6 @@ class SignIn extends PureComponent {
/>
)}
<div className='bitfinex-auth-checkboxes'>
{isEmailSelected && (
<Checkbox
name='isPersisted'
checked={isPersisted}
onChange={this.togglePersistence}
className='bitfinex-auth-remember-me bitfinex-auth-remember-me--sign-in'
>
{t('auth.rememberMe')}
</Checkbox>
)}
{showSubAccount && (
<Checkbox
disabled
Expand Down
Loading