OSDN Git Service

add the update warning dialog
authorZhiting Lin <zlin035@uottawa.ca>
Fri, 24 Aug 2018 06:43:09 +0000 (14:43 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Fri, 24 Aug 2018 06:43:09 +0000 (14:43 +0800)
src/features/app/components/Navigation/Navigation.jsx
src/features/app/components/Navigation/Navigation.scss
src/utility/environment.js
static/images/warning.svg [new file with mode: 0755]

index 1ef2b1b..3183200 100644 (file)
@@ -4,7 +4,7 @@ import {Link} from 'react-router'
 import styles from './Navigation.scss'
 import {navIcon} from '../../utils'
 import Sync from '../Sync/Sync'
-import {docsRoot} from '../../../../utility/environment'
+import {docsRoot, releaseUrl} from '../../../../utility/environment'
 
 class Navigation extends React.Component {
   constructor(props) {
@@ -22,12 +22,17 @@ class Navigation extends React.Component {
     const lang = this.props.lang
     return (
       <div className={styles.main}>
+        {this.props.update && <div className={`${styles.updateWarning} ${styles.smallFont}`}>
+          <a href={releaseUrl} target='_blank'>
+            <img src={require('images/warning.svg')} className={styles.warningIcon} />
+            {this.props.newVersionCode}{lang === 'zh'? '版本更新': ' update available'}
+          </a>
+        </div>}
         <ul className={styles.navigation}>
           <li className={styles.navigationTitle}>{lang === 'zh' ? '核心数据' : 'core data'}</li>
           <li>
             <Link to='/transactions' activeClassName={styles.active}>
               {navIcon('transaction', styles)}
-              {}
               {lang === 'zh' ? '交易' : 'Transactions'}
             </Link>
           </li>
@@ -53,14 +58,12 @@ class Navigation extends React.Component {
 
         <ul className={styles.navigation}>
           <li className={styles.navigationTitle}>{lang === 'zh' ? '服务' : 'services' }</li>
-          {this.props.mockhsm &&
           <li>
             <Link to='/keys' activeClassName={styles.active}>
               {navIcon('mockhsm', styles)}
               {lang === 'zh' ? '密钥' : 'Keys'}
             </Link>
           </li>
-          }
         </ul>
 
         { this.props.showNavAdvance && <ul className={styles.navigation}>
@@ -104,20 +107,12 @@ class Navigation extends React.Component {
 
 export default connect(
   state => {
-    let docVersion = ''
-
-    const versionComponents = state.core.version.match('^([0-9]\\.[0-9])\\.')
-    if (versionComponents != null) {
-      docVersion = versionComponents[1]
-    }
-
     return {
+      newVersionCode: state.core.newVersionCode,
+      update: state.core.update,
       coreData: state.core.coreData,
       routing: state.routing, // required for <Link>s to update active state on navigation
-      showSync: state.core.configured && !state.core.generator,
       lang: state.core.lang,
-      mockhsm: true,
-      docVersion,
       showNavAdvance: state.app.navAdvancedState === 'advance'
     }
   },
index 7afac4f..ab8ff14 100644 (file)
   }
 }
 
+.warningIcon {
+  height: 10px;
+  padding-right: 5px;
+}
+
+.updateWarning{
+  background-color:  transparentize($background-content-color, 0.9);
+  padding: 10px $gutter-size/4;
+  color: white;
+  margin: $gutter-size/2 $gutter-size 0px;
+  border-radius: 3px;
+}
index 7dc8212..4e2782d 100644 (file)
@@ -35,3 +35,5 @@ export const UTXOpageSize = 10
 export const testnetInfoUrl = process.env.TESTNET_INFO_URL || 'https://testnet-info.chain.com'
 export const testnetUrl = process.env.TESTNET_GENERATOR_URL || 'https://testnet.chain.com'
 export const docsRoot = 'https://github.com/bytom/bytom/wiki'
+
+export const releaseUrl = 'https://github.com/Bytom/bytom/releases'
diff --git a/static/images/warning.svg b/static/images/warning.svg
new file mode 100755 (executable)
index 0000000..77a34f3
--- /dev/null
@@ -0,0 +1,10 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.817 21.301">
+  <defs>
+    <style>
+      .cls-1 {
+        fill: #feaa17;
+      }
+    </style>
+  </defs>
+  <path id="警告" class="cls-1" d="M195.6,215.759l-9.374-16.25a2.517,2.517,0,0,0-4.364,0l-9.388,16.25a2.517,2.517,0,0,0,0,2.525,2.485,2.485,0,0,0,2.182,1.263h18.775a2.514,2.514,0,0,0,2.169-3.788Zm-11.57,1.455a1.578,1.578,0,1,1,1.578-1.578A1.579,1.579,0,0,1,184.03,217.214Zm1.249-5.394a1.048,1.048,0,0,1-1.043.974h-.4a1.039,1.039,0,0,1-1.043-.974l-.508-7.439a1.054,1.054,0,0,1,1.043-1.125h1.427a1.054,1.054,0,0,1,1.043,1.125Z" transform="translate(-172.135 -198.246)"/>
+</svg>