(feature) Wording and styles improvements in modals (#1974)

* add external icon in safe version (settings)

* change wording in receive modal

* fix Modal titles and color on back/cancel button

* move toggle to the left
(contract interaction modal)

* add title "Method" for drop down

* review lettercase in titles and buttons

* add contract address label in contract interaction

* fix label for input "Contract address"

* fix label when use custom data (Contract address)

* fix external link component on Safe version

* change Label "Recipient" to "Contract address"
This commit is contained in:
Agustín Longoni 2021-03-09 05:56:09 -03:00 committed by GitHub
parent b733cb1c85
commit 69f0e346a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 61 additions and 47 deletions

View File

@ -94,7 +94,7 @@ const ReceiveModal = ({ onClose, safeAddress, safeName }: Props): ReactElement =
<> <>
<Row align="center" className={classes.heading} grow> <Row align="center" className={classes.heading} grow>
<Paragraph noMargin size="xl" weight="bolder"> <Paragraph noMargin size="xl" weight="bolder">
Receive funds Receive assets
</Paragraph> </Paragraph>
<IconButton disableRipple onClick={onClose}> <IconButton disableRipple onClick={onClose}>
<Close className={classes.close} /> <Close className={classes.close} />
@ -106,7 +106,7 @@ const ReceiveModal = ({ onClose, safeAddress, safeName }: Props): ReactElement =
</Paragraph> </Paragraph>
<Paragraph className={classes.annotation} noMargin size="lg"> <Paragraph className={classes.annotation} noMargin size="lg">
This is the address of your Safe. Deposit funds by scanning the QR code or copying the address below. Only send{' '} This is the address of your Safe. Deposit funds by scanning the QR code or copying the address below. Only send{' '}
{networkInfo.nativeCoin.name} and ERC-20 tokens to this address! {networkInfo.nativeCoin.name} and assets to this address (e.g. ETH, ERC20, ERC721)!
</Paragraph> </Paragraph>
<Col layout="column" middle="xs"> <Col layout="column" middle="xs">
<Paragraph className={classes.safeName} noMargin size="lg" weight="bold"> <Paragraph className={classes.safeName} noMargin size="lg" weight="bold">

View File

@ -171,7 +171,7 @@ const SafeHeader = ({
<StyledButton size="md" disabled={!granted} color="primary" variant="contained" onClick={onNewTransactionClick}> <StyledButton size="md" disabled={!granted} color="primary" variant="contained" onClick={onNewTransactionClick}>
<FixedIcon type="arrowSentWhite" /> <FixedIcon type="arrowSentWhite" />
<Text size="lg" color="white"> <Text size="lg" color="white">
New Transaction New transaction
</Text> </Text>
</StyledButton> </StyledButton>
</Container> </Container>

View File

@ -116,7 +116,7 @@ const ChooseTxType = ({ onClose, recipientAddress, setActiveScreen }: ChooseTxTy
className={classNames(classes.leftIcon, classes.iconSmall)} className={classNames(classes.leftIcon, classes.iconSmall)}
src={ContractInteractionIcon} src={ContractInteractionIcon}
/> />
Contract Interaction Contract interaction
</Button> </Button>
)} )}
</Col> </Col>

View File

