OSDN Git Service

update the new asset page style.
authorZhiting Lin <zlin035@uottawa.ca>
Mon, 8 Apr 2019 06:06:35 +0000 (14:06 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Mon, 8 Apr 2019 06:06:35 +0000 (14:06 +0800)
src/features/assets/components/New.jsx
src/features/assets/components/NewAssetInfo.jsx
src/features/assets/components/NewKeyAndSign.jsx
src/features/shared/components/FormContainer/FormContainer.jsx
src/locales/en/translation.json
src/locales/zh/translation.json

index 2bc844a..04c4ae9 100644 (file)
@@ -16,6 +16,10 @@ class Form extends React.Component {
     }
   }
 
+  componentWillUnmount(){
+    this.props.destroyForm()
+  }
+
   submitWithErrors(data) {
     const resultData = {
       alias: data.alias,
index 266550d..3fd58f5 100644 (file)
@@ -1,5 +1,5 @@
 import React from 'react'
-import { BaseNew, FormContainer, FormSection, TextField, RadioField } from 'features/shared/components'
+import { FormContainer, FormSection, TextField, RadioField } from 'features/shared/components'
 import { reduxForm } from 'redux-form'
 import {withNamespaces} from 'react-i18next'
 import styles from './New.scss'
@@ -39,7 +39,7 @@ class NewAssetInfo extends React.Component {
         label= { t('asset.new') }
         onSubmit={handleSubmit}
         submitting={submitting}
-        submitLabel={'N'}
+        submitLabel={t('commonWords.next')}
         >
 
         <FormSection title={t('asset.information')}>
@@ -47,20 +47,20 @@ class NewAssetInfo extends React.Component {
           <TextField title={t('form.symbol')} placeholder={t('asset.symbolPlaceholder')} fieldProps={symbol} />
           <TextField title={t('form.decimals')} placeholder={t('asset.decimalPlaceholder')} fieldProps={decimals} />
           <RadioField title={t('form.reissueTitle')} options={options} fieldProps={reissue} />
-          <label >adition info</label>
+          <label >{t('asset.additionInfo')}</label>
 
           <div className={styles.panel}>
             {description.map((descript, index) =>
               <div className={styles.subjectField}>
-                <TextField title={'key'} fieldProps={descript.key}/>
-                <TextField title={'value'} fieldProps={descript.value}/>
+                <TextField title={t('asset.additionInfoKey')} fieldProps={descript.key}/>
+                <TextField title={t('asset.additionInfoValue')} fieldProps={descript.value}/>
                 <button
                   className='btn btn-danger btn-xs'
                   tabIndex='-1'
                   type='button'
                   onClick={() => this.removeReceiverItem(index)}
                 >
-                  Remove
+                  {t('commonWords.remove')}
                 </button>
 
               </div>
@@ -70,7 +70,7 @@ class NewAssetInfo extends React.Component {
               className='btn btn-default'
               onClick={this.addReceiverItem}
             >
-              Add Field
+              {t('commonWords.addField')}
             </button>
           </div>
         </FormSection>
@@ -105,10 +105,10 @@ const validate = (values, props) => {
 
   values.description.forEach((descr, index) => {
     if (!values.description[index].value) {
-      errors.description[index] = {...errors.description[index], value: t('asset.keysError')}
+      errors.description[index] = {...errors.description[index], value: t('asset.additionInfoValueError')}
     }
     if (!values.description[index].key) {
-      errors.description[index] = {...errors.description[index], key: t('asset.keysError')}
+      errors.description[index] = {...errors.description[index], key: t('asset.additionInfoKeyError')}
     }
   })
 
index 4143bf3..062951a 100644 (file)
@@ -39,6 +39,7 @@ class NewKeyAndSign extends React.Component {
         label= { t('asset.new') }
         onSubmit={handleSubmit}
         submitting={submitting}
+        secondaryAction={prev}
         >
 
         <FormSection title={t('form.keyAndSign')}>
@@ -47,9 +48,6 @@ class NewKeyAndSign extends React.Component {
             quorum={quorum}
             quorumHint={t('asset.quorumHint')} />
         </FormSection>
-        <button type='button' onClick={prev}>
-          <i/> Previous
-        </button>
 
       </FormContainer>
     )
index 7c1a236..e05a423 100644 (file)
@@ -31,6 +31,9 @@ class FormContainer extends React.Component {
                     success={this.props.success} />}
 
                 <div className={styles.submit}>
+                  {this.props.secondaryAction && <button type='button' className='btn btn-link' onClick={this.props.secondaryAction }>
+                    { this.props.secondaryLabel ||t('commonWords.previous')}
+                  </button>}
                   <button type='submit' className='btn btn-primary' disabled={this.props.submitting || this.props.disabled}>
                     {this.props.submitLabel ||  (t('form.submit'))}
                   </button>
index 1192c57..f2cf8a2 100644 (file)
     "aliasPlaceholder":"Please entered asset alias",
     "decimalsError":"Decimals is required.",
     "decimalsTypeError":"Please enter a number.",
-    "decimalsRangeError":"Please enter a decimals number smaller or equal to 16."
+    "decimalsRangeError":"Please enter a decimals number smaller or equal to 16.",
+    "additionInfo":"Additional Info",
+    "additionInfoKey":"Description",
+    "additionInfoValue":"Value",
+    "additionInfoKeyError":"Description is required.",
+    "additionInfoValueError":"Value is required."
   },
   "commonWords": {
     "version": "Version",
@@ -36,7 +41,8 @@
     "cancel": "Cancel",
     "continue":"Continue",
     "next":"Next",
-    "previous":"Previous"
+    "previous":"Previous",
+    "addField":"Add Field"
   },
   "crumbName":{
     "transaction": "transactions",
index d6348c9..56724ee 100644 (file)
     "aliasPlaceholder":"请输入资产别名",
     "decimalsError":"精度是必须项",
     "decimalsTypeError":"请输入数字",
-    "decimalsRangeError":"精度的最大值是16。"
+    "decimalsRangeError":"精度的最大值是16。",
+    "additionInfo":"附加信息",
+    "additionInfoKey":"描述",
+    "additionInfoValue":"值",
+    "additionInfoKeyError":"描述是必须项。",
+    "additionInfoValueError":"值是必须项。"
   },
   "commonWords": {
     "version": "版本号",
@@ -36,7 +41,8 @@
     "cancel": "返回",
     "continue":"继续",
     "next":"向后",
-    "previous":"向前"
+    "previous":"向前",
+    "addField":"添加项"
   },
   "crumbName":{
     "transaction": "交易",