Skip to content

Commit

Permalink
UIA withdrawal - memo postfix
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Jun 8, 2024
1 parent 3a4fe9b commit 1d56ba6
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 12 deletions.
67 changes: 57 additions & 10 deletions app/components/modules/uia/AssetEditWithdrawal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ class AssetEditWithdrawal extends React.Component {
return handle(e);
};

onPostfixChange = (e, handle, index, values, setFieldValue) => {
if (e.target.value) {
const way = values.withdrawal.ways[index]
if (way && !way.postfix_title) {
setFieldValue('withdrawal.ways[' + index + '].postfix_title',
tt('asset_edit_withdrawal_jsx.way_postfix_title_placeholder'))
}
}
return handle(e)
};

submit() {
this.submitTried = true;
};
Expand Down Expand Up @@ -100,7 +111,7 @@ class AssetEditWithdrawal extends React.Component {
};

render() {
const { name, values, handleChange, } = this.props;
const { name, values, handleChange, setFieldValue, } = this.props;

let wayFields = <FieldArray
name={`${name}.ways`}
Expand All @@ -114,8 +125,8 @@ class AssetEditWithdrawal extends React.Component {
name={`${name}.ways.${index}`}
validate={this.validateWay}
/>
<div className='row'>
<div className='column small-3'>
<div className='row way-row'>
<div className='column small-2'>
<div className='input-group'>
<Field
name={`${name}.ways.${index}.name`}
Expand All @@ -127,7 +138,7 @@ class AssetEditWithdrawal extends React.Component {
/>
</div>
</div>
<div className='column small-4'>
<div className='column small-2'>
<div className='input-group'>
<Field
name={`${name}.ways.${index}.prefix`}
Expand All @@ -139,7 +150,7 @@ class AssetEditWithdrawal extends React.Component {
/>
</div>
</div>
<div className='column small-5'>
<div className='column small-4'>
<div className='input-group'>
<Field
name={`${name}.ways.${index}.memo`}
Expand All @@ -149,6 +160,33 @@ class AssetEditWithdrawal extends React.Component {
maxLength='256'
placeholder={tt('asset_edit_withdrawal_jsx.way_memo_placeholder')}
/>
</div>
</div>
<div className='column small-1 postfix-left'>
<div className='input-group'>
<Field
name={`${name}.ways.${index}.postfix_title`}
component='input'
type='text'
className='input-group-field bold'
maxLength='64'
placeholder={tt('asset_edit_withdrawal_jsx.way_postfix_title_placeholder')}
title={tt('asset_edit_withdrawal_jsx.way_postfix_title_hint')}
/>
</div>
</div>
<div className='column small-3 postfix-right'>
<div className='input-group'>
<Field
name={`${name}.ways.${index}.postfix`}
component='input'
type='text'
className='input-group-field bold'
maxLength='64'
placeholder={tt('asset_edit_withdrawal_jsx.way_postfix_placeholder')}
title={tt('asset_edit_withdrawal_jsx.way_postfix_hint')}
onChange={e => this.onPostfixChange(e, handleChange, index, values, setFieldValue)}
/>
<Icon
className='remove-way'
name='cross'
Expand All @@ -162,7 +200,7 @@ class AssetEditWithdrawal extends React.Component {
)) : null}
<div className='add-way'>
<a
onClick={() => arrayHelpers.push({name: '', memo: '', prefix: ''})}
onClick={() => arrayHelpers.push({name: '', memo: '', prefix: '', postfix_title: '', postfix: ''})}
>
+&nbsp;{tt('asset_edit_withdrawal_jsx.way_add')}
</a>
Expand All @@ -188,16 +226,25 @@ class AssetEditWithdrawal extends React.Component {
</div>
<ErrorMessage name={`${name}.to`} component='div' className='error' />
</div>
<div className='row'>
<div className='column small-3'>
<div className='row way-row header'>
<div className='column small-2'>
{tt('asset_edit_withdrawal_jsx.way_name')}
</div>
<div className='column small-4'>
<div className='column small-2'>
{tt('asset_edit_withdrawal_jsx.way_prefix')}
<div className='secondary'>
{tt('asset_edit_withdrawal_jsx.if_need')}
</div>
</div>
<div className='column small-5'>
<div className='column small-4'>
{tt('asset_edit_withdrawal_jsx.way_memo')}
</div>
<div className='column small-4'>
{tt('asset_edit_withdrawal_jsx.way_postfix')}
<div className='secondary'>
{tt('asset_edit_withdrawal_jsx.if_need')}
</div>
</div>
</div>
{wayFields}
<div>
Expand Down
23 changes: 23 additions & 0 deletions app/components/modules/uia/AssetEditWithdrawal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@
.input-group {
margin-bottom: 1.25rem;
}
.way-row {
padding-left: 0.45rem;
.column {
padding-left: 0.5rem;
padding-right: 0.5rem;
&.postfix-left {
padding-right: 0rem;
input {
font-size: 90%;
}
}
&.postfix-right {
padding-left: 0rem;
}
}
&.header {
font-size: 85%;
.secondary {
font-size: 85%;
padding-bottom: 0.25rem;
}
}
}
.add-way {
display: block;
margin-bottom: 1.25rem;
Expand Down
3 changes: 2 additions & 1 deletion app/components/modules/uia/UpdateAsset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class UpdateAsset extends Component {
details: '',
};
if (!withdrawal.ways || !withdrawal.ways[0])
withdrawal.ways = [{ name: '', memo: '', prefix: '', }];
withdrawal.ways = [{ name: '', memo: '', prefix: '', postfix_title: '', postfix: '' }];
this.setState({
initialValues: {
fee_percent,
Expand Down Expand Up @@ -279,6 +279,7 @@ class UpdateAsset extends Component {
ref={this.aewRef}
values={values}
handleChange={handleChange}
setFieldValue={setFieldValue}
/>

<div className='row'>
Expand Down
6 changes: 6 additions & 0 deletions app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,12 @@
"way_memo_placeholder": "USDT-wallet-address",
"way_prefix": "Memo prefix: ",
"way_prefix_placeholder": "tron:",
"way_postfix": "Memo postfix: ",
"way_postfix_title_placeholder": "whom:",
"way_postfix_placeholder": "your public key",
"way_postfix_hint": "Placeholder, what user should be enter here, e.g. \"your public key\"",
"way_postfix_title_hint": "Title of field, e.g. \"whom:\"",
"if_need": "(if need)",
"way_add": "Add another method",
"way_name_error": "Specify the name of the network/system, example: USDT (TRC-20), DOGE...",
"way_prefix_error": "Do not prepend memo itself with the prefix.",
Expand Down
8 changes: 7 additions & 1 deletion app/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,14 @@
"way_name_placeholder": "USDT (TRC-20)",
"way_memo": "Заметка к переводу: ",
"way_memo_placeholder": "адрес-USDT-кошелька",
"way_prefix": "Префикс заметки (если нужен): ",
"way_prefix": "Префикс заметки: ",
"way_prefix_placeholder": "tron:",
"way_postfix": "Дополнение к заметке: ",
"way_postfix_title_placeholder": "кому:",
"way_postfix_placeholder": "ваш public key",
"way_postfix_hint": "Пояснение, что должен ввести пользователь в это поле, например \"ваш public key\"",
"way_postfix_title_hint": "Заголовок поля, например \"кому:\"",
"if_need": "(если нужно)",
"way_add": "Добавить способ вывода",
"way_name_error": "Укажите название сети/системы, например: USDT (TRC-20), AdvCash, QIWI (на телефон).",
"way_prefix_error": "Префикс не нужно указывать в самой заметке.",
Expand Down

0 comments on commit 1d56ba6

Please sign in to comment.