Skip to content

Commit

Permalink
⚡ [FEAT]: Add swicth in Settings to enable/disable MarketPerformanceW…
Browse files Browse the repository at this point in the history
…idget
  • Loading branch information
mcayuelas-ledger committed Jun 5, 2024
1 parent 6701d2f commit c209fd6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/long-forks-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Add swith in Settings to enable/disable MArketPerformanceWidget"
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react";
import Switch from "~/renderer/components/Switch";
import { useFeatureFlags } from "@ledgerhq/live-common/featureFlags/index";
import Track from "~/renderer/analytics/Track";
const MarketPerformanceWidgetRow = () => {
const featureFlagsProvider = useFeatureFlags();

const currentValue = Boolean(
featureFlagsProvider.getFeature("marketperformanceWidgetDesktop")?.enabled,
);

const update = (value: boolean) => {
featureFlagsProvider.overrideFeature("marketperformanceWidgetDesktop", { enabled: value });
};

return (
<>
<Track
onUpdate
event={
currentValue ? "MarketPerformanceWidgetEnabled" : "MarketPerformanceWidgetRowDisabled"
}
/>
<Switch isChecked={currentValue} onChange={() => update(!currentValue)} />
</>
);
};
export default MarketPerformanceWidgetRow;
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import ShareAnalyticsButtonFF from "./ShareAnalyticsButtonFF";
import { hasPasswordSelector } from "~/renderer/reducers/application";
import { useInitSupportedCounterValues } from "~/renderer/hooks/useInitSupportedCounterValues";
import { FeatureToggle, useFeature } from "@ledgerhq/live-common/featureFlags/index";
import MarketPerformanceWidgetRow from "./MarketPerformanceWidget";

const SectionGeneral = () => {
const hasPassword = useSelector(hasPasswordSelector);
Expand Down Expand Up @@ -66,6 +67,14 @@ const SectionGeneral = () => {
</Row>
</FeatureToggle>

<Row
title={t("settings.display.marketPerformanceWidget")}
desc={t("settings.display.marketPerformanceWidgetDesc")}
dataTestId="setting-marketPerformanceWidget"
>
<MarketPerformanceWidgetRow />
</Row>

<Row title={t("settings.profile.password")} desc={t("settings.profile.passwordDesc")}>
<PasswordButton />
</Row>
Expand Down
4 changes: 3 additions & 1 deletion apps/ledger-live-desktop/static/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3990,7 +3990,9 @@
"stock": "Regional market indicator",
"stockDesc": "Choose Western to display market increases in blue or Eastern to display them in red.",
"walletSync": "Wallet Sync",
"walletSyncDesc": "Backup your app data and synchronize multiple Ledger Live instances."
"walletSyncDesc": "Backup your app data and synchronize multiple Ledger Live instances.",
"marketPerformanceWidget": "Market Performance Widget",
"marketPerformanceWidgetDesc": "Enable this feature to view the top gainers and losers over selected timeframes on the portfolio page."
},
"developer": {
"search": "Search",
Expand Down

0 comments on commit c209fd6

Please sign in to comment.