Skip to content

Commit 0062cfc

Browse files
committed
feat(mobile): update background images for wallet 4.0 light and dark modes
- Add v4-light.webp portfolio background for wallet 4.0 light mode - Replace card-landing-bg.webp with card-bg.webp - Update WalletTabBackgroundGradient to use v4-light image instead of solid color - Simplify CardLandingScreenView with dynamic background image source - Update EarnBackground to support both light and dark theme backgrounds
1 parent 1b75e0b commit 0062cfc

File tree

8 files changed

+42
-64
lines changed

8 files changed

+42
-64
lines changed

.changeset/afraid-lemons-train.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"live-mobile": minor
3+
---
4+
5+
Update background images on card and wallet for w4.0

apps/ledger-live-mobile/src/components/WalletTab/WalletTabBackgroundGradient.tsx

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function WalletTabBackgroundGradient({ color, visible = true }: Readonly<Props>)
1616
const { theme, colors } = useTheme();
1717
const { scrollY, headerHeight } = useContext(WalletTabNavigatorScrollContext);
1818
const [imageLoaded, setImageLoaded] = useState(false);
19-
const { isWallet40Enabled, isWallet40DarkMode } = useWallet40Theme("mobile");
19+
const { isWallet40Enabled } = useWallet40Theme("mobile");
2020

2121
const opacity = useMemo(
2222
() =>
@@ -59,23 +59,21 @@ function WalletTabBackgroundGradient({ color, visible = true }: Readonly<Props>)
5959
);
6060

