Skip to content

Commit

Permalink
update some components
Browse files Browse the repository at this point in the history
  • Loading branch information
themooneer committed Jan 8, 2025
1 parent f8d65d6 commit 71bfddd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 111 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import { useTheme } from "styled-components/native";
import GradientContainer from "~/components/GradientContainer";
import Animation from "~/components/Animation";
import lottie from "../assets/lottie.json";
function AnimatedGradient() {
const { colors } = useTheme();

return (
<GradientContainer
color={colors.background.main}
startOpacity={1}
endOpacity={0}
containerStyle={{ borderRadius: 0, position: "absolute", bottom: 0, left: 0 }}
gradientStyle={{ zIndex: 1 }}
>
<Animation style={{ width: "100%" }} source={lottie} />
</GradientContainer>
);
}

export default AnimatedGradient;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import { NetworkBasedAddAccountNavigator } from "../AddAccount/types";
import useScanDeviceAccountsViewModel from "./useScanDeviceAccountsViewModel";
import ScannedAccountsSection from "./components/ScannedAccountsSection";
import ScanLoading from "./components/ScanLoading";
import AnimatedGradient from "./components/AnimatedGradient";
import ScanDeviceAccountsFooter from "./components/ScanDeviceAccountsFooter";
import AddressTypeTooltip from "./components/AddressTypeTooltip";
import GradientContainer from "~/components/GradientContainer";
import Animation from "~/components/Animation";
import lottie from "./assets/lottie.json";

type NavigationProps = BaseComposite<
StackNavigatorProps<NetworkBasedAddAccountNavigator, ScreenName.ScanDeviceAccounts>
Expand All @@ -40,9 +37,9 @@ type Props = {
colors: Theme["colors"];
} & NavigationProps;

function ScanDeviceAccounts({ route }: Props) {
function ScanDeviceAccounts() {
const { colors } = useTheme();
const { currency, returnToSwap } = route.params || {};

const existingAccounts = useSelector(accountsSelector);
const blacklistedTokenIds = useSelector(blacklistedTokenIdsSelector);

Expand Down Expand Up @@ -72,11 +69,14 @@ function ScanDeviceAccounts({ route }: Props) {
stopSubscription,
unselectAll,
viewAllCreatedAccounts,
currency,
returnToSwap,
} = useScanDeviceAccountsViewModel({
existingAccounts,
blacklistedTokenIds,
});

// Empty state same UI as ledger-live-mobile/src/screens/AddAccounts/03-Accounts.tsx
const emptyTexts = {
creatable: alreadyEmptyAccount ? (
<LText style={styles.paddingHorizontal}>
Expand Down Expand Up @@ -132,19 +132,7 @@ function ScanDeviceAccounts({ route }: Props) {
)}
</Flex>

{scanning ? (
<>
<GradientContainer
color={colors.background.main}
startOpacity={1}
endOpacity={0}
containerStyle={{ borderRadius: 0, position: "absolute", bottom: 0, left: 0 }}
gradientStyle={{ zIndex: 1 }}
>
<Animation style={{ width: "100%" }} source={lottie} />
</GradientContainer>
</>
) : null}
{scanning ? <AnimatedGradient /> : null}
<NavigationScrollView style={styles.inner} contentContainerStyle={styles.innerContent}>
{sections.map(({ id, selectable, defaultSelected, data }, i) => {
const hasMultipleSchemes =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default function useScanDeviceAccountsViewModel({
currency,
device: { deviceId },
inline,
returnToSwap,
} = route.params || {};

const newAccountSchemes = useMemo(() => {
Expand Down Expand Up @@ -279,5 +280,7 @@ export default function useScanDeviceAccountsViewModel({
stopSubscription,
unselectAll,
viewAllCreatedAccounts,
returnToSwap,
currency,
};
}

0 comments on commit 71bfddd

Please sign in to comment.