Skip to content

Commit

Permalink
Close button modal nits (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut authored Jul 12, 2023
1 parent dd63cbd commit 4264084
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ import { Close as CloseIcon } from '@mui/icons-material'

interface Props {
onClose: () => void
className?: string
}

export const CloseButton = ({ onClose }: Props) => (
<IconButtonStyled
const CloseButton = ({ onClose, className }: Props) => (
<IconButton
size="small"
aria-label="close"
color="inherit"
onClick={onClose}
className={className}
>
<CloseIcon fontSize="small" />
</IconButtonStyled>
</IconButton>
)

export const IconButtonStyled = styled(IconButton)`
export const ModalCloseButton = styled(CloseButton)`
position: absolute;
right: 0.5rem;
top: 0.5rem;
Expand Down
5 changes: 2 additions & 3 deletions packages/ui/src/components/modals/ChangeMultisig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { useMultisigProposalNeededFunds } from '../../hooks/useMultisigProposalN
import { ErrorOutline as ErrorOutlineIcon } from '@mui/icons-material'
import { useGetSubscanLinks } from '../../hooks/useSubscanLink'
import { Button } from '../library'
import { CloseButton } from '../library/CloseButton'
import { ModalCloseButton } from '../library/ModalCloseButton'

interface Props {
onClose: () => void
Expand Down Expand Up @@ -348,7 +348,7 @@ const ChangeMultisig = ({ onClose, className }: Props) => {
open
className={className}
>
{!isCallStep && <CloseButton onClose={onClose} />}
{(!isCallStep || !!callError) && <ModalCloseButton onClose={onClose} />}
<DialogTitle>Change multisig</DialogTitle>
<DialogContent
className="generalContainer"
Expand Down Expand Up @@ -482,7 +482,6 @@ const ChangeMultisig = ({ onClose, className }: Props) => {
{currentStep === 'selection' ? 'Next' : 'Save'}
</Button>
)}
{isCallStep && !!callError && <Button onClick={onClose}>Close</Button>}
</Grid>
</Grid>
</DialogContent>
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/components/modals/EditNames.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useMultiProxy } from '../../contexts/MultiProxyContext'
import { AccountNames, useAccountNames } from '../../contexts/AccountNamesContext'
import AccountEditName, { OnChangeArgs } from '../AccountEditName'
import { renderMultisigHeading } from '../../pages/multisigHelpers'
import { CloseButton } from '../library/CloseButton'
import { ModalCloseButton } from '../library/ModalCloseButton'

interface Props {
onClose: () => void
Expand Down Expand Up @@ -53,7 +53,7 @@ const EditNames = ({ onClose, className }: Props) => {
open
className={className}
>
<CloseButton onClose={onClose} />
<ModalCloseButton onClose={onClose} />
<DialogTitle>Edit names</DialogTitle>
<DialogContent className="generalContainer">
<Grid container>
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/components/modals/ProposalSigning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { HexString, MultisigStorageInfo } from '../../types'
import { useGetSubscanLinks } from '../../hooks/useSubscanLink'
import { getDisplayArgs, getExtrinsicName } from '../../utils'
import { useCallInfoFromCallData } from '../../hooks/useCallInfoFromCallData'
import { CloseButton } from '../library/CloseButton'
import { ModalCloseButton } from '../library/ModalCloseButton'

interface Props {
onClose: () => void
Expand Down Expand Up @@ -240,7 +240,7 @@ const ProposalSigning = ({
open
className={className}
>
<CloseButton onClose={onClose} />
<ModalCloseButton onClose={onClose} />
<DialogTitle>Transaction signing</DialogTitle>
<DialogContent>
<Grid container>
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/components/modals/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { useMultisigProposalNeededFunds } from '../../hooks/useMultisigProposalN
import { useCheckBalance } from '../../hooks/useCheckBalance'
import { useGetSubscanLinks } from '../../hooks/useSubscanLink'
import FromCallData from '../EasySetup/FromCallData'
import { CloseButton } from '../library/CloseButton'
import { ModalCloseButton } from '../library/ModalCloseButton'

const SEND_TOKEN_MENU = 'Send tokens'
const FROM_CALL_DATA_MENU = 'From call data'
Expand Down Expand Up @@ -279,7 +279,7 @@ const Send = ({ onClose, className, onSuccess, onFinalized }: Props) => {
open
className={className}
>
<CloseButton onClose={onClose} />
<ModalCloseButton onClose={onClose} />
<DialogTitle>Send tx</DialogTitle>
<DialogContent className="generalContainer">
<Grid container>
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/src/hooks/useSigningCallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export const useSigningCallback = ({ onSubmitting, onSuccess, onFinalized, onErr

const incomplete = getIncompleteMessage({ event } as EventRecord)

console.log('incomplete', `${section}.${method}`, incomplete)

// check if multisig or proxy or batch has an error
if (incomplete) {
errorInfo = incomplete
Expand Down

0 comments on commit 4264084

Please sign in to comment.