Skip to content

Commit a87922d

Browse files
ishabahedi-edelbloute
authored andcommitted
Add onboarding flow
1 parent fb448cd commit a87922d

File tree

38 files changed

+3136
-166
lines changed

38 files changed

+3136
-166
lines changed

.changeset/small-birds-complain.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@ledgerhq/coin-canton": minor
3+
"@ledgerhq/hw-app-canton": patch
4+
"@ledgerhq/types-live": patch
5+
"ledger-live-desktop": patch
6+
"@ledgerhq/live-common": patch
7+
"@ledgerhq/live-signer-canton": patch
8+
"@ledgerhq/coin-framework": patch
9+
---
10+
11+
Add canton onboard ui flow

apps/ledger-live-desktop/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"dependencies": {
5858
"@braze/web-sdk": "4.10.2",
5959
"@ledgerhq/coin-bitcoin": "workspace:^",
60+
"@ledgerhq/coin-canton": "workspace:^",
6061
"@ledgerhq/coin-cosmos": "workspace:^",
6162
"@ledgerhq/coin-evm": "workspace:^",
6263
"@ledgerhq/coin-filecoin": "workspace:^",
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import React, { useEffect } from "react";
2+
import { useDispatch } from "react-redux";
3+
import Box from "~/renderer/components/Box";
4+
import Button from "~/renderer/components/Button";
5+
import { openModal, closeModal } from "~/renderer/actions/modals";
6+
import { StepProps } from "~/renderer/modals/AddAccounts/index";
7+
8+
const NoAssociatedAccounts = ({ t, device, currency }: StepProps) => {
9+
const dispatch = useDispatch();
10+
11+
useEffect(() => {
12+
if (currency && device && currency.type === "CryptoCurrency") {
13+
// Close the current AddAccounts modal first
14+
dispatch(closeModal("MODAL_ADD_ACCOUNTS"));
15+
16+
// Then open the Canton onboard modal automatically
17+
dispatch(
18+
openModal("MODAL_CANTON_ONBOARD_ACCOUNT", {
19+
currency,
20+
device,
21+
selectedAccounts: [],
22+
editedNames: {},
23+
}),
24+
);
25+
}
26+
}, [dispatch, currency, device]);
27+
28+
return (
29+
<Box textAlign="center" py={4}>
30+
{currency && device && currency.type === "CryptoCurrency" && (
31+
<Button
32+
primary
33+
onClick={() => {
34+
// Close the current AddAccounts modal first
35+
dispatch(closeModal("MODAL_ADD_ACCOUNTS"));
36+
37+
// Then open the Canton onboard modal
38+
dispatch(
39+
openModal("MODAL_CANTON_ONBOARD_ACCOUNT", {
40+
currency,
41+
device,
42+
selectedAccounts: [],
43+
editedNames: {},
44+
}),
45+
);
46+
}}
47+
>
48+
{t("dashboard.emptyAccountTile.createAccount")}
49+
</Button>
50+
)}
51+
</Box>
52+
);
53+
};
54+
export default NoAssociatedAccounts;
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import React from "react";
2+
import styled from "styled-components";
3+
import { Trans } from "react-i18next";
4+
import { Tabbable } from "~/renderer/components/Box";
5+
import Box from "~/renderer/components/Box";
6+
import Text from "~/renderer/components/Text";
7+
import CheckBox from "~/renderer/components/CheckBox";
8+
import LedgerLiveLogo from "~/renderer/components/LedgerLiveLogo";
9+
import Logo from "~/renderer/icons/Logo";
10+
11+
interface ValidatorRowProps {
12+
isSelected: boolean;
13+
disabled?: boolean;
14+
}
15+
16+
export const ValidatorRow: React.FC<ValidatorRowProps> = ({ isSelected, disabled = false }) => {
17+
return (
18+
<ValidatorRowStyled isSelected={isSelected} disabled={disabled}>
19+
<ValidatorIcon>
20+
<LedgerLiveLogo width={32} height={32} icon={<Logo size={18} />} />
21+
</ValidatorIcon>
22+
23+
<Box ml={3} flex={1}>
24+
<Text fontSize={4} fontWeight="600" color="palette.text.shade100">
25+
<Trans i18nKey="canton.addAccount.authorization.ledgerValidator">Ledger Validator</Trans>
26+
</Text>
27+
<Text fontSize={3} color="palette.text.shade60">
28+
<Trans i18nKey="canton.addAccount.authorization.validatorDescription">
29+
Automated fund acceptance
30+
</Trans>
31+
</Text>
32+
</Box>
33+
34+
<CheckBox isChecked={isSelected} disabled={disabled} />
35+
</ValidatorRowStyled>
36+
);
37+
};
38+
39+
const ValidatorRowStyled = styled(Tabbable).attrs(() => ({
40+
horizontal: true,
41+
alignItems: "center",
42+
px: 3,
43+
py: 2,
44+
}))<{ isSelected: boolean; disabled?: boolean }>`
45+
height: 48px;
46+
border-radius: 4px;
47+
background-color: ${p => p.theme.colors.neutral.c30};
48+
border: 1px solid ${p => (p.isSelected ? p.theme.colors.primary.c60 : p.theme.colors.neutral.c40)};
49+
cursor: ${p => (p.disabled ? "default" : "pointer")};
50+
opacity: ${p => (p.disabled ? 0.7 : 1)};
51+
52+
&:hover {
53+
background-color: ${p =>
54+
p.disabled ? p.theme.colors.neutral.c30 : p.theme.colors.neutral.c40};
55+
}
56+
`;
57+
58+
const ValidatorIcon = styled(Box)`
59+
width: 24px;
60+
height: 24px;
61+
background-color: ${p => p.theme.colors.neutral.c80};
62+
border-radius: 2px;
63+
display: flex;
64+
align-items: center;
65+
justify-content: center;
66+
`;

0 commit comments

Comments
 (0)