Skip to content

Commit

Permalink
chore(lld): address change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
thesan committed Feb 11, 2025
1 parent 2f02b03 commit c0a397e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { t } from "i18next";
import React from "react";
import { NotificationCard } from "@ledgerhq/react-ui";
import { AnalyticsButton, AnalyticsPage } from "LLD/features/LNSUpsell/types/enum/Analytics";
import { openURL } from "~/renderer/linking";
import { track } from "~/renderer/analytics/segment";
import { AnalyticsButton, AnalyticsPage, type LNSUpsellType } from "../../types";

type Props = {
type: "optIn" | "optOut";
type: LNSUpsellType;
ctaLink: string;
discount: number;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { Trans } from "react-i18next";
import React from "react";
import { BannerCard, Text } from "@ledgerhq/react-ui";
import type { FlexBoxProps } from "@ledgerhq/react-ui/components/layout/Flex/index";
import { AnalyticsButton, AnalyticsPage } from "LLD/features/LNSUpsell/types/enum/Analytics";
import { openURL } from "~/renderer/linking";
import { track } from "~/renderer/analytics/segment";
import { AnalyticsButton, AnalyticsPage, type LNSUpsellType } from "../../types";

type Props = Omit<FlexBoxProps, "maxHeight"> & {
type: "optIn" | "optOut";
location: "manager" | "accounts";
type Location = "manager" | "accounts";
type Props = FlexBoxProps & {
type: LNSUpsellType;
location: Location;
image: string;
ctaLink: string;
learnMoreLink: string;
Expand All @@ -23,6 +24,7 @@ export function LNSBannerCard({
ctaLink,
learnMoreLink,
discount,
maxHeight = 175,
...boxProps
}: Props) {
const handleCTAClick = () => {
Expand All @@ -47,22 +49,22 @@ export function LNSBannerCard({
{...boxProps}
title={t(`lnsUpsell.banner.${location}.${type}.title`)}
description={
<Trans i18nKey={`lnsUpsell.banner.${location}.${type}.description`}>
<Text color="constant.purple">{{ discount } as never}</Text>
<Trans i18nKey={`lnsUpsell.banner.${location}.${type}.description`} values={{ discount }}>
<Text color="constant.purple" />
</Trans>
}
image={image}
cta={t(`lnsUpsell.banner.${location}.${type}.cta`)}
linkText={t(`lnsUpsell.banner.${location}.${type}.linkText`)}
descriptionWidth={320}
maxHeight={175}
maxHeight={maxHeight}
onClick={handleCTAClick}
onLinkClick={handleLearnMoreLink}
/>
);
}

const AnalyticsPageMap: Record<Props["location"], AnalyticsPage> = {
const AnalyticsPageMap: Record<Location, AnalyticsPage> = {
manager: AnalyticsPage.Manager,
accounts: AnalyticsPage.Accounts,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./enum/Analytics";

export type LNSUpsellType = "optIn" | "optOut";

0 comments on commit c0a397e

Please sign in to comment.