Skip to content

Commit

Permalink
Show a notification when an address has been copied
Browse files Browse the repository at this point in the history
Fixes #271.
  • Loading branch information
csillag committed Sep 22, 2022
1 parent fd6cda3 commit ac018e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/components/AddressBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@ import copy from 'copy-to-clipboard'
import { Box, Button, Text } from 'grommet'
import { Copy } from 'grommet-icons/icons'
import React, { memo } from 'react'
import { useTranslation } from 'react-i18next'

import { PrettyAddress } from '../PrettyAddress'
import { useToastNotification } from '../Notification'

interface Props {
address: string
}

export const AddressBox = memo((props: Props) => {
const { t } = useTranslation()
const { showNotification } = useToastNotification()
const address = props.address

const copyAddress = () => {
copy(address)
showNotification(t('account.addressCopied', 'Address copied.'))
}

return (
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"delegate": "Delegate"
},
"addressCopied": "Address copied.",
"loading": "Loading account",
"loadingError": "Couldn't load account.",
"reclaimEscrow": {
Expand Down

0 comments on commit ac018e9

Please sign in to comment.