-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5f105d
commit b2aaec1
Showing
8 changed files
with
178 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...er-live-mobile/src/newArch/features/WalletSync/components/Synchronize/BottomContainer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React from "react"; | ||
import { ScrollContainer, Text, Flex } from "@ledgerhq/native-ui"; | ||
import { useTranslation } from "react-i18next"; | ||
import styled, { useTheme } from "styled-components/native"; | ||
|
||
type Props = { | ||
steps: { | ||
description: React.JSX.Element; | ||
}[]; | ||
}; | ||
|
||
const BulletPoint = styled(Flex)` | ||
width: 16px; | ||
height: 16px; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: ${({ theme }) => theme.colors.primary.c80}; | ||
border-radius: 100px; | ||
`; | ||
|
||
const FlexContainer = styled(Flex)` | ||
margin-bottom: 16px; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: flex-start; | ||
gap: 12px; | ||
`; | ||
|
||
const BottomContainer = ({ steps }: Props) => { | ||
const { colors } = useTheme(); | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<ScrollContainer | ||
px={16} | ||
py={24} | ||
background={colors.opacityDefault.c05} | ||
borderRadius={24} | ||
showsVerticalScrollIndicator={false} | ||
maxHeight={200} | ||
> | ||
<Text variant="h4" fontSize={18} color={colors.neutral.c100} mb={24}> | ||
{t("walletSync.synchronize.qrCode.scan.explanation.title")} | ||
</Text> | ||
<Flex width={"100%"} mb={32}> | ||
{steps.map((step, index) => ( | ||
<FlexContainer key={index}> | ||
<BulletPoint> | ||
<Text fontSize={11} color={colors.neutral.c00}> | ||
{index + 1} | ||
</Text> | ||
</BulletPoint> | ||
<Flex>{step.description}</Flex> | ||
</FlexContainer> | ||
))} | ||
</Flex> | ||
</ScrollContainer> | ||
); | ||
}; | ||
|
||
export default BottomContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
.../ledger-live-mobile/src/newArch/features/WalletSync/components/Synchronize/ScanQrCode.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from "react"; | ||
import { Flex, Icons, Text } from "@ledgerhq/native-ui"; | ||
import { Trans, useTranslation } from "react-i18next"; | ||
import styled, { useTheme } from "styled-components/native"; | ||
import BottomContainer from "./BottomContainer"; | ||
import { BarCodeScanningResult, Camera, CameraType } from "expo-camera"; | ||
import { BarCodeScanner } from "expo-barcode-scanner"; | ||
import ScanTargetSvg from "./ScanTargetSvg"; | ||
import RequiresCameraPermissions from "~/components/RequiresCameraPermissions"; | ||
|
||
const Italic = styled(Text)` | ||
font-style: italic; | ||
`; | ||
// Won't work since we don't have inter italic font | ||
|
||
const ScanQrCode = () => { | ||
const { t } = useTranslation(); | ||
const { colors } = useTheme(); | ||
|
||
const steps = [ | ||
{ | ||
description: ( | ||
<Text variant="body" flex={1} fontSize={14} color={colors.opacityDefault.c70}> | ||
{t("walletSync.synchronize.qrCode.scan.explanation.steps.step1")} | ||
</Text> | ||
), | ||
}, | ||
{ | ||
description: ( | ||
<Text variant="body" flex={1} fontSize={14} color={colors.opacityDefault.c70}> | ||
<Trans | ||
i18nKey="walletSync.synchronize.qrCode.scan.explanation.steps.step2" | ||
components={[ | ||
<Italic key={0} color={colors.opacityDefault.c70} />, | ||
<Text key={1} color={colors.opacityDefault.c30} />, | ||
]} | ||
/> | ||
</Text> | ||
), | ||
}, | ||
{ | ||
description: ( | ||
<Text variant="body" flex={1} fontSize={14} color={colors.opacityDefault.c70}> | ||
{t("walletSync.synchronize.qrCode.scan.explanation.steps.step3")} | ||
</Text> | ||
), | ||
}, | ||
]; | ||
|
||
return ( | ||
<Flex minHeight={400} justifyContent={"center"} alignItems={"center"} rowGap={24}> | ||
<RequiresCameraPermissions optimisticallyMountChildren fallBackHasNoBackground> | ||
<Flex> | ||
<Camera | ||
style={{ backgroundColor: colors.neutral.c50 }} | ||
type={CameraType.back} | ||
barCodeScannerSettings={{ | ||
barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr], | ||
}} | ||
onBarCodeScanned={({ data }: BarCodeScanningResult) => console.log(data)} | ||
> | ||
<ScanTargetSvg /> | ||
</Camera> | ||
</Flex> | ||
<Flex flexDirection={"row"} alignItems={"center"} columnGap={8}> | ||
<Text variant="bodyLineHeight"> | ||
{t("walletSync.synchronize.qrCode.scan.description")} | ||
</Text> | ||
<Icons.QrCode /> | ||
</Flex> | ||
<BottomContainer steps={steps} /> | ||
</RequiresCameraPermissions> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default ScanQrCode; |
14 changes: 14 additions & 0 deletions
14
...dger-live-mobile/src/newArch/features/WalletSync/components/Synchronize/ScanTargetSvg.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as React from "react"; | ||
import Svg, { SvgProps, Path } from "react-native-svg"; | ||
const ScanTargetSvg = (props: SvgProps) => ( | ||
<Svg width={289} height={289} fill="none" {...props}> | ||
<Path | ||
stroke="#fff" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth={7} | ||
d="M4 74.25V55.2c0-17.922 0-26.883 3.488-33.728A32 32 0 0 1 21.472 7.488C28.317 4 37.278 4 55.2 4h19.05M4 214.75v19.05c0 17.922 0 26.883 3.488 33.728a32 32 0 0 0 13.984 13.984C28.317 285 37.278 285 55.2 285h19.05m140.5 0h19.05c17.922 0 26.883 0 33.728-3.488a32 32 0 0 0 13.984-13.984C285 260.683 285 251.722 285 233.8v-19.05m0-140.5V55.2c0-17.922 0-26.883-3.488-33.728a32 32 0 0 0-13.984-13.984C260.683 4 251.722 4 233.8 4h-19.05" | ||
/> | ||
</Svg> | ||
); | ||
export default ScanTargetSvg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters