diff --git a/js/src/redux/providers/signerMiddleware.js b/js/src/redux/providers/signerMiddleware.js index f94401196..50a8d9078 100644 --- a/js/src/redux/providers/signerMiddleware.js +++ b/js/src/redux/providers/signerMiddleware.js @@ -18,8 +18,9 @@ import * as actions from './signerActions'; import { inHex } from '@parity/api/format/input'; +import { createSignedTx } from '~/shell/Signer/utils/qrscan'; + import HardwareStore from '~/mobx/hardwareStore'; -import { createSignedTx } from '~/util/qrscan'; import { Signer } from '~/util/signer'; export default class SignerMiddleware { diff --git a/js/src/reset.css b/js/src/reset.css deleted file mode 100644 index 3f69daf75..000000000 --- a/js/src/reset.css +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ - -:root, -:root body { - margin: 0; - padding: 0; - border: 0; - clor: rgba(0, 0, 0, 0.870588); - font-size: 100%; - font: inherit; - vertical-align: baseline; - font-size: 16px; - font-family: 'Roboto', sans-serif; - font-weight: 300 !important; -} - -:root * { - font-weight: 300 !important; -} - -:root a, -:root a:visited { - text-decoration: none; - cursor: pointer; - color: rgb(0, 151, 167); /* #f80 */ -} - -:root a:hover { - color: rgb(0, 174, 193); -} - -:root .reset { font-size: initial; width: 100%; height: 100%; } - -:root .reset input { - margin-top: 0; - color: rgba(0, 0, 0, 0.870588) !important; -} -:root .reset input[disabled] { - color: rgba(0, 0, 0, 0.298039) !important; -} -/* shame:off */ - -// Prefixed version of -/* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) -*/ -:root .reset div, :root .reset span, :root .reset applet, :root .reset object, :root .reset iframe, -:root .reset h1, :root .reset h2, :root .reset h3, :root .reset h4, :root .reset h5, :root .reset h6, :root .reset p, :root .reset blockquote, :root .reset pre, -:root .reset a, :root .reset abbr, :root .reset acronym, :root .reset address, :root .reset big, :root .reset cite, :root .reset code, -:root .reset del, :root .reset dfn, :root .reset em, :root .reset img, :root .reset ins, :root .reset kbd, :root .reset q, :root .reset s, :root .reset samp, -:root .reset small, :root .reset strike, :root .reset strong, :root .reset sub, :root .reset sup, :root .reset tt, :root .reset var, -:root .reset b, :root .reset u, :root .reset i, :root .reset center, -:root .reset dl, :root .reset dt, :root .reset dd, :root .reset ol, :root .reset ul, :root .reset li, -:root .reset fieldset, :root .reset form, :root .reset label, :root .reset legend, -:root .reset table, :root .reset caption, :root .reset tbody, :root .reset tfoot, :root .reset thead, :root .reset tr, :root .reset th, :root .reset td, -:root .reset article, :root .reset aside, :root .reset canvas, :root .reset details, :root .reset embed, -:root .reset figure, :root .reset figcaption, :root .reset footer, :root .reset header, :root .reset hgroup, -:root .reset menu, :root .reset nav, :root .reset output, :root .reset ruby, :root .reset section, :root .reset summary, -:root .reset time, :root .reset mark, :root .reset audio, :root .reset video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} -/* HTML5 display-role reset for older browsers */ -:root .reset article, :root .reset aside, :root .reset details, :root .reset figcaption, :root .reset figure, -:root .reset footer, :root .reset header, :root .reset hgroup, :root .reset menu, :root .reset nav, :root .reset section { - display: block; -} -:root .reset body { - line-height: 1; -} -:root .reset ol, :root .reset ul { - list-style: none; -} -:root .reset blockquote, :root .reset q { - quotes: none; -} -:root .reset blockquote:before, :root .reset blockquote:after, -:root .reset q:before, :root .reset q:after { - content: ''; - content: none; -} -:root .reset table { - border-collapse: collapse; - border-spacing: 0; -} diff --git a/js/src/shell/Signer/components/TransactionPendingForm/transactionPendingForm.js b/js/src/shell/Signer/components/TransactionPendingForm/transactionPendingForm.js index e176b97e9..3adf4dd73 100644 --- a/js/src/shell/Signer/components/TransactionPendingForm/transactionPendingForm.js +++ b/js/src/shell/Signer/components/TransactionPendingForm/transactionPendingForm.js @@ -19,8 +19,9 @@ import { FormattedMessage } from 'react-intl'; import { PrevIcon } from '~/ui/Icons'; -import TransactionPendingFormConfirm from './TransactionPendingFormConfirm'; -import TransactionPendingFormReject from './TransactionPendingFormReject'; +import TransactionPendingFormConfirm from '../TransactionPendingFormConfirm'; +import TransactionPendingFormReject from '../TransactionPendingFormReject'; + import styles from './transactionPendingForm.css'; export default class TransactionPendingForm extends Component { diff --git a/js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormConfirm/index.js b/js/src/shell/Signer/components/TransactionPendingFormConfirm/index.js similarity index 100% rename from js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormConfirm/index.js rename to js/src/shell/Signer/components/TransactionPendingFormConfirm/index.js diff --git a/js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormConfirm/transactionPendingFormConfirm.css b/js/src/shell/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.css similarity index 100% rename from js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormConfirm/transactionPendingFormConfirm.css rename to js/src/shell/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.css diff --git a/js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormConfirm/transactionPendingFormConfirm.js b/js/src/shell/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.js similarity index 99% rename from js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormConfirm/transactionPendingFormConfirm.js rename to js/src/shell/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.js index ba4d30c71..6e7463892 100644 --- a/js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormConfirm/transactionPendingFormConfirm.js +++ b/js/src/shell/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.js @@ -21,7 +21,7 @@ import { FormattedMessage } from 'react-intl'; import ReactTooltip from 'react-tooltip'; import { Button, Form, Input, IdentityIcon, QrCode, QrScan } from '~/ui'; -import { generateTxQr, generateDataQr } from '~/util/qrscan'; +import { generateTxQr, generateDataQr } from '~/shell/Signer/utils/qrscan'; import styles from './transactionPendingFormConfirm.css'; diff --git a/js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormConfirm/transactionPendingFormConfirm.spec.js b/js/src/shell/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.spec.js similarity index 100% rename from js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormConfirm/transactionPendingFormConfirm.spec.js rename to js/src/shell/Signer/components/TransactionPendingFormConfirm/transactionPendingFormConfirm.spec.js diff --git a/js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormReject/index.js b/js/src/shell/Signer/components/TransactionPendingFormReject/index.js similarity index 100% rename from js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormReject/index.js rename to js/src/shell/Signer/components/TransactionPendingFormReject/index.js diff --git a/js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormReject/transactionPendingFormReject.css b/js/src/shell/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.css similarity index 100% rename from js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormReject/transactionPendingFormReject.css rename to js/src/shell/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.css diff --git a/js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormReject/transactionPendingFormReject.js b/js/src/shell/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.js similarity index 100% rename from js/src/shell/Signer/components/TransactionPendingForm/TransactionPendingFormReject/transactionPendingFormReject.js rename to js/src/shell/Signer/components/TransactionPendingFormReject/transactionPendingFormReject.js diff --git a/js/src/shell/Signer/components/util/transaction.spec.js b/js/src/shell/Signer/components/util/transaction.spec.js index 9fe4eb579..089e77b56 100644 --- a/js/src/shell/Signer/components/util/transaction.spec.js +++ b/js/src/shell/Signer/components/util/transaction.spec.js @@ -17,7 +17,7 @@ import BigNumber from 'bignumber.js'; import { getShortData, getFee, getTotalValue } from './transaction'; -describe('views/Signer/components/util/transaction', () => { +describe('shell/Signer/components/util/transaction', () => { describe('getEstimatedMiningTime', () => { it('should return estimated mining time', () => { }); diff --git a/js/src/util/qrscan.js b/js/src/shell/Signer/utils/qrscan.js similarity index 100% rename from js/src/util/qrscan.js rename to js/src/shell/Signer/utils/qrscan.js diff --git a/js/src/shell/Signer/utils/utils.js b/js/src/shell/Signer/utils/utils.js index 76f7f0901..986ac3baf 100644 --- a/js/src/shell/Signer/utils/utils.js +++ b/js/src/shell/Signer/utils/utils.js @@ -14,6 +14,22 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +export function capitalize (str) { + return str[0].toUpperCase() + str.slice(1).toLowerCase(); +} + export function identity (x) { return x; } + +export function toPromise (fn) { + return new Promise((resolve, reject) => { + fn((err, res) => { + if (err) { + reject(err); + } else { + resolve(res); + } + }); + }); +} diff --git a/js/src/shell/Signer/components/util/util.js b/js/src/ui/SectionList/Overlay/index.js similarity index 67% rename from js/src/shell/Signer/components/util/util.js rename to js/src/ui/SectionList/Overlay/index.js index 65551dbeb..636098a91 100644 --- a/js/src/shell/Signer/components/util/util.js +++ b/js/src/ui/SectionList/Overlay/index.js @@ -14,22 +14,4 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -export function toPromise (fn) { - return new Promise((resolve, reject) => { - fn((err, res) => { - if (err) { - reject(err); - } else { - resolve(res); - } - }); - }); -} - -export function identity (x) { - return x; -} - -export function capitalize (str) { - return str[0].toUpperCase() + str.slice(1).toLowerCase(); -} +export default from './overlay'; diff --git a/js/src/ui/SectionList/Overlay/overlay.css b/js/src/ui/SectionList/Overlay/overlay.css new file mode 100644 index 000000000..1aa984948 --- /dev/null +++ b/js/src/ui/SectionList/Overlay/overlay.css @@ -0,0 +1,32 @@ +/* Copyright 2015-2017 Parity Technologies (UK) Ltd. +/* This file is part of Parity. +/* +/* Parity is free software: you can redistribute it and/or modify +/* it under the terms of the GNU General Public License as published by +/* the Free Software Foundation, either version 3 of the License, or +/* (at your option) any later version. +/* +/* Parity is distributed in the hope that it will be useful, +/* but WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU General Public License for more details. +/* +/* You should have received a copy of the GNU General Public License +/* along with Parity. If not, see . +*/ + +$overlayBackground: rgba(0, 0, 0, 0.85); +$overlayText: white; +$overlayIndex: 199; + +.overlay { + background: $overlayBackground; + bottom: 0; + color: $overlayText; + left: 0; + padding: 1.5em; + position: absolute; + right: 0; + top: 0; + z-index: $overlayIndex; +} diff --git a/js/src/ui/SectionList/Overlay/overlay.js b/js/src/ui/SectionList/Overlay/overlay.js new file mode 100644 index 000000000..087d3fbb0 --- /dev/null +++ b/js/src/ui/SectionList/Overlay/overlay.js @@ -0,0 +1,37 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React from 'react'; + +import { nodeOrStringProptype } from '~/util/proptypes'; + +import styles from './overlay.css'; + +export default function Overlay ({ overlay }) { + if (!overlay) { + return null; + } + + return ( +
+ { overlay } +
+ ); +} + +Overlay.propTypes = { + overlay: nodeOrStringProptype() +}; diff --git a/js/src/util/array.js b/js/src/ui/SectionList/array.js similarity index 100% rename from js/src/util/array.js rename to js/src/ui/SectionList/array.js diff --git a/js/src/util/array.spec.js b/js/src/ui/SectionList/array.spec.js similarity index 96% rename from js/src/util/array.spec.js rename to js/src/ui/SectionList/array.spec.js index 3af1d209d..dde100dea 100644 --- a/js/src/util/array.spec.js +++ b/js/src/ui/SectionList/array.spec.js @@ -16,7 +16,7 @@ import { chunkArray } from './array'; -describe('util/array', () => { +describe('ui/SectionList/array', () => { describe('chunkArray', () => { it('splits array into equal chunks', () => { expect(chunkArray([1, 2, 3, 4], 2)).to.deep.equal([[1, 2], [3, 4]]); diff --git a/js/src/ui/SectionList/sectionList.css b/js/src/ui/SectionList/sectionList.css index e81d8ce07..39a124f5b 100644 --- a/js/src/ui/SectionList/sectionList.css +++ b/js/src/ui/SectionList/sectionList.css @@ -24,17 +24,6 @@ $widthContracted: 29%; position: relative; width: 100%; - .overlay { - background: rgba(0, 0, 0, 0.85); - bottom: 0; - left: 0; - padding: 1.5em; - position: absolute; - right: 0; - top: 0; - z-index: 199; - } - .row { display: flex; justify-content: center; diff --git a/js/src/ui/SectionList/sectionList.js b/js/src/ui/SectionList/sectionList.js index f499d8962..8bd0b9a73 100644 --- a/js/src/ui/SectionList/sectionList.js +++ b/js/src/ui/SectionList/sectionList.js @@ -16,9 +16,10 @@ import React, { Component, PropTypes } from 'react'; -import { chunkArray } from '~/util/array'; import { arrayOrObjectProptype, nodeOrStringProptype } from '~/util/proptypes'; +import { chunkArray } from './array'; +import Overlay from './Overlay'; import styles from './sectionList.css'; // TODO: We probably want this to be passed via props - additional work required in that case to @@ -40,7 +41,7 @@ export default class SectionList extends Component { }; render () { - const { className, items } = this.props; + const { className, items, overlay } = this.props; if (!items || !items.length) { return null; @@ -56,26 +57,12 @@ export default class SectionList extends Component { return (
- { this.renderOverlay() } + { chunkArray(rendered, ITEMS_PER_ROW).map(this.renderRow) }
); } - renderOverlay () { - const { overlay } = this.props; - - if (!overlay) { - return null; - } - - return ( -
- { overlay } -
- ); - } - renderRow = (row, index) => { return (