OSDN Git Service

add the style for the welcome page.
authorZhiting Lin <zlin035@uottawa.ca>
Tue, 6 Nov 2018 05:42:36 +0000 (13:42 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Tue, 6 Nov 2018 05:42:36 +0000 (13:42 +0800)
src/features/backup/components/index.js
src/features/initialization/components/Index/Index.jsx
src/features/initialization/components/Index/Index.scss
src/features/initialization/components/Keystore/Keystore.jsx
src/features/initialization/components/Mnemonic/Mnemonic.jsx
src/features/initialization/components/Register/Register.jsx
src/features/initialization/components/Restore/Resotre.jsx [deleted file]
src/features/initialization/components/index.js
src/locales/en/translation.json
src/locales/zh/translation.json

index a1592c9..f3416b8 100644 (file)
 import React from 'react'
 import styles from './Index.scss'
 import { Link } from 'react-router'
+import {withNamespaces} from 'react-i18next'
+import {connect} from 'react-redux'
 
 class Index extends React.Component {
   constructor(props) {
     super(props)
+    this.state = {
+      value: null
+    }
+  }
+
+
+  setValue(event) {
+    this.setState({
+      value:event.target.value
+    })
   }
 
   render() {
+    const coreData = this.props.coreData
+    const t = this.props.t
+    if(!coreData){
+      return <ul></ul>
+    }
+
+    const networkID = coreData.networkId
+    const createButton = <Link className={`btn btn-primary ${styles.submit}`} to='/initialization/register'>{t('init.create')}</Link>
+    const restoreKeystore = <Link className={`btn btn-primary ${styles.submit}`}to='/initialization/restoreKeystore'>{t('init.restoreWallet')}</Link>
+    const restoreMnemonic = <Link className={`btn btn-primary ${styles.submit}`} to='/initialization/restoreMnemonic'>{t('init.restoreWallet')}</Link>
+
     return (
-      <div className={styles.main}>
-        <Link to='/initialization/register'>
-          Create Wallet
-        </Link>
-        <Link to='/initialization/restore'>
-          Restore Wallet
-        </Link>
+      <div onChange={e => this.setValue(e)}>
+        <h2 className={styles.title}>{t('init.welcome',{network:networkID})}</h2>
+
+        <div className={styles.choices}>
+          <div className={styles.choice_wrapper}>
+            <label>
+              <input className={styles.choice_radio_button}
+                     type='radio'
+                     name='type'
+                     value='backup'/>
+              <div className={`${styles.choice} ${styles.backup} `}>
+                <span className={styles.choice_title}>{t('init.create')}</span>
+                <p>
+                  {t('init.createDescription')}
+                </p>
+              </div>
+            </label>
+          </div>
+
+          <div className={styles.choice_wrapper}>
+            <label>
+              <input className={styles.choice_radio_button}
+                     type='radio'
+                     name='type'
+                     value='restoreKeystore' />
+              <div className={`${styles.choice} ${styles.restore}`}>
+                <span className={styles.choice_title}>{t('backup.restoreKeystore')}</span>
+                <p>
+                  {t('backup.restoreKeystoreDescription')}
+                </p>
+              </div>
+            </label>
+          </div>
+
+          <div className={styles.choice_wrapper}>
+            <label>
+              <input className={styles.choice_radio_button}
+                     type='radio'
+                     name='type'
+                     value='restoreMnemonic' />
+              <div className={`${styles.choice} ${styles.restore}`}>
+                <span className={styles.choice_title}>{t('backup.restoreMnemonic')}</span>
+                <p>
+                  {t('backup.restoreMnemonicDescription')}
+                </p>
+              </div>
+            </label>
+          </div>
+        </div>
+
+        <div className={styles.choices}>
+          <div>
+            {
+              this.state.value === 'backup'
+              &&<span className={styles.submitWrapper}>{createButton}</span>
+            }
+          </div>
+
+          <div>
+            {
+              this.state.value === 'restoreKeystore'
+              &&
+              <span className={styles.submitWrapper}>{restoreKeystore}</span>
+            }
+          </div>
+
+          <div>
+            {
+              this.state.value === 'restoreMnemonic'
+              &&  <span className={styles.submitWrapper}>{restoreMnemonic}</span>
+            }
+          </div>
+        </div>
       </div>
     )
   }
 }
 
-export default Index
+export default withNamespaces('translations') (connect(
+  (state) => ({
+    coreData:state.core.coreData
+  }),
+)(Index))
index 2e7b4ae..68a8c55 100644 (file)
   overflow: auto;
 }
 
