Skip to content

Commit

Permalink
feat(wallet): add QR code to receive popup (#2144)
Browse files Browse the repository at this point in the history
* feat: add qr to popup

* feat: update QR
  • Loading branch information
evavirseda authored Aug 30, 2024
1 parent 3b6e380 commit a01d5cc
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"jose": "^5.2.3",
"mitt": "^3.0.1",
"poseidon-lite": "^0.2.0",
"qrcode.react": "^4.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.0.10",
Expand Down
42 changes: 42 additions & 0 deletions apps/wallet/src/ui/app/components/QR.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { QRCodeSVG } from 'qrcode.react';

export enum QRLevel {
L = 'L',
M = 'M',
Q = 'Q',
H = 'H',
}
interface QRProps {
value: string;
size: number;
bgColor?: string;
fgColor?: string;
level?: QRLevel;
marginSize?: number;
title?: string;
}

export function QR({
value,
size,
bgColor = '#ffffff',
fgColor = '#000000',
level = QRLevel.L,
marginSize,
title,
}: QRProps) {
return (
<QRCodeSVG
value={value}
size={size}
bgColor={bgColor}
fgColor={fgColor}
level={level}
marginSize={marginSize}
title={title}
/>
);
}
1 change: 1 addition & 0 deletions apps/wallet/src/ui/app/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export * from './network-selector';
export * from './nft-display';
export * from './nft-display/NftImage';
export * from './number-input';
export * from './QR';
export * from './receipt-card';
export * from './receipt-card/TxnAddress';
export * from './receipt-card/TxnAmount';
Expand Down
6 changes: 5 additions & 1 deletion apps/wallet/src/ui/app/pages/home/tokens/TokensDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ExplorerLinkType,
Loading,
UnlockAccountButton,
QR,
} from '_components';
import { useAppSelector, useCoinsReFetchingConfig, useCopyToClipboard } from '_hooks';
import { ampli } from '_src/shared/analytics/ampli';
Expand Down Expand Up @@ -612,7 +613,10 @@ function DialogReceiveTokens({
<DialogContent containerId="overlay-portal-container">
<Header title="Receive" onClose={() => setOpen(false)} />
<DialogBody>
<div className="[&_span]:w-full [&_span]:break-words">
<div className="flex flex-col gap-lg text-center [&_span]:w-full [&_span]:break-words">
<div className="self-center">
<QR value={address} size={130} />
</div>
<Address text={address} />
</div>
</DialogBody>
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a01d5cc

Please sign in to comment.