Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
fix: qr code encodes url of page
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-calavera committed Oct 4, 2019
1 parent da9e8fd commit 431226a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/v2/components/Applications/Detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const ApplicationDetail = ({match}: {match: Match}) => {
const tabNav = ['Accounts', 'code/source'];

const renderTabNav = label => <TabNav key={label} label={label} />;
const url = window.location.href;

return (
<Container>
Expand All @@ -109,7 +110,7 @@ const ApplicationDetail = ({match}: {match: Match}) => {
<div className={classes.applicationTitle}>
<span>{applicationId}</span>
<CopyBtn text={applicationId} />
<QRPopup />
<QRPopup url={url} />
<button>
<StarIcon />
</button>
Expand Down
10 changes: 8 additions & 2 deletions src/v2/components/QRPopup/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
//@flow
import {Popover} from '@material-ui/core';
import QRCode from 'qrcode.react';
import React, {useState} from 'react';

import useStyles from './styles';

const QRPopup = () => {
const QRPopup = ({url = ''}: {url: string}) => {
const classes = useStyles();
const [qrEl, setQrEl] = useState(null);
const handleQrOpen = event => setQrEl(event.currentTarget);
Expand All @@ -14,6 +16,7 @@ const QRPopup = () => {
QR code
</button>
<Popover
classes={{paper: classes.popup}}
open={Boolean(qrEl)}
onClose={handleQrClose}
anchorEl={qrEl}
Expand All @@ -26,7 +29,10 @@ const QRPopup = () => {
horizontal: 'center',
}}
>
<img src="http://placehold.it/315" alt="" />
<QRCode
value={url}
style={{width: '120px', height: '120px', display: 'block'}}
/>
</Popover>
</div>
);
Expand Down
4 changes: 4 additions & 0 deletions src/v2/components/QRPopup/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ export default makeStyles(theme => ({
background: 'transparent',
padding: 0,
},
popup: {
padding: 10,
background: getColor('white')(theme),
},
}));
3 changes: 2 additions & 1 deletion src/v2/components/Transactions/Detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const TransactionDetail = ({match}: {match: Match}) => {
];

const renderTabNav = label => <TabNav key={label} label={label} />;
const url = window.location.href;

return (
<Container>
Expand All @@ -114,7 +115,7 @@ const TransactionDetail = ({match}: {match: Match}) => {
<div className={classes.blockTitle}>
<span>{transaction.id}</span>
<CopyBtn text={transaction.id} />
<QRPopup />
<QRPopup url={url} />
</div>
</SectionHeader>
<div className={classes.body}>
Expand Down

0 comments on commit 431226a

Please sign in to comment.