6161
const chosenSource = useMemo(() => {
62-
if (isWallet40Enabled && theme === "dark") {
63-
return require("~/images/portfolio/v4-dark.webp");
62+
if (isWallet40Enabled) {
63+
return theme === "dark"
64+
? require("~/images/portfolio/v4-dark.webp")
65+
: require("~/images/portfolio/v4-light.webp");
6466
}
6567
return theme === "dark"
6668
? require("~/images/portfolio/dark.webp")
6769
: require("~/images/portfolio/light.webp");
6870
}, [theme, isWallet40Enabled]);
6971

70-
// Wallet 4.0 light mode uses a solid background color
71-
const isWallet40LightMode = isWallet40Enabled && !isWallet40DarkMode;
72-
73-
if (color || isWallet40LightMode) {
74-
const backgroundColor = color ?? colors.background.main;
72+
if (color) {
7573
return (
7674
<Animated.View style={[containerStyle, { opacity: visible ? opacity : 0 }]}>
7775
<LinearGradient
78-
colors={[backgroundColor, colors.background.main]}
76+
colors={[color, colors.background.main]}
7977
locations={[0, 1]}
8078
start={{ x: 0.5, y: 0 }}
8179
end={{ x: 0.5, y: 1 }}
@@ -94,23 +92,7 @@ function WalletTabBackgroundGradient({ color, visible = true }: Readonly<Props>)
9492
onLoadStart={() => setImageLoaded(false)}
9593
fadeDuration={imageLoaded ? 0 : 300}
9694
/>
97-
{isWallet40DarkMode ? (
98-
// Wallet 4.0: permanent gradient from transparent to black (faster fade)
99-
<LinearGradient
100-
colors={["transparent", "rgba(0,0,0,0.6)", "#000000"]}
101-
locations={[0, 0.5, 0.85]}
102-
start={{ x: 0.5, y: 0 }}
103-
end={{ x: 0.5, y: 1 }}
104-
style={{
105-
position: "absolute",
106-
width: "100%",
107-
height: "100%",
108-
top: 0,
109-
left: 0,
110-
}}
111-
/>
112-
) : (
113-
// Legacy: animated gradient on scroll
95+
{!isWallet40Enabled && (
11496
<Animated.View
11597
style={{
11698
position: "absolute",
71.1 KB
Loading
-16 KB
Binary file not shown.
-900 KB
Loading
25.7 KB
Loading

apps/ledger-live-mobile/src/mvvm/features/Card/screens/CardLandingScreen/CardLandingScreenView.tsx

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { memo } from "react";
2-
import { ImageBackground } from "react-native";
2+
import { ImageBackground, ImageSourcePropType } from "react-native";
33
import { Box } from "@ledgerhq/lumen-ui-rnative";
4-
import LinearGradient from "react-native-linear-gradient";
54
import SafeAreaView from "~/components/SafeAreaView";
65
import { TrackScreen } from "~/analytics";
76
import { ScreenHeroSectionView } from "LLM/components/ScreenHeroSection/ScreenHeroSectionView";
@@ -19,9 +18,9 @@ interface CardLandingScreenViewProps {
1918
readonly topInset: number;
2019
readonly bottomInset: number;
2120
readonly backgroundColor: string;
22-
readonly isWallet40DarkMode: boolean;
2321
readonly imageLoaded: boolean;
2422
readonly onImageLoaded: () => void;
23+
readonly backgroundImageSource: ImageSourcePropType;
2524
}
2625

2726
const CardLandingScreenView = ({
@@ -32,45 +31,29 @@ const CardLandingScreenView = ({
3231
topInset,
3332
bottomInset,
3433
backgroundColor,
35-
isWallet40DarkMode,
3634
imageLoaded,
3735
onImageLoaded,
36+
backgroundImageSource,
3837
}: CardLandingScreenViewProps) => {
3938
return (
4039
<SafeAreaView isFlex style={{ backgroundColor }} testID={CARD_LANDING_TEST_IDS.screen}>
4140
<TrackScreen name={pageName} />
42-
43-
{isWallet40DarkMode && (
44-
<Box
45-
style={{
46-
position: "absolute",
47-
width: "100%",
48-
height: 500,
49-
top: 0,
50-
left: 0,
51-
}}
52-
>
53-
<ImageBackground
54-
source={require("~/images/portfolio/v4-dark.webp")}
55-
style={{ width: "100%", height: "100%" }}
56-
onLoad={onImageLoaded}
57-
fadeDuration={imageLoaded ? 0 : 300}
58-
/>
59-
<LinearGradient
60-
colors={["transparent", "rgba(0,0,0,0.6)", "#000000"]}
61-
locations={[0, 0.5, 0.85]}
62-
start={{ x: 0.5, y: 0 }}
63-
end={{ x: 0.5, y: 1 }}
64-
style={{
65-
position: "absolute",
66-
width: "100%",
67-
height: "100%",
68-
top: 0,
69-
left: 0,
70-
}}
71-
/>
72-
</Box>
73-
)}
41+
<Box
42+
style={{
43+
position: "absolute",
44+
width: "100%",
45+
height: 500,
46+
top: 0,
47+
left: 0,
48+
}}
49+
>
50+
<ImageBackground
51+
source={backgroundImageSource}
52+
style={{ width: "100%", height: "100%" }}
53+
onLoad={onImageLoaded}
54+
fadeDuration={imageLoaded ? 0 : 300}
55+
/>
56+
</Box>
7457

7558
<Box style={{ flex: 1, paddingTop: topInset }}>
7659
<ScreenHeroSectionView ctas={<CardActions ctas={ctas} />}>

apps/ledger-live-mobile/src/mvvm/features/Card/screens/CardLandingScreen/useCardLandingScreenViewModel.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { PAGE_NAME, CARD_APP_ID, CL_CARD_APP_ID } from "../../constants";
1010
import { NavigatorName, ScreenName } from "~/const";
1111
import { useNavigation } from "@react-navigation/core";
1212
import { useNavigationBarHeights } from "LLM/hooks/useNavigationBarHeights";
13+
import { ImageSourcePropType } from "react-native";
1314

1415
const HEADER_HEIGHT = 48;
1516

@@ -21,9 +22,9 @@ export interface CardLandingScreenViewModelResult {
2122
readonly topInset: number;
2223
readonly bottomInset: number;
2324
readonly backgroundColor: string;
24-
readonly isWallet40DarkMode: boolean;
2525
readonly imageLoaded: boolean;
2626
readonly onImageLoaded: () => void;
27+
readonly backgroundImageSource: ImageSourcePropType;
2728
}
2829

2930
const TRACKING_BUTTON_EVENT = "button_clicked";
@@ -87,6 +88,13 @@ export const useCardLandingScreenViewModel = (): CardLandingScreenViewModelResul
8788
[t, handleExploreCardsPress, handleIHaveACardPress],
8889
);
8990

91+
const backgroundImageSource = useMemo(() => {
92+
if (isWallet40DarkMode) {
93+
return require("~/images/card/card-bg.webp");
94+
}
95+
return require("~/images/portfolio/v4-light.webp");
96+
}, [isWallet40DarkMode]);
97+
9098
const topInset = HEADER_HEIGHT;
9199
const bottomInset = bottomBarHeight;
92100

@@ -98,8 +106,8 @@ export const useCardLandingScreenViewModel = (): CardLandingScreenViewModelResul
98106
topInset,
99107
bottomInset,
100108
backgroundColor: lumenTheme.colors.bg.base,
101-
isWallet40DarkMode,
102109
imageLoaded,
103110
onImageLoaded,
111+
backgroundImageSource,
104112
};
105113
};

0 commit comments

Comments
 (0)