Skip to content

Commit

Permalink
Merge brach 'master' into 'desktop'
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed Jul 20, 2019
2 parents 772b0c2 + 9f0fe65 commit ce10806
Show file tree
Hide file tree
Showing 30 changed files with 2,462 additions and 1,819 deletions.
6 changes: 6 additions & 0 deletions assets/img/icon-delegate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions assets/img/icon-feature-mining.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions assets/img/icon-unbond.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/less/include/general.less
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ dd {overflow-wrap: break-word; margin: 0;}
.form-field__help {
font-size: 12px; line-height: 16px; margin-top: 6px; display: block; color: @c-black-light;
.form-field__error + & {margin-top: 0;}
&.u-cell {margin-top: 0;}
&.u-cell {margin-top: 0; line-height: 18px;}
}
.error-text() {font-size: 12px; color: @c-red; line-height: 16px;}
.form-field__error {.error-text(); margin-top: 6px; overflow-wrap: break-word; display: block;}
Expand Down
12 changes: 6 additions & 6 deletions assets/less/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
.main-wrap {display: flex; flex-direction: column; min-height: 100vh; position: relative;}
.main-content {width: 100%; flex-grow: 2;}
.main-content--grid {}
.main-content__aside {position: absolute; z-index: 1; top: @header-height; min-height: calc(100% - @header-height); overflow: auto; background: #fff;}
.main-content__aside {position: absolute; z-index: 2; /* higher than input buttons */ top: @header-height; min-height: calc(100% - @header-height); overflow: auto; background: #fff;}
.main-content__aside-section {padding-top: 24px; padding-bottom: 24px;}
.main-content__main {}
@media (min-width: @breakpoint-medium-up) {
Expand Down Expand Up @@ -186,20 +186,20 @@


// footer
.footer {background: #3c3c3c; color: #fff; padding: 38px 0; width: 100%;}
.footer {background: #3c3c3c; color: #fff; padding: 34px 0; width: 100%;}
.footer__container {display: flex; justify-content: center; flex-wrap: wrap;}
.footer__logo-link {}
.footer__logo {width: 76px; display: block;}
.footer__menu {width: 100%; margin-top: 20px; text-align: center;}
.footer__logo {display: block; margin: -4px 0 20px;}
.footer__menu {width: 100%; text-align: center;}
.footer__menu-item {
font-size: 14px; font-weight: 700; display: inline-block;
&::after {content: ' | '; /* mid spaces U+2005, bc. last regular space not preserved */ margin: 0 3px;}
&:last-child::after {content: none;}
}
@media (min-width: @breakpoint-large-up) {
.footer__container {align-items: center; justify-content: space-between;}
.footer__logo {margin-top: -8px;}
.footer__menu {width: auto; margin-top: 0;}
.footer__logo {margin: 0 0 8px;}
.footer__menu {width: auto;}
}


Expand Down
33 changes: 26 additions & 7 deletions assets/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import parseISO from "date-fns/esm/parseISO";
import format from "date-fns/esm/format";
import decode from 'entity-decode';
import prettyNum, {PRECISION_SETTING} from 'pretty-num';
import prettyNum, {PRECISION_SETTING, ROUNDING_MODE} from 'pretty-num';
import stripZeros from 'pretty-num/src/strip-zeros';
import fromExponential from 'from-exponential';
import {txTypeList} from 'minterjs-tx/src/tx-types';
Expand Down Expand Up @@ -75,14 +75,15 @@ export function getExplorerValidatorUrl(pubKey) {

/**
* @param {string|number} value
* @param {ROUNDING_MODE} [roundingMode]
* @return {string}
*/
export function pretty(value) {
export function pretty(value, roundingMode) {
const PRECISION = 2;
if (value >= 1 || value <= -1 || Number(value) === 0) {
return decode(prettyNum(value, {precision: PRECISION, precisionSetting: PRECISION_SETTING.FIXED, thousandsSeparator: '&#x202F;'}));
return decode(prettyNum(value, {precision: PRECISION, precisionSetting: PRECISION_SETTING.FIXED, roundingMode, thousandsSeparator: '&#x202F;'}));
} else {
value = decode(prettyNum(value, {precision: PRECISION, precisionSetting: PRECISION_SETTING.REDUCE_SIGNIFICANT, thousandsSeparator: '&#x202F;'}));
value = decode(prettyNum(value, {precision: PRECISION, precisionSetting: PRECISION_SETTING.REDUCE_SIGNIFICANT, roundingMode, thousandsSeparator: '&#x202F;'}));
value = value.substr(0, 10);
if (value === '0.00000000') {
return '0.00';
Expand All @@ -91,22 +92,40 @@ export function pretty(value) {
}
}

/**
* @param {string|number} value
* @return {string}
*/
export function prettyCeil(value) {
return decode(prettyNum(value, {precision: 2, precisionSetting: PRECISION_SETTING.FIXED, roundingMode: ROUNDING_MODE.CEIL, thousandsSeparator: '&#x202F;'}));
}

/**
* Ensure value to have from 2 to 8 decimal digits
* @param {string|number} value
* @param {ROUNDING_MODE} [roundingMode]
* @return {string}
*/
export function prettyPrecise(value) {
export function prettyPrecise(value, roundingMode) {
const parts = stripZeros(fromExponential(value)).split('.');
const isReduced = parts[1] && parts[1].length > 2;
if (isReduced) {
return decode(prettyNum(value, {precision: 8, precisionSetting: PRECISION_SETTING.REDUCE, thousandsSeparator: '&#x202F;'}));
return decode(prettyNum(value, {precision: 8, precisionSetting: PRECISION_SETTING.REDUCE, roundingMode, thousandsSeparator: '&#x202F;'}));
} else {
// ensure at least 2 decimal digits
return decode(prettyNum(value, {precision: 2, precisionSetting: PRECISION_SETTING.FIXED, thousandsSeparator: '&#x202F;'}));
return decode(prettyNum(value, {precision: 2, precisionSetting: PRECISION_SETTING.FIXED, roundingMode, thousandsSeparator: '&#x202F;'}));
}
}

/**
* Ensure value to have from 2 to 8 decimal digits
* @param {string|number} value
* @return {string}
*/
export function prettyPreciseFloor(value) {
return prettyPrecise(value, ROUNDING_MODE.FLOOR);
}

/**
* Ensure value to have minimum 2 decimal digits
* @param {string|number} value
Expand Down
2 changes: 1 addition & 1 deletion components/AuthAdvancedForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<div class="u-grid u-grid--small u-grid--vertical-margin--small">
<div class="u-cell">
<label class="form-field" :class="{'is-error': $v.mnemonic.$error, 'is-success': !$v.mnemonic.$invalid}">
<textarea class="form-field__input" rows="1" autocapitalize="off" v-check-empty v-autosize data-test-id="authAdvancedLoginInputMnemonic"
<textarea class="form-field__input" rows="1" autocapitalize="off" spellcheck="false" v-check-empty v-autosize data-test-id="authAdvancedLoginInputMnemonic"
v-model.trim="mnemonic"
@blur="$v.mnemonic.$touch()"
></textarea>
Expand Down
4 changes: 2 additions & 2 deletions components/AuthAdvancedGenerate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</div>
<div class="u-cell" v-if="address">
<label class="form-field form-field--with-icon">
<textarea class="form-field__input is-not-empty" rows="1" autocapitalize="off" readonly v-autosize
<textarea class="form-field__input is-not-empty" rows="1" autocapitalize="off" spellcheck="false" readonly v-autosize
:value="address"
></textarea>
<ButtonCopy class="form-field__icon form-field__icon--copy u-semantic-button link--opacity" :copy-text="address">
Expand All @@ -53,7 +53,7 @@
</div>
<div class="u-cell" v-if="mnemonic">
<label class="form-field form-field--with-icon">
<textarea class="form-field__input is-not-empty" rows="1" autocapitalize="off" readonly v-autosize
<textarea class="form-field__input is-not-empty" rows="1" autocapitalize="off" spellcheck="false" readonly v-autosize
:value="mnemonic"
></textarea>
<ButtonCopy class="form-field__icon form-field__icon--copy u-semantic-button link--opacity" data-test-id="authAdvancedRegisterCopyButton" :copy-text="mnemonic">
Expand Down
2 changes: 1 addition & 1 deletion components/BroadcastNonceForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</div>
<div class="u-cell" v-if="serverSuccess">
<p>
<strong>{{ $td('Nonce for new Tx:', 'form.broadcast-nonce-got') }}</strong> {{ serverSuccess }}
<strong>{{ $td('Nonce for a new transaction:', 'form.broadcast-nonce-got') }}</strong> {{ serverSuccess }}
</p>
<p>
<qrcode-vue :value="serverSuccess" :size="100" level="L"></qrcode-vue>
Expand Down
2 changes: 1 addition & 1 deletion components/CheckIssueForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
</div>
<div class="u-cell u-cell--medium--1-2 u-cell--xlarge--3-4">
<label class="form-field" :class="{'is-error': $v.form.passPhrase.$error}">
<input class="form-field__input" type="text" v-check-empty
<input class="form-field__input" type="text" autocapitalize="off" spellcheck="false" v-check-empty
v-model.trim="form.passPhrase"
@blur="$v.form.passPhrase.$touch()"
>
Expand Down
2 changes: 1 addition & 1 deletion components/CheckRedeemForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
</div>
<div class="u-cell">
<label class="form-field" :class="{'is-error': $v.form.password.$error}">
<input class="form-field__input" type="text" v-check-empty
<input class="form-field__input" type="text" autocapitalize="off" spellcheck="false" v-check-empty
v-model.trim="form.password"
@blur="$v.form.password.$touch()"
>
Expand Down
7 changes: 4 additions & 3 deletions components/CoinBuyForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import FeeBus from '~/assets/fee';
import checkEmpty from '~/assets/v-check-empty';
import {getErrorText} from "~/assets/server-error";
import {getExplorerTxUrl, pretty} from "~/assets/utils";
import {getExplorerTxUrl, pretty, prettyExact} from "~/assets/utils";
import FieldQr from '~/components/common/FieldQr';
import InputUppercase from '~/components/common/InputUppercase';
import InputMaskedAmount from '~/components/common/InputMaskedAmount';
Expand Down Expand Up @@ -141,6 +141,7 @@
},
methods: {
pretty,
prettyExact,
submit() {
if (this.$store.getters.isOfflineMode) {
this.generateTx();
Expand Down Expand Up @@ -431,15 +432,15 @@
<div class="u-cell">
<label class="form-field form-field--dashed">
<input class="form-field__input is-not-empty" type="text" readonly
:value="$options.filters.pretty(form.buyAmount) + ' ' + form.coinTo"
:value="form.coinTo + ' ' + prettyExact(form.buyAmount)"
>
<span class="form-field__label">{{ $td('You buy', 'form.convert-buy-confirm-get') }}</span>
</label>
</div>
<div class="u-cell">
<label class="form-field form-field--dashed">
<input class="form-field__input is-not-empty" type="text" readonly
:value="$options.filters.pretty(estimation) + ' ' + form.coinFrom"
:value="form.coinFrom + ' ' + pretty(estimation)"
>
<span class="form-field__label">{{ $td('You will pay approximately *', 'form.convert-buy-confirm-pay') }}</span>
</label>
Expand Down
Loading

0 comments on commit ce10806

Please sign in to comment.