This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Creates ScanQRWrapper to avoid duplicated logic Refactors components that uses ScanQRWrapper * Adds closeQrModal to props.handleScan callback * Fixs mutators usage on components with qrScanWrapper * Exports getNameFromAdbk Fixs displaying address on send funds, also displays the name * Fixs sendCustomTx qrCode Fixs sendCollectible qrCode Fixs loadAddress qrCode
- Loading branch information
Showing
9 changed files
with
233 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// @flow | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import { useState } from 'react' | ||
import * as React from 'react' | ||
|
||
import QRIcon from '~/assets/icons/qrcode.svg' | ||
import ScanQRModal from '~/components/ScanQRModal' | ||
import Img from '~/components/layout/Img' | ||
|
||
type Props = { | ||
handleScan: Function, | ||
} | ||
|
||
const useStyles = makeStyles({ | ||
qrCodeBtn: { | ||
cursor: 'pointer', | ||
}, | ||
}) | ||
|
||
export const ScanQRWrapper = (props: Props) => { | ||
const classes = useStyles() | ||
const [qrModalOpen, setQrModalOpen] = useState<boolean>(false) | ||
|
||
const openQrModal = () => { | ||
setQrModalOpen(true) | ||
} | ||
|
||
const closeQrModal = () => { | ||
setQrModalOpen(false) | ||
} | ||
|
||
const onScanFinished = (value) => { | ||
props.handleScan(value, closeQrModal) | ||
} | ||
|
||
return ( | ||
<> | ||
<Img | ||
alt="Scan QR" | ||
className={classes.qrCodeBtn} | ||
height={20} | ||
onClick={() => { | ||
openQrModal() | ||
}} | ||
role="button" | ||
src={QRIcon} | ||
/> | ||
{qrModalOpen && <ScanQRModal isOpen={qrModalOpen} onClose={closeQrModal} onScan={onScanFinished} />} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.