// 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, { Component } from 'react'; import { observer } from 'mobx-react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import Container from 'semantic-ui-react/dist/commonjs/elements/Container'; import Header from 'semantic-ui-react/dist/commonjs/elements/Header'; import Icon from 'semantic-ui-react/dist/commonjs/elements/Icon'; import Label from 'semantic-ui-react/dist/commonjs/elements/Label'; import List from 'semantic-ui-react/dist/commonjs/elements/List'; import Popup from 'semantic-ui-react/dist/commonjs/modules/Popup'; import Store from '../../Signer/pendingStore'; import ParityBarStore from '../../ParityBar/store'; import RequestItem from './RequestItem'; import styles from './signerPending.css'; @observer class SignerPending extends Component { static propTypes = { className: PropTypes.string }; static contextTypes = { api: PropTypes.object.isRequired }; state = { isOpen: false }; store = Store.get(this.context.api); parityBarStore = ParityBarStore.get(); handleRequestClick = () => { this.parityBarStore.toggleOpenSigner(); this.handleClose(); }; handleOpen = () => { this.setState({ isOpen: true }); }; handleClose = () => { this.setState({ isOpen: false }); }; renderPopupContent = () => (
{this.store.pending.length > 0 ? ( {this.store.pending.map(request => ( ))} ) : ( ) }
); render () { const { className } = this.props; return ( 0 ? 'bell' : 'bell outline' } /> {this.store.pending.length > 0 && ( )} } content={ this.renderPopupContent() } offset={ 8 } // Empirically looks better on='click' hideOnScroll open={ this.state.isOpen } onClose={ this.handleClose } onOpen={ this.handleOpen } position='bottom right' /> ); } } export default SignerPending;