Skip to content

Commit 2382400

Browse files
authored
fix: update midnight event copy (#1905)
1 parent f740132 commit 2382400

File tree

11 files changed

+46
-40
lines changed

11 files changed

+46
-40
lines changed

apps/browser-extension-wallet/.env.defaults

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ TEMPO_VOTE_URL_MAINNET=https://tempo.vote
6161
TEMPO_VOTE_URL_PREPROD=https://preprod.tempo.vote
6262
TEMPO_VOTE_URL_PREVIEW=https://preview.tempo.vote
6363
TEMPO_VOTE_URL_SANCHONET=https://sanchonet.tempo.vote
64+
MIDNIGHT_LEARN_MORE_URL=http://midnighttge.io
6465

6566
# events tracking
6667
POSTHOG_HOST=https://e.lw.iog.io

apps/browser-extension-wallet/.env.developerpreview

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ TEMPO_VOTE_URL_MAINNET=https://tempo.vote
5959
TEMPO_VOTE_URL_PREPROD=https://preprod.tempo.vote
6060
TEMPO_VOTE_URL_PREVIEW=https://preview.tempo.vote
6161
TEMPO_VOTE_URL_SANCHONET=https://sanchonet.tempo.vote
62+
MIDNIGHT_LEARN_MORE_URL=http://midnighttge.io
6263

6364
# events tracking
6465
POSTHOG_HOST=https://e.lw.iog.io

apps/browser-extension-wallet/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ TEMPO_VOTE_URL_MAINNET=https://tempo.vote
5858
TEMPO_VOTE_URL_PREPROD=https://preprod.tempo.vote
5959
TEMPO_VOTE_URL_PREVIEW=https://preview.tempo.vote
6060
TEMPO_VOTE_URL_SANCHONET=https://sanchonet.tempo.vote
61+
MIDNIGHT_LEARN_MORE_URL=http://midnighttge.io
6162

6263
# events tracking
6364
POSTHOG_HOST=https://e.lw.iog.io

apps/browser-extension-wallet/src/views/browser-view/features/assets/components/MidnightEventBanner.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React, { Fragment, useEffect, useState } from 'react';
22
import { MidnightEventBanner as View } from '@lace/core';
3-
import { useWalletStore } from '@src/stores';
4-
import { APP_MODE_POPUP } from '@src/utils/constants';
53
import { Box, Dialog, sx } from '@input-output-hk/lace-ui-toolkit';
64
import { storage } from 'webextension-polyfill';
75
import { MIDNIGHT_EVENT_BANNER_KEY, MidnightEventBannerStorage } from '@lib/scripts/types';
86
import { useTranslation } from 'react-i18next';
7+
import { useExternalLinkOpener } from '@providers';
98

109
interface State {
1110
isLoading: boolean;
@@ -18,15 +17,12 @@ const REMINDER_TIME = Number.parseInt(process.env.MIDNIGHT_EVENT_BANNER_REMINDER
1817

1918
export const MidnightEventBanner = (): JSX.Element => {
2019
const { t } = useTranslation();
21-
const {
22-
walletUI: { appMode }
23-
} = useWalletStore();
24-
const popupView = appMode === APP_MODE_POPUP;
2520
const [state, setState] = useState<State>({
2621
isLoading: true,
2722
isDialogOpen: false,
2823
data: undefined
2924
});
25+
const openExternalLink = useExternalLinkOpener();
3026

3127
useEffect(() => {
3228
const loadStorage = async () => {
@@ -134,14 +130,13 @@ export const MidnightEventBanner = (): JSX.Element => {
134130
>
135131
<View
136132
translations={{
137-
title: popupView ? t('midnightEventBanner.popup.title') : t('midnightEventBanner.desktop.title'),
138-
description: popupView
139-
? t('midnightEventBanner.popup.description')
140-
: t('midnightEventBanner.desktop.description'),
141-
moreDetails: t('midnightEventBanner.moreDetails'),
133+
title: t('midnightEventBanner.title'),
134+
description: t('midnightEventBanner.description'),
135+
learnMore: t('midnightEventBanner.learnMore'),
142136
reminder: t('midnightEventBanner.reminder')
143137
}}
144138
onReminder={handleReminder}
139+
onLearnMore={() => openExternalLink(process.env.MIDNIGHT_LEARN_MORE_URL)}
145140
onClose={() => handleDialog(true)}
146141
/>
147142
</Box>

apps/browser-extension-wallet/src/views/browser-view/features/settings/components/SettingsLayout.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { SettingsRemoveWallet } from './SettingsRemoveWallet';
77
import { MidnightPreLaunchSettingsBanner } from '@lace/core';
88
import { Box } from '@input-output-hk/lace-ui-toolkit';
99
import MidnightPreLaunchBannerImage from '../../../../../../../../packages/core/src/ui/assets/images/midnight-launch-event-sidebar-banner.png';
10+
import { useExternalLinkOpener } from '@providers';
1011

1112
export interface SettingsLayoutProps {
1213
defaultPassphraseVisible?: boolean;
@@ -18,12 +19,16 @@ export const SettingsLayout = ({
1819
defaultMnemonic
1920
}: SettingsLayoutProps): React.ReactElement => {
2021
const { t } = useTranslation();
22+
const openExternalLink = useExternalLinkOpener();
2123

2224
const sidePanelContent = (
2325
<div>
2426
{process.env.USE_GLACIER_DROP === 'true' ? (
2527
<Box mb="$32">
26-
<MidnightPreLaunchSettingsBanner bannerImageUrl={MidnightPreLaunchBannerImage} />
28+
<MidnightPreLaunchSettingsBanner
29+
bannerImageUrl={MidnightPreLaunchBannerImage}
30+
onCtaButtonClick={() => openExternalLink(process.env.MIDNIGHT_LEARN_MORE_URL)}
31+
/>
2732
</Box>
2833
) : undefined}
2934
<SettingsAbout data-testid="about-container" />

apps/browser-extension-wallet/src/views/browser-view/features/settings/components/SettingsWalletBase.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { AboutDrawer } from './AboutDrawer';
1111
import { config } from '@src/config';
1212
import { useCustomSubmitApi, useRedirection } from '@hooks';
1313
import { BrowserViewSections, MessageTypes } from '@lib/scripts/types';
14-
import { useAnalyticsContext, useBackgroundServiceAPIContext } from '@providers';
14+
import { useAnalyticsContext, useBackgroundServiceAPIContext, useExternalLinkOpener } from '@providers';
1515
import { useSearchParams, useObservable, Button } from '@lace/common';
1616
import { walletRoutePaths } from '@routes/wallet-paths';
1717
import { PostHogAction } from '@providers/AnalyticsProvider/analyticsTracker';
@@ -49,7 +49,7 @@ export interface SettingsWalletProps<AdditionalDrawers extends string = never> {
4949
popupView?: boolean;
5050
}
5151

52-
// eslint-disable-next-line complexity
52+
// eslint-disable-next-line complexity,max-statements
5353
export const SettingsWalletBase = <AdditionalDrawers extends string>({
5454
renderLocalNodeSlot,
5555
popupView = false
@@ -76,6 +76,7 @@ export const SettingsWalletBase = <AdditionalDrawers extends string>({
7676
const backgroundServices = useBackgroundServiceAPIContext();
7777
const analytics = useAnalyticsContext();
7878
const { getCustomSubmitApiForNetwork } = useCustomSubmitApi();
79+
const openExternalLink = useExternalLinkOpener();
7980

8081
const isNetworkChoiceEnabled = AVAILABLE_CHAINS.length > 1;
8182
const authorizedAppsEnabled = process.env.USE_DAPP_CONNECTOR === 'true' && !isSharedWallet;
@@ -176,14 +177,15 @@ export const SettingsWalletBase = <AdditionalDrawers extends string>({
176177
<Title level={5} className={styles.heading5} data-testid="wallet-settings-heading">
177178
{t('browserView.settings.wallet.title')}
178179
</Title>
179-
{process.env.USE_GLACIER_DROP === 'true' ? (
180+
{process.env.USE_GLACIER_DROP === 'true' && (
180181
<SettingsLink
181182
description={t('browserView.settings.wallet.midnight.prelaunch.description')}
182183
data-testid="settings-wallet-midnight-prelaunch-link"
184+
onClick={() => openExternalLink(process.env.MIDNIGHT_LEARN_MORE_URL)}
183185
>
184186
{t('browserView.settings.wallet.midnight.prelaunch.title')}
185187
</SettingsLink>
186-
) : undefined}
188+
)}
187189
{popupView && (
188190
<>
189191
<AboutDrawer visible={activeDrawer === SettingsDrawer.about} onClose={closeDrawer} popupView={popupView} />

apps/browser-extension-wallet/src/views/browser-view/features/settings/components/__tests__/SettingsWallet.test.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
BackgroundServiceAPIProvider,
2222
BackgroundServiceAPIProviderProps,
2323
CurrencyStoreProvider,
24-
DatabaseProvider
24+
DatabaseProvider,
25+
ExternalLinkOpenerProvider
2526
} from '@providers';
2627
import { BehaviorSubject } from 'rxjs';
2728
import { act } from 'react-dom/test-utils';
@@ -130,7 +131,9 @@ const getWrapper =
130131
<I18nextProvider i18n={i18n}>
131132
<AnalyticsProvider analyticsDisabled tracker={mockAnalyticsTracker as any}>
132133
<CurrencyStoreProvider>
133-
<BackgroundServiceAPIProvider value={backgroundService}>{children}</BackgroundServiceAPIProvider>
134+
<ExternalLinkOpenerProvider>
135+
<BackgroundServiceAPIProvider value={backgroundService}>{children}</BackgroundServiceAPIProvider>
136+
</ExternalLinkOpenerProvider>
134137
</CurrencyStoreProvider>
135138
</AnalyticsProvider>
136139
</I18nextProvider>

packages/core/src/ui/components/MidnightEventBanner/MidnightEventBanner.stories.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ type Story = StoryObj<typeof MidnightEventBanner>;
1717
const data: ComponentProps<typeof MidnightEventBanner> = {
1818
translations: {
1919
description:
20-
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna',
21-
title: 'Participate in the\nMidnight Pre-Launch Event',
20+
'The free, multi-phase distribution of NIGHT tokens aimed at empowering a broad, diverse community to build the future of the Midnight network',
21+
title: 'Discover the Midnight Token Distribution',
2222
reminder: 'Remind me later',
23-
moreDetails: 'More details'
23+
learnMore: 'Learn more'
2424
}
2525
};
2626

packages/core/src/ui/components/MidnightEventBanner/MidnightEventBanner.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ interface Props {
99
translations: {
1010
title: string;
1111
description: string;
12-
moreDetails: string;
12+
learnMore: string;
1313
reminder: string;
1414
};
1515
onClose?: () => void;
16-
onMoreDetails?: () => void;
16+
onLearnMore?: () => void;
1717
onReminder?: () => void;
1818
}
1919

20-
const PopupButtons = ({ translations, onMoreDetails, onReminder }: Props): JSX.Element => (
20+
const PopupButtons = ({ translations, onLearnMore, onReminder }: Props): JSX.Element => (
2121
<Box
2222
w="$fill"
2323
className={sx({
@@ -29,15 +29,15 @@ const PopupButtons = ({ translations, onMoreDetails, onReminder }: Props): JSX.E
2929
})}
3030
>
3131
<Box mb="$10" w="$fill">
32-
<Button.CallToAction label={translations.moreDetails} w="$fill" onClick={onMoreDetails} />
32+
<Button.CallToAction label={translations.learnMore} w="$fill" onClick={onLearnMore} />
3333
</Box>
3434
<Box w="$fill">
3535
<Button.Secondary label={translations.reminder} w="$fill" onClick={onReminder} />
3636
</Box>
3737
</Box>
3838
);
3939

40-
const FullScreenButtons = ({ translations, onMoreDetails, onReminder }: Props): JSX.Element => (
40+
const FullScreenButtons = ({ translations, onLearnMore, onReminder }: Props): JSX.Element => (
4141
<Box
4242
w="$fill"
4343
className={sx({
@@ -49,7 +49,7 @@ const FullScreenButtons = ({ translations, onMoreDetails, onReminder }: Props):
4949
})}
5050
>
5151
<Box mr={'$20'}>
52-
<Button.CallToAction label={translations.moreDetails} onClick={onMoreDetails} />
52+
<Button.CallToAction label={translations.learnMore} onClick={onLearnMore} />
5353
</Box>
5454
<Box>
5555
<Button.Secondary label={translations.reminder} onClick={onReminder} />
@@ -90,7 +90,7 @@ const Title = ({ translations }: Props): JSX.Element => (
9090
</>
9191
);
9292

93-
export const MidnightEventBanner = ({ translations, onClose, onMoreDetails, onReminder }: Props): JSX.Element => (
93+
export const MidnightEventBanner = ({ translations, onClose, onLearnMore, onReminder }: Props): JSX.Element => (
9494
<Flex
9595
style={{ backgroundImage: `url(${banner})` }}
9696
className={cx(
@@ -123,7 +123,7 @@ export const MidnightEventBanner = ({ translations, onClose, onMoreDetails, onRe
123123
</Text.Body.Normal>
124124
</Box>
125125
</Flex>
126-
<PopupButtons translations={translations} onMoreDetails={onMoreDetails} onReminder={onReminder} />
127-
<FullScreenButtons translations={translations} onMoreDetails={onMoreDetails} onReminder={onReminder} />
126+
<PopupButtons translations={translations} onLearnMore={onLearnMore} onReminder={onReminder} />
127+
<FullScreenButtons translations={translations} onLearnMore={onLearnMore} onReminder={onReminder} />
128128
</Flex>
129129
);

packages/translation/src/lib/translations/browser-extension-wallet/en.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@
367367
"browserView.settings.wallet.general.showPubKeyDescription": "This lets you import your wallet to other browsers and devices, or to restore it at a later date",
368368
"browserView.settings.wallet.general.title": "Your keys",
369369
"browserView.settings.wallet.midnight.prelaunch.description": "Check how to claim and FAQ",
370-
"browserView.settings.wallet.midnight.prelaunch.title": "Midnight Pre-Launch Event",
370+
"browserView.settings.wallet.midnight.prelaunch.title": "Midnight Token Distribution",
371371
"browserView.settings.wallet.network.description": "Switch from mainnet to testnet",
372372
"browserView.settings.wallet.network.drawerDescription": "Select the network you would like your wallet to operate on.",
373373
"browserView.settings.wallet.network.networkSwitched": "Switched network",
@@ -888,14 +888,12 @@
888888
"walletSetup.setupOptions.restoreWallet": "Restore wallet",
889889
"walletSetup.walletName.pleaseNameYourWallet": "Please name your wallet",
890890
"walletSetup.walletName.walletNameDescription": "Lorem ipsum dolor sit amet",
891-
"midnightEventBanner.popup.title": "Participate in the\nMidnight Pre-Launch Event",
892-
"midnightEventBanner.desktop.title": "Participate in the Midnight Pre-Launch Event",
893-
"midnightEventBanner.desktop.description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna",
894-
"midnightEventBanner.popup.description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna",
895-
"midnightEventBanner.moreDetails": "More details",
891+
"midnightEventBanner.title": "Discover the Midnight Token Distribution",
892+
"midnightEventBanner.description": "The free, multi-phase distribution of NIGHT tokens aimed at empowering a broad, diverse community to build the future of the Midnight network",
893+
"midnightEventBanner.learnMore": "Learn more",
896894
"midnightEventBanner.reminder": "Remind me later",
897895
"midnightEventBanner.dialog.title": "Heads up",
898-
"midnightEventBanner.dialog.description": "You can check the Midnight Pre-Launch Event details anytime from settings",
896+
"midnightEventBanner.dialog.description": "You can check the Midnight Token Distribution details anytime from settings",
899897
"midnightEventBanner.dialog.confirm": "I understand",
900898
"midnightEventBanner.dialog.cancel": "Cancel",
901899
"paperWallet.savePaperWallet.title": "Save your paper wallet",

0 commit comments

Comments
 (0)