Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Add proper modal for fund flow
Browse files Browse the repository at this point in the history
  • Loading branch information
chabroA committed Jan 12, 2022
1 parent 6ccdb40 commit ec3c5c9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/renderer/components/DeviceAction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
renderListingApps,
renderWarningOutdated,
renderSwapDeviceConfirmationV2,
renderSellDeviceConfirmation,
renderSecureTransferDeviceConfirmation,
} from "./rendering";

type OwnProps<R, H, P> = {
Expand Down Expand Up @@ -173,7 +173,13 @@ const DeviceAction = <R, H, P>({

// sell
case 0x01:
return renderSellDeviceConfirmation({ modelId, type });
// fund
case 0x02:
return renderSecureTransferDeviceConfirmation({
exchangeType: exchangeType === 0x01 ? "sell" : "fund",
modelId,
type,
});

default:
return <div>{"Confirm exchange on your device"}</div>;
Expand All @@ -197,7 +203,7 @@ const DeviceAction = <R, H, P>({
}

if (initSellRequested && !initSellResult && !initSellError) {
return renderSellDeviceConfirmation({ modelId, type });
return renderSecureTransferDeviceConfirmation({ exchangeType: "sell", modelId, type });
}

if (allowOpeningRequestedWording || requestOpenApp) {
Expand Down
8 changes: 5 additions & 3 deletions src/renderer/components/DeviceAction/rendering.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,21 +733,23 @@ export const renderSwapDeviceConfirmationV2 = ({
);
};

export const renderSellDeviceConfirmation = ({
export const renderSecureTransferDeviceConfirmation = ({
exchangeType,
modelId,
type,
}: {
exchangeType: "sell" | "fund",
modelId: DeviceModelId,
type: "light" | "dark",
}) => (
<>
<Alert type="primary" learnMoreUrl={urls.swap.learnMore} horizontal={false}>
<Trans i18nKey="DeviceAction.sell.notice" />
<Trans i18nKey={`DeviceAction.${exchangeType}.notice`} />
</Alert>
{renderVerifyUnwrapped({ modelId, type })}
<Box alignItems={"center"}>
<Text textAlign="center" ff="Inter|SemiBold" color="palette.text.shade100" fontSize={5}>
<Trans i18nKey="DeviceAction.sell.confirm" />
<Trans i18nKey={`DeviceAction.${exchangeType}.confirm`} />
</Text>
</Box>
</>
Expand Down
4 changes: 4 additions & 0 deletions static/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,10 @@
"sell": {
"notice": "Verify the Sell details on your device before sending it. The addresses are exchanged securely so you don’t have to verify them.",
"confirm": "Confirm Sell transaction"
},
"fund": {
"notice": "Verify the Fund details on your device before sending it. The addresses are exchanged securely so you don't have to verify them.",
"confirm": "Confirm Fund transaction"
}
},
"manager": {
Expand Down

0 comments on commit ec3c5c9

Please sign in to comment.