Skip to content

Commit

Permalink
fix: ledger sync loading drawer in light mode
Browse files Browse the repository at this point in the history
  • Loading branch information
KVNLS committed Oct 29, 2024
1 parent 6416fb9 commit 0a03f2f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-baboons-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": minor
---

Fix Ledger Sync loading drawer during activation
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
import React from "react";

import { useTheme } from "styled-components";
import { Box, Flex, Text } from "@ledgerhq/react-ui";

import animation from "~/renderer/animations/common/loader.json";
import Lottie from "react-lottie";
import { getEnv } from "@ledgerhq/live-env";

type Loading = {
title: string;
subtitle: string;
theme: "light" | "dark";
};

type Animation = {
theme: "light" | "dark";
};

const Animation = () => {
const Animation = ({ theme }: Animation) => {
const isPlaywright = !!getEnv("PLAYWRIGHT_RUN");
const backgroundColor = theme === "light" ? "rgba(255, 255, 255, 1)" : "rgba(28, 29, 31, 1)";

return (
<Box position="absolute" height="75%" bottom={0}>
<Box position="absolute" height="100%" width="100%" bottom={0}>
<Box
position="absolute"
zIndex={1}
height={"100%"}
width="100%"
style={{
backgroundImage: "linear-gradient(180deg, rgba(28, 29, 31, 1), 80%, rgba(0,0,0,0))",
backgroundImage: `linear-gradient(180deg, ${backgroundColor}, 80%, rgba(0,0,0,0))`,
}}
/>

Expand All @@ -40,10 +45,11 @@ const Animation = () => {
);
};

export default function Loading({ title, subtitle }: Loading) {
export default function Loading({ title, subtitle, theme }: Loading) {
const { colors } = useTheme();
return (
<Box position="relative" height="100%" width="500px">
<Animation />
<Animation theme={theme} />
<Flex
position={"relative"}
zIndex={2}
Expand All @@ -59,7 +65,7 @@ export default function Loading({ title, subtitle }: Loading) {
<Text
variant="body"
fontSize={14}
color={"hsla(0, 0%, 75%, 1)"}
color={colors.neutral.c80}
whiteSpace="pre-line"
textAlign="center"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import React from "react";
import Loading from "../../components/LoadingStep";
import { useTranslation } from "react-i18next";
import { AnalyticsFlow, AnalyticsPage } from "../../hooks/useLedgerSyncAnalytics";
import { useSelector } from "react-redux";
import { themeSelector } from "~/renderer/actions/general";
import TrackPage from "~/renderer/analytics/TrackPage";
import Loading from "../../components/LoadingStep";
import { AnalyticsFlow, AnalyticsPage } from "../../hooks/useLedgerSyncAnalytics";
import { useLoadingStep } from "../../hooks/useLoadingStep";

export default function ActivationLoadingStep() {
useLoadingStep();
const { t } = useTranslation();
const currentTheme = useSelector(themeSelector);
const title = "walletSync.loading.title";

return (
<>
<TrackPage category={String(AnalyticsPage.Loading)} flow={AnalyticsFlow} />
<Loading title={t(title)} subtitle={t("walletSync.loading.activation")} />
<Loading
title={t(title)}
subtitle={t("walletSync.loading.activation")}
theme={currentTheme}
/>
</>
);
}

0 comments on commit 0a03f2f

Please sign in to comment.