-.choice {
-  margin-left: 10px;
+.title {
+  font-size: $font-size-h2;
+  font-weight: normal;
+  margin-top: $gutter-size;
+  margin-bottom: $gutter-size;
+  text-align: center;
+  text-transform: uppercase;
 }
 
-.image {
-  width: 150px;
+.choices {
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: space-between;
+
+  > div {
+    width: 30%;
+    min-height: 100%;
+  }
+}
+
+.choice_wrapper {
+  display: flex;
+  min-height: 100%;
+
+  > label {
+    display: flex;
+    min-height:100%;
+    font-weight: normal;
+  }
+}
+
+.choice_radio_button {
   position: absolute;
-  top: calc(50px);
-  left: calc(50% - 75px);
+  visibility: hidden;
 }
 
-.title{
+.choice {
+  border: 1px solid $table-border-color;
+  border-radius: $border-radius-base;
+  cursor: pointer;
+  min-height: 100%;
+  padding: 20px $grid-gutter-width;
+  padding-top: 110px;
   text-align: center;
-  color: white;
+
+  background-repeat: no-repeat;
+  background-position: center 25px;
+  background-size: 90px 90px;
+
+  &:hover {
+    background-color: $background-emphasis-color;
+  }
+
+  &.disabled {
+    cursor: default;
+    background-color: $background-emphasis-color;
+    opacity: 0.75;
+
+    .choice_title {
+      color: $text-light-color;
+    }
+  }
+
+  p {
+    line-height: 1.4;
+  }
+
+  svg {
+    display: block;
+    margin: 0 auto;
+    width: 80px;
+    height: 80px;
+  }
+
+  .choice_title{
+    display: block;
+    font-size: $font-size-section-title;
+    margin: 12px 0;
+    color: $text-strong-color;
+    font-weight: 600;
+  }
 }
 
-.switch {
-  display: flex;
-  justify-content: space-around;
+.backup {
+  background-image: url('images/backup/backup.svg')
+}
 
-  margin-top: 10px;
+.restore {
+  background-image: url('images/backup/restore.svg')
 }
 
-.formWarpper {
-  display: flex;
-  justify-content: space-around;
+input[type=radio]:checked ~ .choice {
+  strong {
+    color: $text-danger;
+  }
+
+  &:hover {
+    background-color: $background-color;
+  }
+
+  &.backup {
+    background-image: url('images/backup/backup-active.svg')
+  }
+
+  &.restore {
+    background-image: url('images/backup/restore-active.svg')
+  }
+
+  .choice_title {
+    color: $brand-primary;
+  }
 
+  svg {
+    polygon {
+      stroke: $brand-primary;
+      fill: transparentize($brand-primary, 0.85);
+    }
+
+    rect, path {
+      fill: $brand-primary
+    }
+  }
+}
+
+.submitWrapper {
+  display: block;
   margin-top: 30px;
 }
 
-.form {
-  background: $background-color;
-  border-radius: $border-radius-standard;
-  width: 500px;
-  padding: 30px;
+.submit {
+  display: block;
+  width: 100%;
+  margin-top: $gutter-size;
+  padding:5px 0px;
+}
+
+.infoLink {
+  position: relative;
+  left: 4px;
+  top: 1px;
+  color:$text-light-color;
 }
+
index f7d1141..6c4095e 100644 (file)
@@ -16,7 +16,7 @@ class Keystore extends React.Component {
     return (
       <div >
         <RestoreKeystore success={this.props.success}/>
-        <Link to='/initialization/restore'>
+        <Link to='/initialization/'>
           cancel
         </Link>
 
index 94d64a0..6ae02ab 100644 (file)
@@ -15,7 +15,7 @@ class Mnemonic extends React.Component {
     return (
       <div >
         <RestoreMnemonic success={this.props.success}/>
-        <Link to='/initialization/restore'>
+        <Link to='/initialization/'>
           cancel
         </Link>
       </div>
index f70a1db..888307c 100644 (file)
@@ -2,6 +2,7 @@ import React from 'react'
 import {connect} from 'react-redux'
 import {ErrorBanner, TextField, PasswordField} from 'features/shared/components'
 import actions from 'actions'
+import { Link } from 'react-router'
 import styles from './Register.scss'
 import {reduxForm} from 'redux-form'
 import {withNamespaces} from 'react-i18next'
@@ -60,6 +61,9 @@ class Register extends React.Component {
               <button type='submit' className='btn btn-primary' disabled={submitting}>
                 {t('init.register')}
               </button>
+              <Link to='/initialization/'>
+                cancel
+              </Link>
             </form>
           </div>
         </div>
diff --git a/src/features/initialization/components/Restore/Resotre.jsx b/src/features/initialization/components/Restore/Resotre.jsx
deleted file mode 100644 (file)
index 77b0503..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-import React from 'react'
-import { Link } from 'react-router'
-
-class Resotre extends React.Component {
-  constructor(props) {
-    super(props)
-  }
-
-  render() {
-    return(
-      <div>
-        <Link to='/initialization/restoreKeystore'>
-          Restore by keystore
-        </Link>
-        <Link to='/initialization/restoreMnemonic'>
-          Restore by Mnemonic
-        </Link>
-
-        <Link to='/initialization'>
-          cancel
-        </Link>
-      </div>
-    )
-  }
-}
-
-
-export default Resotre
index f624eb3..bd1b2bf 100644 (file)
@@ -4,12 +4,10 @@ import MnemonicStepper from './MnemonicStepper/MnemonicStepper'
 import Mnemonic from './Mnemonic/Mnemonic'
 import Keystore from './Keystore/Keystore'
 import Skip from './Skip/Skip'
-import Restore from './Restore/Resotre'
 
 export {
   Index,
   Register,
-  Restore,
   Mnemonic,
   Keystore,
   MnemonicStepper,
index ee60fbb..6c8b8a9 100644 (file)
     "repeatPlaceHolder":"Please repeat the key password...",
     "errorTitle":"Error in initialization",
     "mnemonic":"mnemonic",
-    "mnemonicRequire":"Mnemonic is Required"
+    "mnemonicRequire":"Mnemonic is Required",
+    "create": "Create Wallet",
+    "createDescription":"This option will create a default account, key password and give you a option to keep you mnemonic.  Warning: key seed words will display only once, it's important to remember your password.",
+    "welcome":"Welcome to Bytom __network__"
   },
   "backup":{
     "title":"Backup and Restore",
index d5f8092..45a678d 100644 (file)
     "repeatPlaceHolder":"请重复输入密钥密码...",
     "errorTitle":"初始化错误",
     "mnemonic":"助记词",
-    "mnemonicRequire":"助记词是必须项"
+    "mnemonicRequire":"助记词是必须项",
+    "create": "新建钱包",
+    "createDescription":"这个选项将生成默认的挖矿账户和默认密钥。 助记词将会在此生成,您可以选择保留助记词或者跳过。 注意: 助记词只生成一次, 请将密码,助记词妥善保存",
+    "welcome":"欢迎来到__network__"
   },
   "backup":{
     "title":"备份与恢复",