add executor label to owners list in exapnded tx view

This commit is contained in:
mmv 2019-07-08 19:05:57 +04:00
parent 84d610b1ce
commit e863bc5376
3 changed files with 49 additions and 20 deletions

View File

@ -7,6 +7,7 @@ import MuiList from '@material-ui/core/List'
import ListItem from '@material-ui/core/ListItem' import ListItem from '@material-ui/core/ListItem'
import ListItemIcon from '@material-ui/core/ListItemIcon' import ListItemIcon from '@material-ui/core/ListItemIcon'
import ListItemText from '@material-ui/core/ListItemText' import ListItemText from '@material-ui/core/ListItemText'
import Chip from '@material-ui/core/Chip';
import Identicon from '~/components/Identicon' import Identicon from '~/components/Identicon'
import Hairline from '~/components/layout/Hairline' import Hairline from '~/components/layout/Hairline'
import { type Owner } from '~/routes/safe/store/models/owner' import { type Owner } from '~/routes/safe/store/models/owner'
@ -15,9 +16,16 @@ import { secondary } from '~/theme/variables'
import { shortVersionOf } from '~/logic/wallets/ethAddresses' import { shortVersionOf } from '~/logic/wallets/ethAddresses'
import { styles } from './style' import { styles } from './style'
type Props = { type ListProps = {
owners: List<Owner>, owners: List<Owner>,
classes: Object, classes: Object,
executionConfirmation?: Owner,
}
type OwnerProps = {
owner: Owner,
classes: Object,
isExecutor?: boolean,
} }
const openIconStyle = { const openIconStyle = {
@ -25,25 +33,31 @@ const openIconStyle = {
color: secondary, color: secondary,
} }
const OwnersList = ({ owners, classes }: Props) => ( const OwnerComponent = withStyles(styles)(({ owner, classes, isExecutor }: OwnerProps) => (
<ListItem key={owner.address} className={classes.owner}>
<ListItemIcon>
<Identicon address={owner.address} diameter={32} className={classes.icon} />
</ListItemIcon>
<ListItemText
primary={owner.name}
secondary={(
<a href={getEtherScanLink(owner.address, 'rinkeby')} target="_blank" rel="noopener noreferrer">
{shortVersionOf(owner.address, 4)}
{' '}
<OpenInNew style={openIconStyle} />
</a>
)}
/>
{isExecutor && <Chip label="EXECUTOR" color="secondary" />}
</ListItem>
))
const OwnersList = ({ owners, classes, executionConfirmation }: ListProps) => (
<> <>
<MuiList className={classes.ownersList}> <MuiList className={classes.ownersList}>
{executionConfirmation && <OwnerComponent owner={executionConfirmation} isExecutor />}
{owners.map(owner => ( {owners.map(owner => (
<ListItem key={owner.address} className={classes.owner}> <OwnerComponent key={owner.address} owner={owner} />
<ListItemIcon>
<Identicon address={owner.address} diameter={32} className={classes.icon} />
</ListItemIcon>
<ListItemText
primary={owner.name}
secondary={(
<a href={getEtherScanLink(owner.address, 'rinkeby')} target="_blank" rel="noopener noreferrer">
{shortVersionOf(owner.address, 4)}
{' '}
<OpenInNew style={openIconStyle} />
</a>
)}
/>
</ListItem>
))} ))}
</MuiList> </MuiList>
<Hairline color="#c8ced4" /> <Hairline color="#c8ced4" />

View File

@ -84,9 +84,15 @@ const ExpandedTx = ({
const ownersUnconfirmed = [] const ownersUnconfirmed = []
let currentUserAlreadyConfirmed = false let currentUserAlreadyConfirmed = false
let executionConfirmation
owners.forEach((owner) => { owners.forEach((owner) => {
if (tx.confirmations.find(conf => conf.owner.address === owner.address)) { const ownerConfirmation = tx.confirmations.find(conf => conf.owner.address === owner.address)
ownersWhoConfirmed.push(owner) if (ownerConfirmation) {
if (ownerConfirmation.type === TX_TYPE_CONFIRMATION) {
ownersWhoConfirmed.push(owner)
} else {
executionConfirmation = owner
}
if (owner.address === userAddress) { if (owner.address === userAddress) {
currentUserAlreadyConfirmed = true currentUserAlreadyConfirmed = true
@ -175,7 +181,11 @@ to:
</Tabs> </Tabs>
<Hairline color="#c8ced4" /> <Hairline color="#c8ced4" />
</Row> </Row>
<Row>{tabIndex === 0 && <OwnersList owners={ownersWhoConfirmed} />}</Row> <Row>
{tabIndex === 0 && (
<OwnersList owners={ownersWhoConfirmed} executionConfirmation={executionConfirmation} />
)}
</Row>
<Row>{tabIndex === 1 && <OwnersList owners={ownersUnconfirmed} />}</Row> <Row>{tabIndex === 1 && <OwnersList owners={ownersUnconfirmed} />}</Row>
{granted && displayButtonRow && ( {granted && displayButtonRow && (
<ButtonRow <ButtonRow

View File

@ -84,6 +84,11 @@ export default createMuiTheme({
padding: '24px 0 0 15px', padding: '24px 0 0 15px',
}, },
}, },
MuiChip: {
root: {
fontFamily: 'Roboto Mono, monospace',
},
},
MuiStepIcon: { MuiStepIcon: {
root: { root: {
fontSize: '22px', fontSize: '22px',