// // A key in the list of keys // import React from 'react' import { Glyphicon, Button, ButtonToolbar, Label } from 'react-bootstrap' import bitmask from 'lib/bitmask' export default class KeyListItem extends React.Component { static get defaultProps() {return{ data: null, // the key as an Object account: null // the account as an Account }} constructor(props) { super(props) this.state = { expanded: false, hidden: false, deleting: false, error: null } this.toggle = this.toggle.bind(this) this.delete = this.delete.bind(this) } toggle() { this.setState({expanded: !this.state.expanded}) } delete() { if (this.props.account.address == this.props.data.address) { return // please do not delete your own key } bitmask.keys.del(this.props.account.id, this.props.data.address, false).then( key => { this.setState({hidden: true}) }, error => { this.setState({error: error}) } ) } render() { if (this.state.hidden) { return
} else if (!this.props.data) { return (