@ -30,7 +30,7 @@ const Buttons = ({ onClose }: ButtonProps) => {
return ( return (
<Row align="center" className={classes.buttonRow}> <Row align="center" className={classes.buttonRow}>
<Button minWidth={140} onClick={onClose}> <Button minWidth={140} onClick={onClose} color="secondary">
Cancel Cancel
</Button> </Button>
<Button <Button

View File

@ -88,6 +88,7 @@ export const EthAddressInput = ({
setIsValidAddress={() => {}} setIsValidAddress={() => {}}
fieldMutator={onScannedValue} fieldMutator={onScannedValue}
pristine={pristine} pristine={pristine}
label="Contract address"
/> />
)} )}
</Col> </Col>

View File

@ -17,9 +17,15 @@ import CheckIcon from 'src/routes/safe/components/CurrencyDropdown/img/check.svg
import { useDropdownStyles } from 'src/routes/safe/components/CurrencyDropdown/style' import { useDropdownStyles } from 'src/routes/safe/components/CurrencyDropdown/style'
import { DropdownListTheme } from 'src/theme/mui' import { DropdownListTheme } from 'src/theme/mui'
import { extractUsefulMethods, AbiItemExtended } from 'src/logic/contractInteraction/sources/ABIService' import { extractUsefulMethods, AbiItemExtended } from 'src/logic/contractInteraction/sources/ABIService'
import { Text } from '@gnosis.pm/safe-react-components'
import styled from 'styled-components'
const MENU_WIDTH = '452px' const MENU_WIDTH = '452px'
const StyledText = styled(Text)`
padding: 4px 0 0 8px;
`
interface MethodsDropdownProps { interface MethodsDropdownProps {
onChange: (method: AbiItem) => void onChange: (method: AbiItem) => void
} }
@ -78,9 +84,13 @@ export const MethodsDropdown = ({ onChange }: MethodsDropdownProps): ReactElemen
<MuiThemeProvider theme={DropdownListTheme}> <MuiThemeProvider theme={DropdownListTheme}>
<> <>
<button className={classes.button} onClick={handleClick} type="button"> <button className={classes.button} onClick={handleClick} type="button">
<span className={classNames(classes.buttonInner, anchorEl && classes.openMenuButton)}> <StyledText
{(selectedMethod as Record<string, string>).name} size="md"
</span> color="placeHolder"
className={classNames(classes.buttonInner, anchorEl && classes.openMenuButton)}
>
{(selectedMethod as Record<string, string>).name || 'Method'}
</StyledText>
</button> </button>
<Menu <Menu
anchorEl={anchorEl} anchorEl={anchorEl}

View File

@ -133,7 +133,7 @@ const ContractInteractionReview = ({ onClose, onPrev, tx }: Props): React.ReactE
> >
{(txParameters, toggleEditMode) => ( {(txParameters, toggleEditMode) => (
<> <>
<Header onClose={onClose} subTitle="2 of 2" title="Contract Interaction" /> <Header onClose={onClose} subTitle="2 of 2" title="Contract interaction" />
<Hairline /> <Hairline />
<Block className={classes.formContainer}> <Block className={classes.formContainer}>
<Row margin="xs"> <Row margin="xs">
@ -223,7 +223,7 @@ const ContractInteractionReview = ({ onClose, onPrev, tx }: Props): React.ReactE
</div> </div>
<Row align="center" className={classes.buttonRow}> <Row align="center" className={classes.buttonRow}>
<Button minWidth={140} onClick={onPrev}> <Button minWidth={140} onClick={onPrev} color="secondary">
Back Back
</Button> </Button>
<Button <Button

View File

@ -99,7 +99,7 @@ const ReviewCustomTx = ({ onClose, onPrev, tx }: Props): React.ReactElement => {
<> <>
<Row align="center" className={classes.heading} grow> <Row align="center" className={classes.heading} grow>
<Paragraph className={classes.headingText} noMargin weight="bolder"> <Paragraph className={classes.headingText} noMargin weight="bolder">
Send Custom Tx Contract interaction
</Paragraph> </Paragraph>
<Paragraph className={classes.annotation}>2 of 2</Paragraph> <Paragraph className={classes.annotation}>2 of 2</Paragraph>
<IconButton disableRipple onClick={onClose}> <IconButton disableRipple onClick={onClose}>
@ -182,7 +182,7 @@ const ReviewCustomTx = ({ onClose, onPrev, tx }: Props): React.ReactElement => {
</Block> </Block>
)} )}
<Row align="center" className={classes.buttonRow}> <Row align="center" className={classes.buttonRow}>
<Button minWidth={140} onClick={onPrev}> <Button minWidth={140} onClick={onPrev} color="secondary">
Back Back
</Button> </Button>
<Button <Button

View File

@ -100,7 +100,7 @@ const SendCustomTx: React.FC<Props> = ({ initialValues, onClose, onNext, contrac
<> <>
<Row align="center" className={classes.heading} grow> <Row align="center" className={classes.heading} grow>
<Paragraph className={classes.manage} noMargin weight="bolder"> <Paragraph className={classes.manage} noMargin weight="bolder">
Send custom transactions Contract interaction
</Paragraph> </Paragraph>
<Paragraph className={classes.annotation}>1 of 2</Paragraph> <Paragraph className={classes.annotation}>1 of 2</Paragraph>
<IconButton disableRipple onClick={onClose}> <IconButton disableRipple onClick={onClose}>
@ -161,7 +161,7 @@ const SendCustomTx: React.FC<Props> = ({ initialValues, onClose, onNext, contrac
> >
<Row margin="xs"> <Row margin="xs">
<Paragraph color="disabled" noMargin size="md" style={{ letterSpacing: '-0.5px' }}> <Paragraph color="disabled" noMargin size="md" style={{ letterSpacing: '-0.5px' }}>
Recipient Contract address
</Paragraph> </Paragraph>
</Row> </Row>
<Row align="center" margin="md"> <Row align="center" margin="md">
@ -203,6 +203,7 @@ const SendCustomTx: React.FC<Props> = ({ initialValues, onClose, onNext, contrac
pristine={pristine} pristine={pristine}
setIsValidAddress={setIsValidAddress} setIsValidAddress={setIsValidAddress}
setSelectedEntry={setSelectedEntry} setSelectedEntry={setSelectedEntry}
label="Contract address"
/> />
</Col> </Col>
<Col center="xs" className={classes} middle="xs" xs={1}> <Col center="xs" className={classes} middle="xs" xs={1}>
@ -255,14 +256,14 @@ const SendCustomTx: React.FC<Props> = ({ initialValues, onClose, onNext, contrac
/> />
</Col> </Col>
</Row> </Row>
<Paragraph color="disabled" noMargin size="md" style={{ letterSpacing: '-0.5px' }}> <Paragraph color="disabled" noMargin size="lg" style={{ letterSpacing: '-0.5px' }}>
Use custom data (hex encoded)
<Switch onChange={() => saveForm(args[2].values)} checked={!isABI} /> <Switch onChange={() => saveForm(args[2].values)} checked={!isABI} />
Use custom data (hex encoded)
</Paragraph> </Paragraph>
</Block> </Block>
<Hairline /> <Hairline />
<Row align="center" className={classes.buttonRow}> <Row align="center" className={classes.buttonRow}>
<Button minWidth={140} onClick={onClose}> <Button minWidth={140} onClick={onClose} color="secondary">
Cancel Cancel
</Button> </Button>
<Button <Button

View File

@ -93,7 +93,7 @@ const ContractInteraction: React.FC<ContractInteractionProps> = ({
return ( return (
<> <>
<Header onClose={onClose} subTitle="1 of 2" title="Contract Interaction" /> <Header onClose={onClose} subTitle="1 of 2" title="Contract interaction" />
<Hairline /> <Hairline />
<GnoForm <GnoForm
decorators={[ensResolver]} decorators={[ensResolver]}
@ -112,7 +112,7 @@ const ContractInteraction: React.FC<ContractInteractionProps> = ({
<EthAddressInput <EthAddressInput
name="contractAddress" name="contractAddress"
onScannedValue={mutators.setContractAddress} onScannedValue={mutators.setContractAddress}
text="Contract Address*" text="Contract address*"
/> />
<ContractABI /> <ContractABI />
<MethodsDropdown onChange={mutators.setSelectedMethod} /> <MethodsDropdown onChange={mutators.setSelectedMethod} />
@ -120,9 +120,9 @@ const ContractInteraction: React.FC<ContractInteractionProps> = ({
<RenderInputParams /> <RenderInputParams />
<RenderOutputParams /> <RenderOutputParams />
<FormErrorMessage /> <FormErrorMessage />
<Paragraph color="disabled" noMargin size="md" style={{ letterSpacing: '-0.5px' }}> <Paragraph color="disabled" noMargin size="lg" style={{ letterSpacing: '-0.5px' }}>
Use custom data (hex encoded)
<Switch checked={!isABI} onChange={() => saveForm(rest.values)} /> <Switch checked={!isABI} onChange={() => saveForm(rest.values)} />
Use custom data (hex encoded)
</Paragraph> </Paragraph>
</Block> </Block>
<Hairline /> <Hairline />

View File

@ -149,7 +149,7 @@ const ReviewCollectible = ({ onClose, onPrev, tx }: Props): React.ReactElement =
<> <>
<Row align="center" className={classes.heading} grow> <Row align="center" className={classes.heading} grow>
<Paragraph className={classes.headingText} noMargin weight="bolder"> <Paragraph className={classes.headingText} noMargin weight="bolder">
Send Collectible Send collectible
</Paragraph> </Paragraph>
<Paragraph className={classes.annotation}>2 of 2</Paragraph> <Paragraph className={classes.annotation}>2 of 2</Paragraph>
<IconButton disableRipple onClick={onClose}> <IconButton disableRipple onClick={onClose}>
@ -218,7 +218,7 @@ const ReviewCollectible = ({ onClose, onPrev, tx }: Props): React.ReactElement =
/> />
</div> </div>
<Row align="center" className={classes.buttonRow}> <Row align="center" className={classes.buttonRow}>
<Button minWidth={140} onClick={onPrev}> <Button minWidth={140} onClick={onPrev} color="secondary">
Back Back
</Button> </Button>
<Button <Button

View File

@ -188,7 +188,7 @@ const ReviewSendFundsTx = ({ onClose, onPrev, tx }: ReviewTxProps): React.ReactE
{/* Header */} {/* Header */}
<Row align="center" className={classes.heading} grow data-testid="send-funds-review-step"> <Row align="center" className={classes.heading} grow data-testid="send-funds-review-step">
<Paragraph className={classes.headingText} noMargin weight="bolder"> <Paragraph className={classes.headingText} noMargin weight="bolder">
Send Funds Send funds
</Paragraph> </Paragraph>
<Paragraph className={classes.annotation}>2 of 2</Paragraph> <Paragraph className={classes.annotation}>2 of 2</Paragraph>
<IconButton disableRipple onClick={onClose}> <IconButton disableRipple onClick={onClose}>

View File

@ -120,7 +120,7 @@ const SendCollectible = ({
<> <>
<Row align="center" className={classes.heading} grow> <Row align="center" className={classes.heading} grow>
<Paragraph className={classes.manage} noMargin weight="bolder"> <Paragraph className={classes.manage} noMargin weight="bolder">
Send Collectible Send collectible
</Paragraph> </Paragraph>
<Paragraph className={classes.annotation}>1 of 2</Paragraph> <Paragraph className={classes.annotation}>1 of 2</Paragraph>
<IconButton disableRipple onClick={onClose}> <IconButton disableRipple onClick={onClose}>
@ -267,7 +267,7 @@ const SendCollectible = ({
</Block> </Block>
<Hairline /> <Hairline />
<Row align="center" className={classes.buttonRow}> <Row align="center" className={classes.buttonRow}>
<Button minWidth={140} onClick={onClose}> <Button minWidth={140} onClick={onClose} color="secondary">
Cancel Cancel
</Button> </Button>
<Button <Button

View File

@ -160,7 +160,7 @@ const SendFunds = ({
<> <>
<Row align="center" className={classes.heading} grow data-testid="modal-title-send-funds"> <Row align="center" className={classes.heading} grow data-testid="modal-title-send-funds">
<Paragraph className={classes.manage} noMargin weight="bolder"> <Paragraph className={classes.manage} noMargin weight="bolder">
Send Funds Send funds
</Paragraph> </Paragraph>
<Paragraph className={classes.annotation}>1 of 2</Paragraph> <Paragraph className={classes.annotation}>1 of 2</Paragraph>
<IconButton disableRipple onClick={onClose}> <IconButton disableRipple onClick={onClose}>
@ -322,7 +322,7 @@ const SendFunds = ({
</Block> </Block>
<Hairline /> <Hairline />
<Row align="center" className={classes.buttonRow}> <Row align="center" className={classes.buttonRow}>
<Button minWidth={140} onClick={onClose}> <Button minWidth={140} onClick={onClose} color="secondary">
Cancel Cancel
</Button> </Button>
<Button <Button

View File

@ -22,7 +22,9 @@ import { TX_NOTIFICATION_TYPES } from 'src/logic/safe/transactions'
import { UpdateSafeModal } from 'src/routes/safe/components/Settings/UpdateSafeModal' import { UpdateSafeModal } from 'src/routes/safe/components/Settings/UpdateSafeModal'
import { grantedSelector } from 'src/routes/safe/container/selector' import { grantedSelector } from 'src/routes/safe/container/selector'
import updateSafe from 'src/logic/safe/store/actions/updateSafe' import updateSafe from 'src/logic/safe/store/actions/updateSafe'
import Link from 'src/components/layout/Link' import { Icon, Link, Text } from '@gnosis.pm/safe-react-components'
import styled from 'styled-components'
import { import {
latestMasterContractVersionSelector, latestMasterContractVersionSelector,
safeCurrentVersionSelector, safeCurrentVersionSelector,
@ -40,6 +42,15 @@ export const SAFE_NAME_UPDATE_SAFE_BTN_TEST_ID = 'update-safe-name-btn'
const useStyles = makeStyles(styles) const useStyles = makeStyles(styles)
const StyledLink = styled(Link)`
margin: 12px 0 0 0;
`
const StyledIcon = styled(Icon)`
position: relative;
top: 3px;
left: 6px;
`
const SafeDetails = (): React.ReactElement => { const SafeDetails = (): React.ReactElement => {
const classes = useStyles() const classes = useStyles()
const isUserOwner = useSelector(grantedSelector) const isUserOwner = useSelector(grantedSelector)
@ -111,12 +122,13 @@ const SafeDetails = (): React.ReactElement => {
<Block className={classes.formContainer}> <Block className={classes.formContainer}>
<Heading tag="h2">Safe Version</Heading> <Heading tag="h2">Safe Version</Heading>
<Row align="end" grow> <Row align="end" grow>
<Paragraph className={classes.versionNumber}> <StyledLink rel="noreferrer noopener" target="_blank" href={safeInfo?.deployerRepoUrl}>
<Link className={classes.link} color="black" target="_blank" to={safeInfo?.deployerRepoUrl}> <Text size="xl" as="span" color="primary">
{getSafeVersion()} {getSafeVersion()}
{getSafeVersionUpdate()} {getSafeVersionUpdate()}
</Link> </Text>
</Paragraph> <StyledIcon size="sm" type="externalLink" color="primary" />
</StyledLink>
</Row> </Row>
{safeNeedsUpdate && isUserOwner ? ( {safeNeedsUpdate && isUserOwner ? (
<Row align="end" grow> <Row align="end" grow>
@ -137,9 +149,9 @@ const SafeDetails = (): React.ReactElement => {
</Block> </Block>
<Block className={classes.formContainer}> <Block className={classes.formContainer}>
<Heading tag="h2">Modify Safe name</Heading> <Heading tag="h2">Modify Safe name</Heading>
<Paragraph> <Paragraph size="lg">
You can change the name of this Safe. This name is only stored locally and never shared with Gnosis or any You can change the name of this Safe. This name is only stored locally <br />
third parties. and never shared with Gnosis or any third parties.
</Paragraph> </Paragraph>
<Block className={classes.root}> <Block className={classes.root}>
<Field <Field

View File

@ -1,5 +1,5 @@
import { createStyles } from '@material-ui/core/styles' import { createStyles } from '@material-ui/core/styles'
import { boldFont, border, lg, sm, connected } from 'src/theme/variables' import { boldFont, border, lg, sm } from 'src/theme/variables'
export const styles = createStyles({ export const styles = createStyles({
formContainer: { formContainer: {
@ -21,14 +21,4 @@ export const styles = createStyles({
position: 'absolute', position: 'absolute',
width: '100%', width: '100%',
}, },
versionNumber: {
height: '21px',
},
link: {
color: `${connected}`,
textDecoration: 'none',
'&:hover': {
textDecoration: 'underline',
},
},
}) })