aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content
diff options
context:
space:
mode:
authorDan Miller <danjm.com@gmail.com>2018-08-03 00:02:22 +0800
committerDan Miller <danjm.com@gmail.com>2018-12-04 11:36:04 +0800
commit342dc95410b10f042b3f8ee4135f5fef1fd6fe93 (patch)
tree83f6e8a0500e91fef1fdc9f460c03dc638e33f99 /ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content
parent5e7409482b6fc55eafc330e4bc119f7485f068bb (diff)
downloadtangerine-wallet-browser-342dc95410b10f042b3f8ee4135f5fef1fd6fe93.tar.gz
tangerine-wallet-browser-342dc95410b10f042b3f8ee4135f5fef1fd6fe93.tar.zst
tangerine-wallet-browser-342dc95410b10f042b3f8ee4135f5fef1fd6fe93.zip
Adds the content of the advanced tab - w/o chart or dynamic content - to gas customize modal.
Diffstat (limited to 'ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content')
-rw-r--r--ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js105
-rw-r--r--ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/index.js1
-rw-r--r--ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/index.scss109
-rw-r--r--ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/index.js1
-rw-r--r--ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/index.scss13
-rw-r--r--ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/time-remaining.component.js33
-rw-r--r--ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/time-remaining.utils.js11
7 files changed, 273 insertions, 0 deletions
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js
new file mode 100644
index 000000000..7ddf13e51
--- /dev/null
+++ b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js
@@ -0,0 +1,105 @@
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+import {
+ MIN_GAS_PRICE_DEC,
+ MIN_GAS_LIMIT_DEC,
+} from '../../../send/send.constants'
+import GasSlider from '../../gas-slider'
+import TimeRemaining from './time-remaining'
+
+export default class AdvancedTabContent extends Component {
+ static contextTypes = {
+ t: PropTypes.func,
+ }
+
+ static propTypes = {
+ updateCustomGasPrice: PropTypes.func,
+ updateCustomGasLimit: PropTypes.func,
+ customGasPrice: PropTypes.number,
+ customGasLimit: PropTypes.number,
+ millisecondsRemaining: PropTypes.number,
+ }
+
+ gasInput (value, onChange, min, precision, showGWEI) {
+ return (
+ <div className="advanced-tab__gas-edit-row__input-wrapper">
+ <input
+ className="advanced-tab__gas-edit-row__input"
+ type="number"
+ value={value}
+ onChange={event => onChange(Number(event.target.value))}
+ />
+ {showGWEI
+ ? <span className="advanced-tab__gas-edit-row__gwei-symbol">GWEI</span>
+ : null}
+ </div>
+ )
+ }
+
+ infoButton (onClick) {
+ return <i className="fa info-circle" onClick={onClick} />
+ }
+
+ render () {
+ const {
+ updateCustomGasPrice,
+ updateCustomGasLimit,
+ millisecondsRemaining,
+ customGasPrice,
+ customGasLimit,
+ } = this.props
+
+ return (
+ <div className="advanced-tab">
+ <div className="advanced-tab__transaction-data-summary">
+ <div className="advanced-tab__transaction-data-summary__titles">
+ <span>New Transaction Fee</span>
+ <span>~Transaction Time</span>
+ </div>
+ <div className="advanced-tab__transaction-data-summary__container">
+ <div className="advanced-tab__transaction-data-summary__fee">
+ $0.30
+ </div>
+ <TimeRemaining
+ milliseconds={millisecondsRemaining}
+ />
+ </div>
+ </div>
+ <div className="advanced-tab__fee-chart-title">
+ Live Transaction Fee Predictions
+ </div>
+ <div className="advanced-tab__fee-chart" />
+ <div className="advanced-tab__slider-container">
+ <GasSlider
+ onChange={value => {
+ updateCustomGasPrice(Number(value))
+ }}
+ lowLabel={'Cheaper'}
+ highLabel={'Faster'}
+ value={customGasPrice}
+ step={0.1}
+ max={200}
+ min={0}
+ coloredStart={{}}
+ />
+ </div>
+ <div className="advanced-tab__gas-edit-rows">
+ <div className="advanced-tab__gas-edit-row">
+ <div className="advanced-tab__gas-edit-row__label">
+ Gas Price
+ { this.infoButton(() => {}) }
+ </div>
+ { this.gasInput(customGasPrice, updateCustomGasPrice, MIN_GAS_PRICE_DEC, 9, true) }
+ </div>
+ <div className="advanced-tab__gas-edit-row">
+ <div className="advanced-tab__gas-edit-row__label">
+ Gas Limit
+ { this.infoButton(() => {}) }
+ </div>
+ { this.gasInput(customGasLimit, updateCustomGasLimit, MIN_GAS_LIMIT_DEC, 0) }
+ </div>
+ </div>
+ </div>
+ )
+ }
+}
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/index.js b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/index.js
new file mode 100644
index 000000000..492037f25
--- /dev/null
+++ b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/index.js
@@ -0,0 +1 @@
+export { default } from './advanced-tab-content.component'
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/index.scss b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/index.scss
new file mode 100644
index 000000000..5dc30e061
--- /dev/null
+++ b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/index.scss
@@ -0,0 +1,109 @@
+@import './time-remaining/index';
+
+.advanced-tab {
+ display: flex;
+ flex-flow: column;
+ border-bottom: 1px solid $alto;
+
+ &__transaction-data-summary,
+ &__fee-chart-title,
+ &__gas-edit-row {
+ padding-left: 24px;
+ padding-right: 24px;
+ }
+
+ &__transaction-data-summary {
+ display: flex;
+ flex-flow: column;
+ color: $mid-gray;
+ margin-top: 12px;
+
+ &__titles,
+ &__container {
+ display: flex;
+ flex-flow: row;
+ justify-content: space-between;
+ font-size: 12px;
+ }
+
+ &__container {
+ font-size: 26px;
+ margin-top: 6px;
+ }
+ }
+
+ &__fee-chart-title {
+ font-size: 14px;
+ color: $scorpion;
+ margin-top: 22px;
+ }
+
+ &__fee-chart {
+ padding-left: 10px;
+ margin-top: 24px;
+ height: 134px;
+ }
+
+ &__slider-container {
+ padding-left: 27px;
+ padding-right: 27px;
+ }
+
+ &__gas-edit-rows {
+ margin-top: 44px;
+ height: 87px;
+ display: flex;
+ flex-flow: column;
+ justify-content: space-between;
+ }
+
+ &__gas-edit-row {
+ display: flex;
+ flex-flow: row;
+ justify-content: space-between;
+
+ &__label {
+ color: $mid-gray;
+ font-size: 16px;
+
+ .info-circle {
+ color: $silver;
+ margin-left: 10px;
+ }
+ }
+
+
+ &__input-wrapper {
+ position: relative;
+ }
+
+ &__input {
+ border: 1px solid $dusty-gray;
+ border-radius: 4px;
+ color: $mid-gray;
+ font-size: 16px;
+ height: 37px;
+ width: 163px;
+ padding: 8px 10px 10px 10px;
+ }
+
+ input[type="number"]::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ display: none;
+ }
+
+ input[type="number"]:hover::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ display: none;
+ }
+
+ &__gwei-symbol {
+ position: absolute;
+ top: 8px;
+ right: 10px;
+ color: $dusty-gray;
+ }
+ }
+} \ No newline at end of file
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/index.js b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/index.js
new file mode 100644
index 000000000..61b681e1a
--- /dev/null
+++ b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/index.js
@@ -0,0 +1 @@
+export { default } from './time-remaining.component'
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/index.scss b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/index.scss
new file mode 100644
index 000000000..01bb06268
--- /dev/null
+++ b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/index.scss
@@ -0,0 +1,13 @@
+.time-remaining {
+ .minutes-num, .seconds-num {
+ font-size: 26px;
+ }
+
+ .seconds-num {
+ margin-left: 7px;
+ }
+
+ .minutes-label, .seconds-label {
+ font-size: 14px;
+ }
+} \ No newline at end of file
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/time-remaining.component.js b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/time-remaining.component.js
new file mode 100644
index 000000000..826d41f9c
--- /dev/null
+++ b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/time-remaining.component.js
@@ -0,0 +1,33 @@
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+import { getTimeBreakdown } from './time-remaining.utils'
+
+export default class TimeRemaining extends Component {
+ static contextTypes = {
+ t: PropTypes.func,
+ }
+
+ static propTypes = {
+ milliseconds: PropTypes.number,
+ }
+
+ render () {
+ const {
+ milliseconds,
+ } = this.props
+
+ const {
+ minutes,
+ seconds,
+ } = getTimeBreakdown(milliseconds)
+
+ return (
+ <div className="time-remaining">
+ <span className="minutes-num">{minutes}</span>
+ <span className="minutes-label">{this.context.t('minutesShorthand')}</span>
+ <span className="seconds-num">{seconds}</span>
+ <span className="seconds-label">{this.context.t('secondsShorthand')}</span>
+ </div>
+ )
+ }
+}
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/time-remaining.utils.js b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/time-remaining.utils.js
new file mode 100644
index 000000000..cf43e0acb
--- /dev/null
+++ b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/time-remaining/time-remaining.utils.js
@@ -0,0 +1,11 @@
+function getTimeBreakdown (milliseconds) {
+ return {
+ hours: Math.floor(milliseconds / 3600000),
+ minutes: Math.floor((milliseconds % 3600000) / 60000),
+ seconds: Math.floor((milliseconds % 60000) / 1000),
+ }
+}
+
+module.exports = {
+ getTimeBreakdown,
+}