Skip to content

Commit

Permalink
Finished adding MWC support to LLD
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasFlamel1 committed Jan 15, 2024
1 parent 95d2a5d commit b1414f1
Show file tree
Hide file tree
Showing 16 changed files with 1,811 additions and 15 deletions.
4 changes: 3 additions & 1 deletion apps/ledger-live-desktop/src/renderer/components/QRCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import qrcode from "qrcode";
type Props = {
data: string;
size: number;
errorCorrectionLevel?: qrcode.QRCodeErrorCorrectionLevel | undefined;
};
class QRCode extends PureComponent<Props> {
static defaultProps = {
Expand All @@ -21,7 +22,7 @@ class QRCode extends PureComponent<Props> {
canvas: React.RefObject<HTMLCanvasElement> = React.createRef();

drawQRCode() {
const { data, size } = this.props;
const { data, size, errorCorrectionLevel } = this.props;
const { current } = this.canvas;
if (!current) return;
qrcode.toCanvas(
Expand All @@ -30,6 +31,7 @@ class QRCode extends PureComponent<Props> {
{
width: current.width,
margin: 0,
errorCorrectionLevel,
},
() => {
// fix again the CSS because lib changes it –_–
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { EvmFamily } from "../types";

const ErrorContainer = styled(Box)<{ hasError: Error }>`
margin-top: 0px;
font-size: 12px;
font-size: 10px;
width: 100%;
transition: all 0.4s ease-in-out;
will-change: max-height;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const StepConnectDeviceFooter = () => {
return null;
};

export default {
StepConnectDeviceFooter,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React, { useCallback } from "react";
import { Trans } from "react-i18next";
import { getAccountBridge } from "@ledgerhq/live-common/bridge/index";
import { Account } from "@ledgerhq/types-live";
import {
Transaction,
TransactionStatus,
} from "@ledgerhq/live-common/families/mimblewimble_coin/types";
import Box from "~/renderer/components/Box";
import Label from "~/renderer/components/Label";
import Switch from "~/renderer/components/Switch";

type Props = {
account: Account;
transaction: Transaction;
status: TransactionStatus;
onChange: (t: Transaction) => void;
};

const SendRecipientFields = (props: Props) => {
const { account, transaction, onChange } = props;
const onChangeSendAsFile = useCallback(
(sendAsFile: boolean) => {
const bridge = getAccountBridge(account);
onChange(
bridge.updateTransaction(transaction, {
sendAsFile,
}),
);
},
[account, onChange, transaction],
);
return (
<Box flow={1} horizontal alignItems="center">
<Label mr={2}>
<Trans i18nKey="families.mimblewimble_coin.sendAsFile" />
</Label>
<Switch isChecked={transaction.sendAsFile} onChange={onChangeSendAsFile} />
</Box>
);
};

export default {
component: SendRecipientFields,
fields: ["sendAsFile"],
};
Loading

0 comments on commit b1414f1

Please sign in to comment.