Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TX flow] style: offchain messages info boxes styles #2134

Merged
merged 6 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions public/images/common/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/images/notifications/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions src/components/safe-messages/InfoBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,28 @@ import InfoIcon from '@/public/images/notifications/info.svg'
import css from './styles.module.css'

const InfoBox = ({
title,
message,
children,
className,
}: {
title: string
message: string
children: ReactNode
className?: string
}): ReactElement => {
return (
<div className={classNames(css.container, className)}>
<div className={css.message}>
<SvgIcon component={InfoIcon} color="info" inheritViewBox fontSize="small" />
<SvgIcon component={InfoIcon} color="info" inheritViewBox fontSize="medium" />
<div>
<Typography variant="body2" component="span">
{message}
<Typography variant="subtitle1" fontWeight="bold">
{title}
</Typography>
<Typography variant="body2">{message}</Typography>
</div>
</div>
<Divider sx={{ marginRight: -2, marginLeft: -2 }} />
<Divider className={css.divider} />
<div>{children}</div>
</div>
)
Expand Down
11 changes: 6 additions & 5 deletions src/components/safe-messages/InfoBox/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.container {
background-color: var(--color-info-background);
padding: var(--space-2);
margin: var(--space-2) 0;
border-radius: 4px;
display: flex;
flex-direction: column;
Expand All @@ -19,12 +18,14 @@
text-decoration: underline;
}

.message svg {
margin-top: 4px;
}

.details {
margin-top: var(--space-1);
color: var(--color-primary-light);
word-break: break-word;
}

.divider {
margin-right: calc(-1 * var(--space-2));
margin-left: calc(-1 * var(--space-2));
border-color: var(--color-info-light);
}
2 changes: 1 addition & 1 deletion src/components/safe-messages/MsgSigners/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const MsgSigners = ({
</ListItem>
)}
<ListItem>
<ListItemIcon>
<ListItemIcon sx={{ backgroundColor: backgroundColor }}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ListItemIcon sx={{ backgroundColor: backgroundColor }}>
<ListItemIcon sx={{ backgroundColor }}>

<Signed />
</ListItemIcon>
<ListItemText primaryTypographyProps={{ fontWeight: 700 }}>
Expand Down
5 changes: 5 additions & 0 deletions src/components/safe-messages/MsgSigners/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
padding-right: 0;
}

.signers :global .MuiListItemText-root {
margin-top: var(--space-1);
margin-bottom: var(--space-1);
}

.signers :global .MuiListItemIcon-root {
color: var(--color-primary-main);
justify-content: center;
Expand Down
49 changes: 28 additions & 21 deletions src/components/tx-flow/flows/SignMessage/SignMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ const AlreadySignedByOwnerMessage = ({ hasSigned }: { hasSigned: boolean }) => {
}
return (
<SuccessMessage>
<Grid container direction="row">
<Grid item xs>
<Grid container direction="row" justifyContent="space-between">
<Grid item xs={7}>
Your connected wallet has already signed this message.
</Grid>
<Grid item xs={4}>
Expand Down Expand Up @@ -213,21 +213,26 @@ const SignMessage = ({ onClose, message, safeAppId, requestId }: ProposeProps |
}, [onClose, ongoingMessage, requestId])

return (
<TxCard>
<CardContent>
<DialogHeader threshold={safe.threshold} />
<>
<TxCard>
<CardContent>
<DialogHeader threshold={safe.threshold} />

<Typography fontWeight={700} mb={1}>
Message: <CopyButton text={decodedMessageAsString} />
</Typography>
<DecodedMsg message={decodedMessage} isInModal />
<Typography fontWeight={700} mb={1}>
Message: <CopyButton text={decodedMessageAsString} />
</Typography>
<DecodedMsg message={decodedMessage} isInModal />

<MessageHashField label="SafeMessage" hashValue={safeMessageMessage} />
<MessageHashField label="SafeMessage hash" hashValue={safeMessageHash} />
<MessageHashField label="SafeMessage" hashValue={safeMessageMessage} />
<MessageHashField label="SafeMessage hash" hashValue={safeMessageHash} />
</CardContent>
</TxCard>

<TxCard>
<AlreadySignedByOwnerMessage hasSigned={hasSigned} />

<InfoBox
title="Collect all the confirmations"
message={
requestId
? 'Please keep this modal open until all signers confirm this message. Closing the modal will abort the signing request.'
Expand All @@ -245,17 +250,19 @@ const SignMessage = ({ onClose, message, safeAppId, requestId }: ProposeProps |
<WrongChainWarning />

<MessageDialogError isOwner={isOwner} submitError={submitError} />
</CardContent>
</TxCard>

<CardActions>
{/* TODO: Remove this Cancel button once we can figure out how to move the logic outside */}
<Button onClick={handleClose}>Cancel</Button>
<Button variant="contained" color="primary" onClick={onSign} disabled={isDisabled}>
Sign
</Button>
</CardActions>
<ConfirmationDialog open={showCloseTooltip} onCancel={() => setShowCloseTooltip(false)} onClose={onClose} />
</TxCard>
<TxCard>
<CardActions>
{/* TODO: Remove this Cancel button once we can figure out how to move the logic outside */}
<Button onClick={handleClose}>Cancel</Button>
<Button variant="contained" color="primary" onClick={onSign} disabled={isDisabled}>
Sign
</Button>
</CardActions>
<ConfirmationDialog open={showCloseTooltip} onCancel={() => setShowCloseTooltip(false)} onClose={onClose} />
</TxCard>
</>
)
}

Expand Down
12 changes: 5 additions & 7 deletions src/components/tx/SuccessMessage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { type ReactElement, type ReactNode } from 'react'
import { Typography, SvgIcon } from '@mui/material'
import classNames from 'classnames'
import SuccessIcon from '@/public/images/notifications/success.svg'
import CheckIcon from '@/public/images/common/check.svg'
import css from './styles.module.css'

const SuccessMessage = ({ children, className }: { children: ReactNode; className?: string }): ReactElement => {
return (
<div className={classNames(css.container, className)}>
<div className={css.message}>
<SvgIcon component={SuccessIcon} color="success" inheritViewBox fontSize="small" />
<SvgIcon component={CheckIcon} color="success" inheritViewBox fontSize="small" />

<div>
<Typography variant="body2" component="span">
{children}
</Typography>
</div>
<Typography variant="body2" width="100%">
{children}
</Typography>
</div>
</div>
)
Expand Down
1 change: 0 additions & 1 deletion src/components/tx/SuccessMessage/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.container {
background-color: var(--color-success-background);
padding: var(--space-2);
margin: var(--space-2) 0;
border-radius: 4px;
}

Expand Down