Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/afraid-lemons-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": minor
---

Update background images on card and wallet for w4.0
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function WalletTabBackgroundGradient({ color, visible = true }: Readonly<Props>)
const { theme, colors } = useTheme();
const { scrollY, headerHeight } = useContext(WalletTabNavigatorScrollContext);
const [imageLoaded, setImageLoaded] = useState(false);
const { isWallet40Enabled, isWallet40DarkMode } = useWallet40Theme("mobile");
const { isWallet40Enabled } = useWallet40Theme("mobile");

const opacity = useMemo(
() =>
Expand Down Expand Up @@ -59,23 +59,21 @@ function WalletTabBackgroundGradient({ color, visible = true }: Readonly<Props>)
);

const chosenSource = useMemo(() => {
if (isWallet40Enabled && theme === "dark") {
return require("~/images/portfolio/v4-dark.webp");
if (isWallet40Enabled) {
return theme === "dark"
? require("~/images/portfolio/v4-dark.webp")
: require("~/images/portfolio/v4-light.webp");
}
return theme === "dark"
? require("~/images/portfolio/dark.webp")
: require("~/images/portfolio/light.webp");
}, [theme, isWallet40Enabled]);

// Wallet 4.0 light mode uses a solid background color
const isWallet40LightMode = isWallet40Enabled && !isWallet40DarkMode;

if (color || isWallet40LightMode) {
const backgroundColor = color ?? colors.background.main;
if (color) {
return (
<Animated.View style={[containerStyle, { opacity: visible ? opacity : 0 }]}>
<LinearGradient
colors={[backgroundColor, colors.background.main]}
colors={[color, colors.background.main]}
locations={[0, 1]}
start={{ x: 0.5, y: 0 }}
end={{ x: 0.5, y: 1 }}
Expand All @@ -94,23 +92,7 @@ function WalletTabBackgroundGradient({ color, visible = true }: Readonly<Props>)
onLoadStart={() => setImageLoaded(false)}
fadeDuration={imageLoaded ? 0 : 300}
/>
{isWallet40DarkMode ? (
// Wallet 4.0: permanent gradient from transparent to black (faster fade)
<LinearGradient
colors={["transparent", "rgba(0,0,0,0.6)", "#000000"]}
locations={[0, 0.5, 0.85]}
start={{ x: 0.5, y: 0 }}
end={{ x: 0.5, y: 1 }}
style={{
position: "absolute",
width: "100%",
height: "100%",
top: 0,
left: 0,
}}
/>
) : (
// Legacy: animated gradient on scroll
{!isWallet40Enabled && (
<Animated.View
style={{
position: "absolute",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/ledger-live-mobile/src/images/portfolio/v4-dark.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { memo } from "react";
import { ImageBackground } from "react-native";
import { ImageBackground, ImageSourcePropType } from "react-native";
import { Box } from "@ledgerhq/lumen-ui-rnative";
import LinearGradient from "react-native-linear-gradient";
import SafeAreaView from "~/components/SafeAreaView";
import { TrackScreen } from "~/analytics";
import { ScreenHeroSectionView } from "LLM/components/ScreenHeroSection/ScreenHeroSectionView";
Expand All @@ -19,9 +18,9 @@ interface CardLandingScreenViewProps {
readonly topInset: number;
readonly bottomInset: number;
readonly backgroundColor: string;
readonly isWallet40DarkMode: boolean;
readonly imageLoaded: boolean;
readonly onImageLoaded: () => void;
readonly backgroundImageSource: ImageSourcePropType;
}

const CardLandingScreenView = ({
Expand All @@ -32,45 +31,29 @@ const CardLandingScreenView = ({
topInset,
bottomInset,
backgroundColor,
isWallet40DarkMode,
imageLoaded,
onImageLoaded,
backgroundImageSource,
}: CardLandingScreenViewProps) => {
return (
<SafeAreaView isFlex style={{ backgroundColor }} testID={CARD_LANDING_TEST_IDS.screen}>
<TrackScreen name={pageName} />

{isWallet40DarkMode && (
<Box
style={{
position: "absolute",
width: "100%",
height: 500,
top: 0,
left: 0,
}}
>
<ImageBackground
source={require("~/images/portfolio/v4-dark.webp")}
style={{ width: "100%", height: "100%" }}
onLoad={onImageLoaded}
fadeDuration={imageLoaded ? 0 : 300}
/>
<LinearGradient
colors={["transparent", "rgba(0,0,0,0.6)", "#000000"]}
locations={[0, 0.5, 0.85]}
start={{ x: 0.5, y: 0 }}
end={{ x: 0.5, y: 1 }}
style={{
position: "absolute",
width: "100%",
height: "100%",
top: 0,
left: 0,
}}
/>
</Box>
)}
<Box
style={{
position: "absolute",
width: "100%",
height: 500,
top: 0,
left: 0,
}}
>
<ImageBackground
source={backgroundImageSource}
style={{ width: "100%", height: "100%" }}
onLoad={onImageLoaded}
fadeDuration={imageLoaded ? 0 : 300}
/>
</Box>

<Box style={{ flex: 1, paddingTop: topInset }}>
<ScreenHeroSectionView ctas={<CardActions ctas={ctas} />}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { PAGE_NAME, CARD_APP_ID, CL_CARD_APP_ID } from "../../constants";
import { NavigatorName, ScreenName } from "~/const";
import { useNavigation } from "@react-navigation/core";
import { useNavigationBarHeights } from "LLM/hooks/useNavigationBarHeights";
import { ImageSourcePropType } from "react-native";

const HEADER_HEIGHT = 48;

Expand All @@ -21,9 +22,9 @@ export interface CardLandingScreenViewModelResult {
readonly topInset: number;
readonly bottomInset: number;
readonly backgroundColor: string;
readonly isWallet40DarkMode: boolean;
readonly imageLoaded: boolean;
readonly onImageLoaded: () => void;
readonly backgroundImageSource: ImageSourcePropType;
}

const TRACKING_BUTTON_EVENT = "button_clicked";
Expand Down Expand Up @@ -87,6 +88,13 @@ export const useCardLandingScreenViewModel = (): CardLandingScreenViewModelResul
[t, handleExploreCardsPress, handleIHaveACardPress],
);

const backgroundImageSource = useMemo(() => {
if (isWallet40DarkMode) {
return require("~/images/card/card-bg.webp");
}
return require("~/images/portfolio/v4-light.webp");
}, [isWallet40DarkMode]);

const topInset = HEADER_HEIGHT;
const bottomInset = bottomBarHeight;

Expand All @@ -98,8 +106,8 @@ export const useCardLandingScreenViewModel = (): CardLandingScreenViewModelResul
topInset,
bottomInset,
backgroundColor: lumenTheme.colors.bg.base,
isWallet40DarkMode,
imageLoaded,
onImageLoaded,
backgroundImageSource,
};
};
22 changes: 11 additions & 11 deletions apps/ledger-live-mobile/src/screens/PTX/Earn/EarnBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ function EarnBackgroundComponent({ scrollY, fadeDistance }: Props) {
backgroundColor: theme.colors.bg.base,
},
imageContainer: {
aspectRatio: 25 / 32,
width: "100%",
height: 500,
},
}),
[],
);

const isDark = useMemo(() => {
return colorScheme === "dark";
}, [colorScheme]);

const opacity = useMemo(
() =>
scrollY
Expand All @@ -44,15 +41,18 @@ function EarnBackgroundComponent({ scrollY, fadeDistance }: Props) {
[scrollY, fadeDistance],
);

const source = require("~/images/liveApps/earn/background-dark.webp");
const source = useMemo(() => {
if (colorScheme === "dark") {
return require("~/images/liveApps/earn/background-dark.webp");
}
return require("~/images/portfolio/v4-light.webp");
}, [colorScheme]);

return (
<View style={styles.container} pointerEvents="none">
{isDark && (
<Animated.View style={{ opacity }}>
<ImageBackground source={source} style={styles.imageContainer} />
</Animated.View>
)}
<Animated.View style={{ opacity }}>
<ImageBackground source={source} style={styles.imageContainer} />
</Animated.View>
</View>
);
}
Expand Down