OSDN Git Service

add the transactions for empty list.
authorZhiting Lin <zlin035@uottawa.ca>
Thu, 19 Apr 2018 01:38:39 +0000 (09:38 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Thu, 19 Apr 2018 01:38:39 +0000 (09:38 +0800)
src/features/shared/components/BaseList/BaseList.jsx
src/features/shared/components/BaseList/EmptyList.jsx

index 1988c0f..8a4ae31 100644 (file)
@@ -9,7 +9,6 @@ import EmptyList from './EmptyList'
 class ItemList extends React.Component {
   render() {
     const label = this.props.label || pluralize(humanize(this.props.type))
-    const objectName = label.slice(0,-1)
     const actions = [...(this.props.actions || [])]
     const lang = this.props.lang
 
@@ -21,6 +20,15 @@ class ItemList extends React.Component {
       'unspent outputs': 'UTXO',
       Keys: lang === 'zh' ? '密钥' : 'Keys'
     }
+    const objectNameZh = {
+      transactions: '交易' ,
+      accounts: '账户',
+      assets: '资产',
+      balances: '余额' ,
+      'unspent outputs': '未完成输出',
+      Keys: '密钥'
+    }
+    const objectName = lang === 'zh' ? objectNameZh[label] :label.slice(0,-1)
     const title = labelTitleMap[label] || capitalize(label)
 
     const newButton = <button key='showCreate' className='btn btn-primary' onClick={this.props.showCreate}>
@@ -51,7 +59,8 @@ class ItemList extends React.Component {
             newButton={newButton}
             showFirstTimeFlow={this.props.showFirstTimeFlow}
             skipCreate={this.props.skipCreate}
-            loadedOnce={this.props.loadedOnce} />
+            loadedOnce={this.props.loadedOnce}
+            lang={lang} />
 
         </div>
       )
index 61fde98..ff4a619 100644 (file)
@@ -14,11 +14,11 @@ class EmptyList extends React.Component {
 
     let emptyBlock
     if (!this.props.loadedOnce) {
-      emptyBlock = <span>LOADING…</span>
+      emptyBlock = <span>{lang === 'zh' ? '加载中': 'LOADING'}…</span>
     } else if (this.props.showFirstTimeFlow) {
       emptyBlock = <div>
         <span className={`${styles.emptyLabel} ${styles.noResultsLabel}`}>
-          There are no {this.props.objectName}s
+          {lang === 'zh' ? `没有${this.props.objectName}记录`: `There are no ${this.props.objectName}s`}
         </span>
       </div>
     }