Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] : Manage instances in LLD #7038

Merged
merged 58 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
38f81c2
Store components in several folder
sshmaxime May 16, 2024
1b65a04
fix key
mcayuelas-ledger May 20, 2024
029c72c
reorg files using enwArch
mcayuelas-ledger May 21, 2024
6fefcbb
update imports
mcayuelas-ledger May 21, 2024
2e52a52
[WIP]: WS activation flow (connect device)
mcayuelas-ledger May 20, 2024
93fb1b9
remove useless files
mcayuelas-ledger May 20, 2024
9cd7ad3
add router
mcayuelas-ledger May 20, 2024
4929d60
WIP Error/success screen
mcayuelas-ledger May 21, 2024
7021953
Reorg in new arch
mcayuelas-ledger May 21, 2024
30f71b4
[WIP]: WS activation flow (connect device)
mcayuelas-ledger May 20, 2024
d7fe183
add router
mcayuelas-ledger May 20, 2024
916c8c3
Reorg in new arch
mcayuelas-ledger May 21, 2024
c7c44c3
Fix files
mcayuelas-ledger May 21, 2024
459751f
Error/success screens
mcayuelas-ledger May 21, 2024
2ce5b4f
use DeviceAction
mcayuelas-ledger May 21, 2024
d1b099b
add loading state
mcayuelas-ledger May 21, 2024
91a427a
UI polish and fix
mcayuelas-ledger May 21, 2024
2116ab6
Add loading screen for WS activation
sshmaxime May 28, 2024
74347a3
Add loader animation
sshmaxime May 28, 2024
e4e54a0
πŸ›οΈ Regorg files
mcayuelas-ledger May 31, 2024
30f5759
⚑[FEAT]: WS Manage your Backup in LLD (#6988)
mcayuelas-ledger Jun 6, 2024
f30521b
Rename steps
mcayuelas-ledger Jun 7, 2024
008108c
⚑️ [FEAT] : WalletSync - Synchronize with LLD πŸ”„ (#7023)
mcayuelas-ledger Jun 10, 2024
9b1fc8a
⚑[FEAT]: WS Manage your Backup in LLD
mcayuelas-ledger May 31, 2024
f9f8f69
Add Loading + error screen
mcayuelas-ledger May 31, 2024
37dbfee
Add unsecured Error
sshmaxime Jun 3, 2024
f218c4a
transition between flows
mcayuelas-ledger Jun 4, 2024
df81499
Synchronize flow
mcayuelas-ledger Jun 5, 2024
46c2537
WIP - Step 1 ManageInstances
mcayuelas-ledger Jun 7, 2024
b07775b
Manage Instances + rework Step system
mcayuelas-ledger Jun 7, 2024
b6b0dd4
Add Integration test
mcayuelas-ledger Jun 7, 2024
881c4e3
clean console
mcayuelas-ledger Jun 10, 2024
cad587f
Fix tests
mcayuelas-ledger Jun 10, 2024
ad8b282
Fix flows and faked stuffs
mcayuelas-ledger Jun 10, 2024
54c25e1
Initial setup on folders
sshmaxime May 16, 2024
9c0857f
Fix key
mcayuelas-ledger May 20, 2024
c431002
Reorg files using newArch folder
mcayuelas-ledger May 21, 2024
999108d
[WIP]: WS activation flow (connect device)
mcayuelas-ledger May 20, 2024
dbcd959
add router
mcayuelas-ledger May 20, 2024
e7f500e
Generic Error/success screen
mcayuelas-ledger May 21, 2024
7ea07b1
[WIP]: WS activation flow (connect device)
mcayuelas-ledger May 20, 2024
33ee06f
add router
mcayuelas-ledger May 20, 2024
51cd953
Reorg in new arch
mcayuelas-ledger May 21, 2024
08639ab
Fix files
mcayuelas-ledger May 21, 2024
ac091c1
Error/success screens
mcayuelas-ledger May 21, 2024
ccf384c
use DeviceAction
mcayuelas-ledger May 21, 2024
352af86
add loading state
mcayuelas-ledger May 21, 2024
41fec88
UI polish and fix
mcayuelas-ledger May 21, 2024
a8f4457
Add loading screen for WS activation
sshmaxime May 28, 2024
3568a6a
Add loader animation
sshmaxime May 28, 2024
94ecd1f
πŸ›οΈ Regorg files
mcayuelas-ledger May 31, 2024
7976b3d
⚑[FEAT]: WS Manage your Backup in LLD (#6988)
mcayuelas-ledger Jun 6, 2024
7ab972e
Rename steps
mcayuelas-ledger Jun 7, 2024
47d26ab
⚑️ [FEAT] : WalletSync - Synchronize with LLD πŸ”„ (#7023)
mcayuelas-ledger Jun 10, 2024
b095ef0
Merge branch 'feat/ws-activation-flow-lld' into feat/manage-instances…
mcayuelas-ledger Jun 10, 2024
6fdab18
changeset
mcayuelas-ledger Jun 10, 2024
82ab2e2
Merge branch 'develop' into feat/manage-instances-LLD
mcayuelas-ledger Jun 11, 2024
fded14f
More cleaner code
mcayuelas-ledger Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/plenty-elephants-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Add manage Synchronized instances in Debugger + WalletSync
5 changes: 5 additions & 0 deletions .changeset/red-maps-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Manage your Backup for WalletSync
5 changes: 5 additions & 0 deletions .changeset/shy-vans-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/react-ui": patch
---

Add new Numbered List component
5 changes: 5 additions & 0 deletions .changeset/ten-kids-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

WalletSync - Synchronize Flow
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/.unimportedrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"extensions": [".ts", ".js", ".jsx", ".tsx"],
"ignorePatterns": ["**/node_modules/**"],
"ignoreUnresolved": ["unzip-crx-3", "../../../../release-notes.json"],
"ignoreUnresolved": ["../../../../release-notes.json", "unzip-crx-3"],
"ignoreUnimported": [
"**/*.test.*",
"**/*.spec.*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,21 @@
import { Box, Flex, Icons, Text } from "@ledgerhq/react-ui";
import React, { PropsWithChildren } from "react";
import { Flex, Icons, Box, Text } from "@ledgerhq/react-ui";
import React from "react";
import { useTranslation } from "react-i18next";
import { useTheme } from "styled-components";
import ButtonV3 from "~/renderer/components/ButtonV3";
import useTheme from "~/renderer/hooks/useTheme";
import { LogoWrapper } from "LLD/WalletSync/components/LogoWrapper";

const LogoWrapper = ({ children, opacity = "70%" }: PropsWithChildren & { opacity?: string }) => (
<Box>
<Flex padding="7px" borderRadius="13px" border="1px solid hsla(0, 0%, 100%, 0.05)">
<Flex
borderRadius="9px"
backgroundColor="hsla(248, 100%, 85%, 0.08)"
padding="5px"
opacity={opacity}
>
{children}
</Flex>
</Flex>
</Box>
);
type Props = {
goToCreateBackup: () => void;
goToSync: () => void;
};

const WalletSyncActivation = () => {
export default function CreateOrSynchronizeStep({ goToCreateBackup, goToSync }: Props) {
const { colors } = useTheme();
const { t } = useTranslation();

return (
<Flex
flexDirection="column"
height="100%"
paddingX="64px"
alignSelf="center"
justifyContent="center"
rowGap="48px"
>
<>
<Flex flexDirection="column" alignSelf="center" justifyContent="center" rowGap="24px">
<Flex justifyContent="center" alignItems="center">
<LogoWrapper>
Expand All @@ -54,7 +38,9 @@ const WalletSyncActivation = () => {
{t("walletSync.activate.description")}
</Text>
<Flex justifyContent="center">
<ButtonV3 variant="main"> {t("walletSync.activate.cta")}</ButtonV3>
<ButtonV3 variant="main" onClick={goToCreateBackup}>
{t("walletSync.activate.cta")}
</ButtonV3>
</Flex>
</Flex>

Expand All @@ -70,12 +56,12 @@ const WalletSyncActivation = () => {
{t("walletSync.alreadySync.title")}
</Text>
<Box>
<ButtonV3 variant="shade">{t("walletSync.alreadySync.cta")}</ButtonV3>
<ButtonV3 variant="shade" onClick={goToSync}>
{t("walletSync.alreadySync.cta")}
</ButtonV3>
</Box>
</Flex>
</Box>
</Flex>
</>
);
};

export default WalletSyncActivation;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { getEnv } from "@ledgerhq/live-env";
import React, { useMemo } from "react";
import DeviceAction from "~/renderer/components/DeviceAction";
import { mockedEventEmitter } from "~/renderer/components/debug/DebugMock";
import connectApp from "@ledgerhq/live-common/hw/connectApp";
import { createAction } from "@ledgerhq/live-common/hw/actions/app";
import { getCryptoCurrencyById } from "@ledgerhq/live-common/currencies/index";

const action = createAction(getEnv("MOCK") ? mockedEventEmitter : connectApp);

type Props = {
goNext: () => void;
};

export default function DeviceActionStep({ goNext }: Props) {
//const request = { appName: "BOLOS" };
const currency = getCryptoCurrencyById("bitcoin");
const request = useMemo(() => ({ currency }), [currency]);
return <DeviceAction action={action} request={request} onResult={() => goNext()} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { useCallback, useEffect } from "react";
import Loading from "../../components/LoadingStep";
import { useTranslation } from "react-i18next";
import { UnsecuredError } from "./03-UnsecuredError";

type Props = {
goNext: () => void;
};

export default function ActivationOrSynchroWithTrustchain({ goNext }: Props) {
const { t } = useTranslation();

const hasError = false;

// TO CHANGE WHEN INTRAGRATION WITH TRUSTCHAIN
const stuffHandledByTrustchain = useCallback(() => {
goNext();
}, [goNext]);
// TO CHANGE WHEN INTRAGRATION WITH TRUSTCHAIN
useEffect(() => {
setTimeout(() => {
!hasError && stuffHandledByTrustchain();
}, 3000);
}, [hasError, stuffHandledByTrustchain]);

return hasError ? (
<UnsecuredError />
) : (
<Loading title={t("walletSync.loading.title")} subtitle={t("walletSync.loading.activation")} />
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { Box, Flex, Icons, Text } from "@ledgerhq/react-ui";
import React from "react";
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import styled, { useTheme } from "styled-components";
import { setFlow } from "~/renderer/actions/walletSync";
import ButtonV3 from "~/renderer/components/ButtonV3";
import { Flow, Step } from "~/renderer/reducers/walletSync";

const Container = styled(Box)`
background-color: ${p => p.theme.colors.opacityDefault.c05};
border-radius: 100%;
height: 72px;
width: 72px;
display: flex;
align-items: center;
justify-content: center;
`;

export const UnsecuredError = () => {
const dispatch = useDispatch();
const tryAgain = () => console.log("try again");
const goToDelete = () => {
dispatch(setFlow({ flow: Flow.ManageBackups, step: Step.ManageBackup }));
};
const { t } = useTranslation();
const { colors } = useTheme();
return (
<Flex
flexDirection="column"
alignItems="center"
justifyContent="center"
height="100%"
rowGap="24px"
paddingX={50}
>
<Container>
<Icons.DeleteCircleFill size={"L"} color={colors.error.c60} />
</Container>
<Text fontSize={24} variant="h4Inter" color="neutral.c100" textAlign="center">
{t("walletSync.unsecuredError.title")}
</Text>

<Flex flexDirection="column" rowGap="16px">
<Text variant="bodyLineHeight" color="neutral.c70" textAlign="center" fontSize={14}>
{t("walletSync.unsecuredError.description")}
</Text>
<Text variant="bodyLineHeight" color="neutral.c70" textAlign="center" fontSize={14}>
{t("walletSync.unsecuredError.info")}
</Text>
</Flex>

<ButtonV3 variant="shade" onClick={tryAgain}>
{t("walletSync.unsecuredError.cta")}
</ButtonV3>
<ButtonV3 onClick={goToDelete}>{t("walletSync.unsecuredError.ctaDelete")}</ButtonV3>
</Flex>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";
//import { Error } from "../../components/Error";
import { Success } from "../../components/Success";
import { useTranslation } from "react-i18next";

type Props = {
hasBackup: boolean;
};

export default function ActivationFinalStep({ hasBackup }: Props) {
const { t } = useTranslation();
const title = !hasBackup ? "walletSync.success.backup.title" : "walletSync.success.synch.title";
const desc = !hasBackup ? "walletSync.success.backup.desc" : "walletSync.success.synch.desc";
return <Success title={t(title)} description={t(desc)} withCta={!hasBackup} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from "react";
import { useDispatch } from "react-redux";
import { Flex } from "@ledgerhq/react-ui";
import { Flow, Step } from "~/renderer/reducers/walletSync";
import { setFlow } from "~/renderer/actions/walletSync";

import { useFlows } from "../useFlows";
import CreateOrSynchronizeStep from "./01-CreateOrSynchronizeStep";
import DeviceActionStep from "./02-DeviceActionStep";
import ActivationOrSynchroWithTrustchain from "./03-ActivationOrSynchroWithTrustchain";
import ActivationFinalStep from "./04-ActivationFinalStep";
import { useBackup } from "../ManageBackup/useBackup";
import { useInstances } from "../ManageInstances/useInstances";

const WalletSyncActivation = () => {
const dispatch = useDispatch();
const { hasBackup, createBackup } = useBackup();
const { createInstance } = useInstances();

const { currentStep, goToNextScene } = useFlows({ flow: Flow.Activation });

const goToSync = () => {
dispatch(setFlow({ flow: Flow.Synchronize, step: Step.SynchronizeMode }));
};

const createNewBackupAction = () => {
goToNextScene();
createBackup();
createInstance({
name: "Iphone 8",
id: "1",
typeOfDevice: "mobile",
});
};

const getStep = () => {
switch (currentStep) {
default:
case Step.CreateOrSynchronize:
return <CreateOrSynchronizeStep goToCreateBackup={goToNextScene} goToSync={goToSync} />;
case Step.DeviceAction:
return <DeviceActionStep goNext={goToNextScene} />;
case Step.CreateOrSynchronizeTrustChain:
return <ActivationOrSynchroWithTrustchain goNext={createNewBackupAction} />;
case Step.ActivationFinal:
return <ActivationFinalStep hasBackup={hasBackup} />;
}
};

return (
<Flex
flexDirection="column"
height="100%"
paddingX="64px"
alignSelf="center"
justifyContent="center"
rowGap="48px"
>
{getStep()}
</Flex>
);
};

export default WalletSyncActivation;
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Flex, Box, Icons, Text } from "@ledgerhq/react-ui";
import React from "react";
import styled from "styled-components";
import styled, { useTheme } from "styled-components";

export type OptionProps = {
label: string;
description: string;
onClick?: () => void;
testId: string;
};

export const OptionContainer = styled.div`
Expand All @@ -13,17 +15,13 @@ export const OptionContainer = styled.div`
}
`;

export const Separator = styled.div`
&::after {
content: "";
font-size: 13px;
color: ${p => p.theme.colors.palette.divider};
padding: 0 15px;
}
`;
export const Separator = () => {
const { colors } = useTheme();
return <Box height="1px" width="100%" backgroundColor={colors.opacityDefault.c05} />;
};

export const Option = ({ label, description }: OptionProps) => (
<OptionContainer>
export const Option = ({ label, description, onClick, testId }: OptionProps) => (
<OptionContainer onClick={onClick} data-testid={testId}>
<Flex>
<Box paddingY={24} width={304}>
<Box>
Expand Down
Loading
Loading