Skip to content

Commit

Permalink
bugfix: Click on MarketWidget under FF (#8754)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcayuelas-ledger authored Dec 23, 2024
1 parent 80f5a8f commit 4fad912
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-actors-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": minor
---

Update analytics + click under FF
1 change: 1 addition & 0 deletions apps/ledger-live-desktop/src/renderer/analytics/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const getMarketWidgetAnalytics = (state: State) => {

return {
hasMarketWidget: !marketWidget?.enabled ? "Null" : hasMarketWidgetActivated ? "Yes" : "No",
hasSeenWidgetImprovements: marketWidget?.params?.enableNewFeature ? "Yes" : "No",
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function MarketPerformanceWidgetContainer({
isLoading,
hasError,
top,
enableNewFeature,
}: Props) {
const Body = BodyByMode[variant];

Expand Down Expand Up @@ -50,7 +51,13 @@ export function MarketPerformanceWidgetContainer({
range={range}
/>
) : (
<Body data={list} order={order} range={range} top={top} />
<Body
data={list}
order={order}
range={range}
top={top}
enableNewFeature={enableNewFeature}
/>
)}
</Flex>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getChangePercentage } from "~/renderer/screens/dashboard/MarketPerforma
import { useHistory } from "react-router-dom";
import { track } from "~/renderer/analytics/segment";

export function WidgetList({ data, order, range, top }: PropsBody) {
export function WidgetList({ data, order, range, top, enableNewFeature }: PropsBody) {
const noData = data.length === 0;

return (
Expand All @@ -21,14 +21,21 @@ export function WidgetList({ data, order, range, top }: PropsBody) {
<MissingData order={order} range={range} top={top} />
) : (
data.map((elem, i) => (
<WidgetRow key={i} index={i + 1} data={elem} isFirst={i === 0} range={range} />
<WidgetRow
key={i}
index={i + 1}
data={elem}
isFirst={i === 0}
range={range}
enableNewFeature={enableNewFeature}
/>
))
)}
</Flex>
);
}

function WidgetRow({ data, index, range }: PropsBodyElem) {
function WidgetRow({ data, index, range, enableNewFeature }: PropsBodyElem) {
const counterValueCurrency = useSelector(counterValueCurrencySelector);
const locale = useSelector(localeSelector);
const history = useHistory();
Expand All @@ -45,7 +52,12 @@ function WidgetRow({ data, index, range }: PropsBodyElem) {
}, [data, history]);

return (
<MainContainer justifyContent="space-between" py="6px" onClick={onCurrencyClick}>
<MainContainer
justifyContent="space-between"
py="6px"
onClick={enableNewFeature ? onCurrencyClick : undefined}
featureFlagEnabled={enableNewFeature}
>
<Flex alignItems="center" flex={1}>
<Text color="neutral.c80" variant="h5Inter" mr={2}>
{index}
Expand Down Expand Up @@ -116,18 +128,22 @@ function WidgetRow({ data, index, range }: PropsBodyElem) {
);
}

const MainContainer = styled(Flex)`
const MainContainer = styled(Flex)<{ featureFlagEnabled?: boolean }>`
transition:
background-color 0.35s ease,
padding 0.35s ease;
border-radius: 12px;
&:hover {
transition-delay: 0.15s;
background-color: ${p => p.theme.colors.opacityDefault.c05};
padding: 6px 12px;
cursor: pointer;
}
${({ featureFlagEnabled, theme }) =>
featureFlagEnabled &&
`
&:hover {
transition-delay: 0.15s;
background-color: ${theme.colors.opacityDefault.c05};
padding: 6px 12px;
cursor: pointer;
}
`}
`;

const CryptoCurrencyIconWrapper = styled(Flex)<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type Props = {
isLoading: boolean;
hasError: boolean;
top: number;
enableNewFeature?: boolean;
};

/**
Expand All @@ -33,13 +34,15 @@ export type PropsBody = {
order: Order;
range: PortfolioRange;
top: number;
enableNewFeature?: boolean;
};

export type PropsBodyElem = {
data: MarketItemPerformer;
index: number;
isFirst: boolean;
range: PortfolioRange;
enableNewFeature?: boolean;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ export function useMarketPerformanceWidget() {
hasError: isError,
range: timeRange,
top,
enableNewFeature,
};
}

1 comment on commit 4fad912

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Bot] Testing with 'Nitrogen' ($0.00) ⏲ 5ms

What is the bot and how does it work? Everything is documented here!

Details of the 0 mutations
Portfolio ($0.00) – Details of the 0 currencies
Spec (accounts) State Remaining Runs (est) funds?

Performance ⏲ 5ms

Time spent for each spec: (total across mutations)

Spec (accounts) preload scan re-sync tx status sign op broadcast test destination test
TOTAL N/A N/A N/A N/A N/A N/A N/A N/A

What is the bot and how does it work? Everything is documented here!

Please sign in to comment.