From 86ea1ff2c84729bc51014a9054cac9bf7d6fa287 Mon Sep 17 00:00:00 2001 From: Inokentii Mazhara Date: Tue, 24 Sep 2024 22:22:20 +0300 Subject: [PATCH 1/5] TW-1539: Remove Marigold and periodic networks (#1197) * TW-1539 Remove Marigold and periodic networks * TW-1539 Remove unused functions * TW-1539 Remove onboarding scenarios from e2e tests * TW-1539 Remove 'Partners promotion' checkbox mentions from e2e tests --- e2e/src/features/create-new-wallet.feature | 46 +----------- e2e/src/features/delegate.feature | 4 +- .../features/import-existing-wallet.feature | 75 +------------------ e2e/src/features/send.feature | 4 +- e2e/src/features/swap.feature | 4 +- e2e/src/features/unlock-screen.feature | 1 - e2e/src/page-objects/index.ts | 2 +- .../pages/general-settings.page.ts | 2 - public/_locales/en/messages.json | 4 - public/_locales/en_GB/messages.json | 4 - public/_locales/fr/messages.json | 4 - public/_locales/pt/messages.json | 4 - public/_locales/tr/messages.json | 4 - public/_locales/uk/messages.json | 4 - public/_locales/zh_CN/messages.json | 4 - public/_locales/zh_TW/messages.json | 4 - src/lib/temple/networks.ts | 37 --------- 17 files changed, 9 insertions(+), 198 deletions(-) diff --git a/e2e/src/features/create-new-wallet.feature b/e2e/src/features/create-new-wallet.feature index 27a11578c2..df4fabd330 100644 --- a/e2e/src/features/create-new-wallet.feature +++ b/e2e/src/features/create-new-wallet.feature @@ -19,7 +19,6 @@ Feature: Create a new wallet And I enter defaultPassword into Password Field on the Register Form page And I enter defaultPassword into Repeat Password Field on the Register Form page And I press Analytics Check Box on the Register Form page - And I press Skip Onboarding Checkbox on the Register Form page And I press Accept Terms Checkbox on the Register Form page And I press Create Button on the Register Form page @@ -32,49 +31,6 @@ Feature: Create a new wallet Then I am on the Home page -@create_new_wallet - Scenario: As a user, I'd like to create a wallet and pass on-boarding - Given I am on the Welcome page - And I press Create New Wallet button on the Welcome page - - And I am on the NewSeedBackup page - And I press Protected Mask on the New Seed Back-up page - And I save my mnemonic - And I press I made Seed Phrase Backup Check Box on the New Seed Back-up page - And I press Next Button on the New Seed Back-up page - - And I am on the VerifyMnemonic page - And I verify my mnemonic - And I press Next Button on the New Seed Verify page - - And I am on the SetWallet page - And I enter defaultPassword into Password Field on the Register Form page - And I enter defaultPassword into Repeat Password Field on the Register Form page - And I press Analytics Check Box on the Register Form page - And I press Accept Terms Checkbox on the Register Form page - And I press Create Button on the Register Form page -# On-boarding passing - And I am on the OnboardingFirstStep page - And I press Next Button on the Onboarding (First Step) page - - And I am on the OnboardingSecondStep page - And I press Next Button on the Onboarding (Second Step) page - - And I am on the OnboardingThirdStep page - And I press Next Button on the Onboarding (Third Step) page - - And I am on the OnboardingFourthStep page - And I press Done Button on the Onboarding (Fourth Step) page - - And I am on the OnboardingCongrats page - And I press Start Button on the Onboarding (Congrats) page - - And I am on the OnRumpModal page - And I press Close Button on the On-ramp Modal page - - And I am on the NewsletterModal page - And I press Close Button on the Newsletter Modal page - - Then I am on the Home page +# TODO: add a scenario for passing an onboarding diff --git a/e2e/src/features/delegate.feature b/e2e/src/features/delegate.feature index 55cfdf43b0..153d998cc4 100644 --- a/e2e/src/features/delegate.feature +++ b/e2e/src/features/delegate.feature @@ -4,8 +4,8 @@ Feature: Delegate Scenario: As a user, i'd like to re-delegate TEZ to a baker Given I have imported an existing account And I press Selected Network Button on the Header page - And I select Marigold Mainnet node in the networks drop-down list on the Header page - And I check that Marigold Mainnet node is selected correctly + And I select Tezos Mainnet node in the networks drop-down list on the Header page + And I check that Tezos Mainnet node is selected correctly And I press Asset Item Apy Button on the Assets page And I am on the DelegateTab page diff --git a/e2e/src/features/import-existing-wallet.feature b/e2e/src/features/import-existing-wallet.feature index 4091f0f5a4..d73d7de289 100644 --- a/e2e/src/features/import-existing-wallet.feature +++ b/e2e/src/features/import-existing-wallet.feature @@ -12,7 +12,6 @@ Feature: Import existing wallet And I am on the SetWallet page And I enter defaultPassword into Password Field on the Register Form page And I enter defaultPassword into Repeat Password Field on the Register Form page - And I press Skip Onboarding Checkbox on the Register Form page And I press Analytics Check Box on the Register Form page And I press Accept Terms Checkbox on the Register Form page And I press Import Button on the Register Form page @@ -24,78 +23,6 @@ Feature: Import existing wallet - Scenario: As a user, I'd like to import wallet and pass on-boarding [Positive] - Given I am on the Welcome page - And I press Import Existing Wallet button on the Welcome page - - And I am on the ImportExistingWallet page - And I enter defaultSeedPhrase mnemonic on the ImportExistingWallet page - And I press Next button on the Import Existing Seed Phrase page - - And I am on the SetWallet page - And I enter defaultPassword into Password Field on the Register Form page - And I enter defaultPassword into Repeat Password Field on the Register Form page - And I press Analytics Check Box on the Register Form page - And I press Accept Terms Checkbox on the Register Form page - And I press Import Button on the Register Form page - - # On-boarding passing - And I am on the OnboardingFirstStep page - And I press Next Button on the Onboarding (First Step) page - - And I am on the OnboardingSecondStep page - And I press Next Button on the Onboarding (Second Step) page - - And I am on the OnboardingThirdStep page - And I press Next Button on the Onboarding (Third Step) page - - And I am on the OnboardingFourthStep page - And I press Done Button on the Onboarding (Fourth Step) page - - And I am on the OnboardingCongrats page - And I press Start Button on the Onboarding (Congrats) page - - And I am on the NewsletterModal page - And I press Close Button on the Newsletter Modal page - - Then I am on the Home page - - - Scenario: As a user, I'd like to switch between onboarding pages and skip it [Negative] - Given I am on the Welcome page - And I press Import Existing Wallet button on the Welcome page - - And I am on the ImportExistingWallet page - And I enter defaultSeedPhrase mnemonic on the ImportExistingWallet page - And I press Next button on the Import Existing Seed Phrase page - - And I am on the SetWallet page - And I enter defaultPassword into Password Field on the Register Form page - And I enter defaultPassword into Repeat Password Field on the Register Form page - And I press Analytics Check Box on the Register Form page - And I press Accept Terms Checkbox on the Register Form page - And I press Import Button on the Register Form page - - # On-boarding passing - And I am on the OnboardingFirstStep page - And I press Next Button on the Onboarding (First Step) page - - And I am on the OnboardingSecondStep page - And I press Next Button on the Onboarding (Second Step) page - - And I am on the OnboardingThirdStep page - And I press Next Button on the Onboarding (Third Step) page - - And I am on the OnboardingFourthStep page - # Returning to the previous page - And I press Back Button on the Page Layout page - - And I am on the OnboardingThirdStep page - And I press Skip Button on the Page Layout page - - And I am on the NewsletterModal page - And I press Close Button on the Newsletter Modal page - - Then I am on the Home page + # TODO: add scenarios for passing onboarding diff --git a/e2e/src/features/send.feature b/e2e/src/features/send.feature index 39211d49a0..9d1b46cfad 100644 --- a/e2e/src/features/send.feature +++ b/e2e/src/features/send.feature @@ -4,8 +4,8 @@ Feature: Send Scenario: As a user, I'd like to send my funds to another account Given I have imported an existing account And I press Selected Network Button on the Header page - And I select Marigold Mainnet node in the networks drop-down list on the Header page - And I check that Marigold Mainnet node is selected correctly + And I select Tezos Mainnet node in the networks drop-down list on the Header page + And I check that Tezos Mainnet node is selected correctly And I press Send Button on the Home page And I am on the Send page diff --git a/e2e/src/features/swap.feature b/e2e/src/features/swap.feature index 3ae553b91f..2ef9a459d8 100644 --- a/e2e/src/features/swap.feature +++ b/e2e/src/features/swap.feature @@ -4,8 +4,8 @@ Feature: Swap Scenario: As a user, i'd like to swap assets Given I have imported an existing account And I press Selected Network Button on the Header page - And I select Marigold Mainnet node in the networks drop-down list on the Header page - And I check that Marigold Mainnet node is selected correctly + And I select Tezos Mainnet node in the networks drop-down list on the Header page + And I check that Tezos Mainnet node is selected correctly And I press Swap Button on the Home page And I am on the Swap page diff --git a/e2e/src/features/unlock-screen.feature b/e2e/src/features/unlock-screen.feature index ad4d773ff9..7365488d95 100644 --- a/e2e/src/features/unlock-screen.feature +++ b/e2e/src/features/unlock-screen.feature @@ -131,7 +131,6 @@ Feature: Unlock Screen And I got the 'Attention!' warning with Alert title Text element on the Alert page And I enter defaultPassword into Password Field on the Register Form page And I enter defaultPassword into Repeat Password Field on the Register Form page - And I press Skip Onboarding Checkbox on the Register Form page And I press Analytics Check Box on the Register Form page And I press Accept Terms Checkbox on the Register Form page And I press Import Button on the Register Form page diff --git a/e2e/src/page-objects/index.ts b/e2e/src/page-objects/index.ts index 3d417a27ef..387d32b31e 100644 --- a/e2e/src/page-objects/index.ts +++ b/e2e/src/page-objects/index.ts @@ -47,7 +47,7 @@ import { UnlockScreenPage } from './pages/unlock-screen.page'; import { VerifyMnemonicPage } from './pages/verify-mnemonic.page'; import { WelcomePage } from './pages/welcome.page'; - +// TODO: add a page for advanced settings export const Pages = { Welcome: new WelcomePage(), ImportExistingWallet: new ImportExistingWalletPage(), diff --git a/e2e/src/page-objects/pages/general-settings.page.ts b/e2e/src/page-objects/pages/general-settings.page.ts index 7727364886..e25f4e217b 100644 --- a/e2e/src/page-objects/pages/general-settings.page.ts +++ b/e2e/src/page-objects/pages/general-settings.page.ts @@ -14,7 +14,6 @@ export class GeneralSettingsPage extends Page { extensionLockUpCheckBox = createPageElement(SettingsGeneralSelectors.extensionLockUpCheckBox); anonymousAnalyticsCheckBox = createPageElement(SettingsGeneralSelectors.anonymousAnalyticsCheckBox); notificationCheckBox = createPageElement(SettingsGeneralSelectors.notificationCheckBox); - partnersPromotion = createPageElement(SettingsGeneralSelectors.partnersPromotion); async isVisible() { await this.languageDropDown.waitForDisplayed(); @@ -24,6 +23,5 @@ export class GeneralSettingsPage extends Page { await this.extensionLockUpCheckBox.waitForDisplayed(); await this.anonymousAnalyticsCheckBox.waitForDisplayed(); await this.notificationCheckBox.waitForDisplayed(); - await this.partnersPromotion.waitForDisplayed(); } } diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 3d7d5dc1e0..613ff289ec 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -640,10 +640,6 @@ "message": "Tezos Mainnet", "description": "Mainnet = main network" }, - "marigoldMainnet": { - "message": "Marigold Mainnet", - "description": "Mainnet = main network" - }, "templeWalletOptions": { "message": "Temple Wallet | Options" }, diff --git a/public/_locales/en_GB/messages.json b/public/_locales/en_GB/messages.json index 35c75fedda..50f45b3046 100644 --- a/public/_locales/en_GB/messages.json +++ b/public/_locales/en_GB/messages.json @@ -500,10 +500,6 @@ "message": "Tezos Mainnet", "description": "Mainnet = main network" }, - "marigoldMainnet": { - "message": "Marigold Mainnet", - "description": "Mainnet = main network" - }, "templeWalletOptions": { "message": "Temple Wallet | Options" }, diff --git a/public/_locales/fr/messages.json b/public/_locales/fr/messages.json index f51020583d..2feeb727a0 100644 --- a/public/_locales/fr/messages.json +++ b/public/_locales/fr/messages.json @@ -478,10 +478,6 @@ "message": "Mainnet Tezos", "description": "Mainnet = main network" }, - "marigoldMainnet": { - "message": "Mainnet Marigold", - "description": "Mainnet = main network" - }, "templeWalletOptions": { "message": "Portefeuille Temple | Options" }, diff --git a/public/_locales/pt/messages.json b/public/_locales/pt/messages.json index b1741fb955..e8f917217d 100644 --- a/public/_locales/pt/messages.json +++ b/public/_locales/pt/messages.json @@ -496,10 +496,6 @@ "message": "Tezos Mainnet", "description": "Mainnet = main network" }, - "marigoldMainnet": { - "message": "Marigold Mainnet", - "description": "Mainnet = main network" - }, "templeWalletOptions": { "message": "Carteira Temple | Opções" }, diff --git a/public/_locales/tr/messages.json b/public/_locales/tr/messages.json index de50af2158..5cfae74055 100644 --- a/public/_locales/tr/messages.json +++ b/public/_locales/tr/messages.json @@ -496,10 +496,6 @@ "message": "Tezos Mainnet", "description": "Mainnet = main network" }, - "marigoldMainnet": { - "message": "Marigold Mainnet", - "description": "Mainnet = main network" - }, "templeWalletOptions": { "message": "Temple Wallet | Seçenekler" }, diff --git a/public/_locales/uk/messages.json b/public/_locales/uk/messages.json index e8979a6327..24ff92d46a 100644 --- a/public/_locales/uk/messages.json +++ b/public/_locales/uk/messages.json @@ -495,10 +495,6 @@ "message": "Tezos Mainnet", "description": "Mainnet = main network" }, - "marigoldMainnet": { - "message": "Marigold Mainnet", - "description": "Mainnet = main network" - }, "templeWalletOptions": { "message": "Temple Wallet | Налаштування" }, diff --git a/public/_locales/zh_CN/messages.json b/public/_locales/zh_CN/messages.json index d48989faef..9df70b1854 100644 --- a/public/_locales/zh_CN/messages.json +++ b/public/_locales/zh_CN/messages.json @@ -478,10 +478,6 @@ "message": "Tezos主网", "description": "Mainnet = main network" }, - "marigoldMainnet": { - "message": "Marigold主网", - "description": "Mainnet = main network" - }, "templeWalletOptions": { "message": "Temple钱包 | 选项" }, diff --git a/public/_locales/zh_TW/messages.json b/public/_locales/zh_TW/messages.json index ca59167a09..1e0bd7242f 100644 --- a/public/_locales/zh_TW/messages.json +++ b/public/_locales/zh_TW/messages.json @@ -478,10 +478,6 @@ "message": "Tezos 主網路", "description": "Mainnet = main network" }, - "marigoldMainnet": { - "message": "Marigold 主網路", - "description": "Mainnet = main network" - }, "templeWalletOptions": { "message": "Temple 錢包 | 選項" }, diff --git a/src/lib/temple/networks.ts b/src/lib/temple/networks.ts index c9561bbee3..0cc3ee4180 100644 --- a/src/lib/temple/networks.ts +++ b/src/lib/temple/networks.ts @@ -1,15 +1,5 @@ import { TempleChainId, TempleNetwork } from 'lib/temple/types'; -const formatDateToRPCFormat = (date: Date) => date.toLocaleDateString('en-GB').split('/').reverse().join('-'); - -const getLastMonday = (date = new Date()) => { - const dateCopy = new Date(date.getTime() - 604800000); - - const nextMonday = new Date(dateCopy.setDate(dateCopy.getDate() + ((7 - dateCopy.getDay() + 1) % 7 || 7))); - - return formatDateToRPCFormat(nextMonday); -}; - export const NETWORK_IDS = new Map([ [TempleChainId.Mainnet, 'mainnet'], [TempleChainId.Ghostnet, 'ghostnet'], @@ -48,15 +38,6 @@ export const NETWORKS: TempleNetwork[] = [ color: '#83b300', disabled: false }, - { - id: 'marigold-mainnet', - nameI18nKey: 'marigoldMainnet', - description: 'Marigold mainnet', - type: 'main', - rpcBaseURL: 'https://mainnet.tezos.marigold.dev', - color: '#48bb78', - disabled: false - }, { id: 'smartpy-mainnet', name: 'SmartPy Mainnet', @@ -85,24 +66,6 @@ export const NETWORKS: TempleNetwork[] = [ color: '#131380', disabled: false }, - { - id: 'monday', - name: 'MondayNet Testnet', - description: `MondayNet ${getLastMonday()}`, - type: 'test', - rpcBaseURL: `https://rpc.mondaynet-${getLastMonday()}.teztnets.xyz/`, - color: '#FBBF24', - disabled: false - }, - { - id: 'daily', - name: 'DailyNet Testnet', - description: 'DailyNet', - type: 'test', - rpcBaseURL: `https://rpc.dailynet-${formatDateToRPCFormat(new Date())}.teztnets.xyz/`, - color: '#FBBF24', - disabled: false - }, { id: 'sandbox', name: 'localhost:8732', From 0be33144c5f71f223f95ee62693ee1a54bcca129 Mon Sep 17 00:00:00 2001 From: Inokentii Mazhara Date: Wed, 25 Sep 2024 14:59:23 +0300 Subject: [PATCH 2/5] TW-1518: Ads replacement algorithm improvement (#1196) * TW-1518 Implement blacklisting Hypelab campaigns * TW-1518 Fix a type error * TW-1518 Change the algorithm for picking ad type * TW-1518 Revert harmful changes * TW-1518 Restore using Persona 321x101 banner as one more fallback * TW-1518 Update @temple-wallet/extension-ads --- package.json | 2 +- src/content-scripts/replace-ads/ads-rules.ts | 15 +- .../replace-ads/ads-stack.iframe.ts | 19 +- src/content-scripts/replace-ads/index.ts | 2 +- src/lib/ads/configure-ads.ts | 223 +++++++++++------- src/lib/constants.ts | 2 + yarn.lock | 8 +- 7 files changed, 176 insertions(+), 95 deletions(-) diff --git a/package.json b/package.json index 98faa808aa..c6d34a16bc 100644 --- a/package.json +++ b/package.json @@ -231,6 +231,6 @@ "follow-redirects": "^1.15.4" }, "optionalDependencies": { - "@temple-wallet/extension-ads": "8.1.1" + "@temple-wallet/extension-ads": "9.0.0-dev.2" } } diff --git a/src/content-scripts/replace-ads/ads-rules.ts b/src/content-scripts/replace-ads/ads-rules.ts index b95cc53ba5..d9b7977f63 100644 --- a/src/content-scripts/replace-ads/ads-rules.ts +++ b/src/content-scripts/replace-ads/ads-rules.ts @@ -4,15 +4,15 @@ import { importExtensionAdsModule } from 'lib/ads/import-extension-ads-module'; import { ALL_ADS_RULES_STORAGE_KEY, ADS_RULES_UPDATE_INTERVAL } from 'lib/constants'; import { fetchFromStorage } from 'lib/storage'; -export const getRulesFromContentScript = memoizee( - async (location: Location) => { +export const getRulesFromStorage = memoizee( + async (locationOrHref: Location | string) => { try { const { transformRawRules } = await importExtensionAdsModule(); const rulesStored = await fetchFromStorage(ALL_ADS_RULES_STORAGE_KEY); if (!rulesStored) throw new Error('No rules for ads found'); - return transformRawRules(location, rulesStored); + return transformRawRules(locationOrHref, rulesStored); } catch (error) { console.error(error); @@ -22,11 +22,16 @@ export const getRulesFromContentScript = memoizee( providersSelectors: [], providersNegativeSelectors: [], elementsToHideOrRemoveRules: [], + blacklistedHypelabCampaignsSlugs: [], timestamp: 0 }; } }, - { maxAge: ADS_RULES_UPDATE_INTERVAL, normalizer: ([location]) => location.href, promise: true } + { + maxAge: ADS_RULES_UPDATE_INTERVAL, + normalizer: ([locationOrHref]) => (typeof locationOrHref === 'string' ? locationOrHref : locationOrHref.href), + promise: true + } ); -export const clearRulesCache = () => getRulesFromContentScript.clear(); +export const clearRulesCache = () => getRulesFromStorage.clear(); diff --git a/src/content-scripts/replace-ads/ads-stack.iframe.ts b/src/content-scripts/replace-ads/ads-stack.iframe.ts index f7c6eb8cb4..9ab9ef8015 100644 --- a/src/content-scripts/replace-ads/ads-stack.iframe.ts +++ b/src/content-scripts/replace-ads/ads-stack.iframe.ts @@ -1,13 +1,28 @@ import { configureAds } from 'lib/ads/configure-ads'; import { importExtensionAdsModule } from 'lib/ads/import-extension-ads-module'; -import { ADS_META_SEARCH_PARAM_NAME, ORIGIN_SEARCH_PARAM_NAME } from 'lib/constants'; +import { ADS_META_SEARCH_PARAM_NAME, AD_CATEGORIES_PARAM_NAME, ORIGIN_SEARCH_PARAM_NAME } from 'lib/constants'; + +import { getRulesFromStorage } from './ads-rules'; const usp = new URLSearchParams(window.location.search); const id = usp.get('id'); const origin = usp.get(ORIGIN_SEARCH_PARAM_NAME) ?? window.location.href; const adsMetadataIds = usp.getAll(ADS_META_SEARCH_PARAM_NAME).map(value => JSON.parse(value)); +const adCategories = usp.getAll(AD_CATEGORIES_PARAM_NAME); configureAds() .then(() => importExtensionAdsModule()) - .then(({ renderAdsStack }) => renderAdsStack(id ?? '', adsMetadataIds, origin)) + .then(async ({ renderAdsStack }) => ({ renderAdsStack, rules: await getRulesFromStorage(origin) })) + .then(({ renderAdsStack, rules }) => { + const { blacklistedHypelabCampaignsSlugs, permanentAdPlacesRules, adPlacesRules } = rules; + + renderAdsStack( + id ?? '', + adsMetadataIds, + origin, + permanentAdPlacesRules.length > 0 || adPlacesRules.length > 0, + adCategories, + blacklistedHypelabCampaignsSlugs + ); + }) .catch(error => console.error(error)); diff --git a/src/content-scripts/replace-ads/index.ts b/src/content-scripts/replace-ads/index.ts index 6177cd706c..ca6d21ec6a 100644 --- a/src/content-scripts/replace-ads/index.ts +++ b/src/content-scripts/replace-ads/index.ts @@ -1 +1 @@ -export { getRulesFromContentScript, clearRulesCache } from './ads-rules'; +export { getRulesFromStorage as getRulesFromContentScript, clearRulesCache } from './ads-rules'; diff --git a/src/lib/ads/configure-ads.ts b/src/lib/ads/configure-ads.ts index 098572b362..667038c574 100644 --- a/src/lib/ads/configure-ads.ts +++ b/src/lib/ads/configure-ads.ts @@ -1,12 +1,41 @@ import browser from 'webextension-polyfill'; import { buildSwapPageUrlQuery } from 'app/pages/Swap/utils/build-url-query'; -import { ADS_META_SEARCH_PARAM_NAME, ContentScriptType, ORIGIN_SEARCH_PARAM_NAME } from 'lib/constants'; +import { + ADS_META_SEARCH_PARAM_NAME, + AD_CATEGORIES_PARAM_NAME, + ContentScriptType, + ORIGIN_SEARCH_PARAM_NAME +} from 'lib/constants'; import { APP_VERSION, EnvVars, IS_MISES_BROWSER } from 'lib/env'; import { isTruthy } from 'lib/utils'; import { importExtensionAdsModule } from './import-extension-ads-module'; +// Three interfaces below are copied from '@temple-wallet/extension-ads' to avoid importing it to ensure that a core +// build runs without errors. +interface AdSource { + shouldNotUseStrictContainerLimits?: boolean; + providerName: 'Temple' | 'Persona' | 'HypeLab' | 'SmartyAds'; + native?: boolean; + slug: string; + categories?: string[]; +} + +interface AdDimensions { + width: number; + height: number; + minContainerWidth: number; + minContainerHeight: number; + maxContainerWidth: number; + maxContainerHeight: number; +} + +interface AdMetadata { + source: AdSource; + dimensions: AdDimensions; +} + const smallTkeyInpageAdUrl = browser.runtime.getURL(`/misc/ad-banners/small-tkey-inpage-ad.png`); const tkeyInpageAdUrl = browser.runtime.getURL(`/misc/ad-banners/tkey-inpage-ad.png`); @@ -16,13 +45,14 @@ const swapTkeyUrl = `${browser.runtime.getURL('fullpage.html')}#/swap?${buildSwa true )}`; -const getAdsStackIframeURL = (id: string, adsMetadataIds: any[], origin: string) => { +const getAdsStackIframeURL = (id: string, adsMetadataIds: any[], origin: string, adCategories: string[]) => { const url = new URL(browser.runtime.getURL('iframes/ads-stack.html')); url.searchParams.set('id', id); adsMetadataIds.forEach(adMetadataId => url.searchParams.append(ADS_META_SEARCH_PARAM_NAME, JSON.stringify(adMetadataId)) ); url.searchParams.set(ORIGIN_SEARCH_PARAM_NAME, origin); + adCategories.forEach(category => url.searchParams.append(AD_CATEGORIES_PARAM_NAME, category)); return url.toString(); }; @@ -61,7 +91,7 @@ const buildNativeAdsMeta = (containerWidth: number, containerHeight: number) => } ].filter(isTruthy); -const bannerAdsMetaBase = [ +const bannerAdsMetaBase: (AdMetadata | false)[] = [ { source: { providerName: 'SmartyAds' as const, @@ -110,6 +140,52 @@ const bannerAdsMetaBase = [ maxContainerHeight: 300 } }, + { + source: { + providerName: 'HypeLab' as const, + native: false, + slug: IS_MISES_BROWSER ? EnvVars.HYPELAB_MISES_WIDE_PLACEMENT_SLUG : EnvVars.HYPELAB_WIDE_PLACEMENT_SLUG + }, + dimensions: { + width: 728, + height: 90, + minContainerWidth: 727, + minContainerHeight: 89, + maxContainerWidth: Infinity, + maxContainerHeight: 300 + } + }, + { + source: { + providerName: 'Persona' as const, + native: false, + slug: IS_MISES_BROWSER ? EnvVars.PERSONA_ADS_MISES_WIDE_BANNER_UNIT_ID : EnvVars.PERSONA_ADS_WIDE_BANNER_UNIT_ID + }, + dimensions: { + width: 728, + height: 90, + minContainerWidth: 727, + minContainerHeight: 89, + maxContainerWidth: Infinity, + maxContainerHeight: 300 + } + }, + { + source: { + providerName: 'Persona' as const, + slug: IS_MISES_BROWSER + ? EnvVars.PERSONA_ADS_MISES_MEDIUM_BANNER_UNIT_ID + : EnvVars.PERSONA_ADS_MEDIUM_BANNER_UNIT_ID + }, + dimensions: { + width: 600, + height: 160, + minContainerWidth: 599, + minContainerHeight: 159, + maxContainerWidth: 800, + maxContainerHeight: 300 + } + }, { source: { providerName: 'SmartyAds' as const, @@ -174,6 +250,37 @@ const bannerAdsMetaBase = [ maxContainerHeight: Infinity } }, + { + source: { + providerName: 'HypeLab' as const, + native: false, + slug: IS_MISES_BROWSER ? EnvVars.HYPELAB_MISES_HIGH_PLACEMENT_SLUG : EnvVars.HYPELAB_HIGH_PLACEMENT_SLUG + }, + dimensions: { + width: 300, + height: 250, + minContainerWidth: 299, + minContainerHeight: 249, + maxContainerWidth: 700, + maxContainerHeight: Infinity + } + }, + { + source: { + providerName: 'Persona' as const, + slug: IS_MISES_BROWSER + ? EnvVars.PERSONA_ADS_MISES_SQUARISH_BANNER_UNIT_ID + : EnvVars.PERSONA_ADS_SQUARISH_BANNER_UNIT_ID + }, + dimensions: { + width: 300, + height: 250, + minContainerWidth: 299, + minContainerHeight: 249, + maxContainerWidth: 700, + maxContainerHeight: Infinity + } + }, { source: { providerName: 'SmartyAds' as const, @@ -207,82 +314,6 @@ const bannerAdsMetaBase = [ maxContainerHeight: 130 } }, - { - source: { - providerName: 'HypeLab' as const, - native: false, - slug: IS_MISES_BROWSER ? EnvVars.HYPELAB_MISES_WIDE_PLACEMENT_SLUG : EnvVars.HYPELAB_WIDE_PLACEMENT_SLUG - }, - dimensions: { - width: 728, - height: 90, - minContainerWidth: 727, - minContainerHeight: 89, - maxContainerWidth: Infinity, - maxContainerHeight: 300 - } - }, - { - source: { - providerName: 'Temple' as const, - slug: '' - }, - dimensions: { - width: 728, - height: 90, - minContainerWidth: 727, - minContainerHeight: 89, - maxContainerWidth: Infinity, - maxContainerHeight: 300 - } - }, - { - source: { - providerName: 'Persona' as const, - slug: IS_MISES_BROWSER - ? EnvVars.PERSONA_ADS_MISES_MEDIUM_BANNER_UNIT_ID - : EnvVars.PERSONA_ADS_MEDIUM_BANNER_UNIT_ID - }, - dimensions: { - width: 600, - height: 160, - minContainerWidth: 599, - minContainerHeight: 159, - maxContainerWidth: 800, - maxContainerHeight: 300 - } - }, - { - source: { - providerName: 'HypeLab' as const, - native: false, - slug: IS_MISES_BROWSER ? EnvVars.HYPELAB_MISES_HIGH_PLACEMENT_SLUG : EnvVars.HYPELAB_HIGH_PLACEMENT_SLUG - }, - dimensions: { - width: 300, - height: 250, - minContainerWidth: 299, - minContainerHeight: 249, - maxContainerWidth: 700, - maxContainerHeight: Infinity - } - }, - { - source: { - providerName: 'Persona' as const, - slug: IS_MISES_BROWSER - ? EnvVars.PERSONA_ADS_MISES_SQUARISH_BANNER_UNIT_ID - : EnvVars.PERSONA_ADS_SQUARISH_BANNER_UNIT_ID - }, - dimensions: { - width: 300, - height: 250, - minContainerWidth: 299, - minContainerHeight: 249, - maxContainerWidth: 700, - maxContainerHeight: 500 - } - }, { source: { providerName: 'HypeLab' as const, @@ -302,7 +333,8 @@ const bannerAdsMetaBase = [ { source: { providerName: 'Persona' as const, - slug: IS_MISES_BROWSER ? EnvVars.PERSONA_ADS_MISES_BANNER_UNIT_ID : EnvVars.PERSONA_ADS_BANNER_UNIT_ID + slug: IS_MISES_BROWSER ? EnvVars.PERSONA_ADS_MISES_BANNER_UNIT_ID : EnvVars.PERSONA_ADS_BANNER_UNIT_ID, + shouldNotUseStrictContainerLimits: true }, dimensions: { width: 321, @@ -330,6 +362,32 @@ const bannerAdsMetaBase = [ } ]; +const bannerAdsMeta = bannerAdsMetaBase.filter(isTruthy); + +const pickNextAdMetadata = ( + allAdsMetadata: AdMetadata[], + currentAdMetadata: AdMetadata | undefined, + validAdsCounter: number, + pageHasPlacesRules: boolean, + adCategories: string[] +) => { + const currentAdMetadataIndex = currentAdMetadata ? allAdsMetadata.indexOf(currentAdMetadata) : -1; + const isPureCryptoAd = adCategories.length === 1 && adCategories[0] === 'crypto'; + + if ( + !currentAdMetadata || + (!pageHasPlacesRules && !isPureCryptoAd && validAdsCounter > 0 && currentAdMetadataIndex > 0) + ) { + return allAdsMetadata[0]; + } + + if (allAdsMetadata.length === 1) { + return undefined; + } + + return allAdsMetadata[(currentAdMetadataIndex + 1) % allAdsMetadata.length]; +}; + export const configureAds = async () => { const { configureAds: originalConfigureAds } = await importExtensionAdsModule(); originalConfigureAds({ @@ -341,9 +399,10 @@ export const configureAds = async () => { personaIframePath: browser.runtime.getURL('iframes/persona-ad.html'), getAdsStackIframeURL, buildNativeAdsMeta, - bannerAdsMeta: bannerAdsMetaBase.filter(isTruthy), + bannerAdsMeta, extVersion: APP_VERSION, templePassphrase: EnvVars.TEMPLE_ADS_ORIGIN_PASSPHRASE, - isMisesBrowser: IS_MISES_BROWSER + isMisesBrowser: IS_MISES_BROWSER, + pickNextAdMetadata }); }; diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 7e6e351341..98b1a03c3d 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -7,6 +7,8 @@ export enum ContentScriptType { ReferralClick = 'ReferralClick' } +export const AD_CATEGORIES_PARAM_NAME = 'categories'; + export const ORIGIN_SEARCH_PARAM_NAME = 'o'; export const ADS_META_SEARCH_PARAM_NAME = 'ads-meta'; diff --git a/yarn.lock b/yarn.lock index bbcc9c93a4..228ef3e79d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3607,10 +3607,10 @@ dependencies: nanoid "^3.1.25" -"@temple-wallet/extension-ads@8.1.1": - version "8.1.1" - resolved "https://registry.yarnpkg.com/@temple-wallet/extension-ads/-/extension-ads-8.1.1.tgz#cfbca4e245096d39ed728133dd569d30253536f7" - integrity sha512-F05VRE7eg9lUnMu/3KvvRg5pOWAAwH7aI+yg61PnfgRA2XkWr7dM+ZdswTbJw+Bq27u3MnjdaSYMB3MIyPhk9g== +"@temple-wallet/extension-ads@9.0.0-dev.2": + version "9.0.0-dev.2" + resolved "https://registry.yarnpkg.com/@temple-wallet/extension-ads/-/extension-ads-9.0.0-dev.2.tgz#9ba67b3cb01368650f591e5893655a3d8bde95af" + integrity sha512-eUxOuIXqIL5OUYQrXGrZa3pgacNxbmrUzLaaGJofZI5wi0VAVJSvjRfPwvE7KwBGoYw7g3sE2/gIraU/qmzYhA== dependencies: axios "^1.7.4" crypto-js "^4.2.0" From 9a82873fa0eb443086d8a5f591f3aa76f1ccc7fb Mon Sep 17 00:00:00 2001 From: Inokentii Mazhara Date: Mon, 7 Oct 2024 03:04:05 +0300 Subject: [PATCH 3/5] TW-1536: Change some labels for staking section (#1203) --- public/_locales/en/messages.json | 2 +- src/app/pages/Staking/MyStake.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 613ff289ec..665974acc1 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -1095,7 +1095,7 @@ "message": "Earn" }, "delegationPointsHead2": { - "message": "on your Tezos annualy from\nBaking & Stake rewards" + "message": "on your Tezos annually from\nBaking & Stake rewards" }, "delegationPoint1": { "message": "First reward in Tezos will be paid approximately in 36 days." diff --git a/src/app/pages/Staking/MyStake.tsx b/src/app/pages/Staking/MyStake.tsx index 592a8f5fbe..b6c730b849 100644 --- a/src/app/pages/Staking/MyStake.tsx +++ b/src/app/pages/Staking/MyStake.tsx @@ -164,7 +164,7 @@ export const MyStakeTab = memo(() => { className="h-10" onClick={finalizeUnstake} > - Unstake + Finalize ) : requestsAreLoading ? ( From 3b0288e1baf8a4ebf355c2baeedbed15b023c5b6 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 10 Oct 2024 11:27:11 +0300 Subject: [PATCH 4/5] Fix pipeline. Cases in imports corrected --- src/app/templates/SettingsGeneral/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/templates/SettingsGeneral/index.tsx b/src/app/templates/SettingsGeneral/index.tsx index 79bc7cbe87..c0501d3181 100644 --- a/src/app/templates/SettingsGeneral/index.tsx +++ b/src/app/templates/SettingsGeneral/index.tsx @@ -2,11 +2,11 @@ import React, { memo } from 'react'; import { NotificationsSettings } from 'lib/notifications/components'; -import AnalyticsSettings from './Components/AnalyticsSettings'; -import FiatCurrencySelect from './Components/FiatCurrencySelect'; -import LocaleSelect from './Components/LocaleSelect'; -import LockUpSettings from './Components/LockUpSettings'; -import PopupSettings from './Components/PopupSettings'; +import AnalyticsSettings from './components/AnalyticsSettings'; +import FiatCurrencySelect from './components/FiatCurrencySelect'; +import LocaleSelect from './components/LocaleSelect'; +import LockUpSettings from './components/LockUpSettings'; +import PopupSettings from './components/PopupSettings'; const GeneralSettings = memo(() => (
From d6f30f8b4cb62bab9832748c791c80acce5d4a5b Mon Sep 17 00:00:00 2001 From: Inokentii Mazhara Date: Fri, 11 Oct 2024 15:57:23 +0300 Subject: [PATCH 5/5] TW-1541: Part of EVM settings (#1208) * TW-1542: Apply design for settings menu (#1199) * TW-1555 Update some design and fix some bugs * TW-1555 Make some modals close after their backdrop is clicked * TW-1542 Resolve merge conflicts * TW-1542 Revert harmful changes * TW-1542 Remove unused components * TW-1542 Implement new Settings menu design * TW-1542 Remove some unused translations * TW-1542 Fix find-deadcode errors * TW-1542 Add changes from comments * TW-1542 Move localStorage clearing to frontend * TW-1542 Update a label * TW-1555 Some more bugfixes * TW-1555 Remove some commented out code * TW-1555 Refactor setting classes Co-authored-by: Alex * TW-1555 Fix prettier problem * TW-1555 Agree styles for app content wrapper and action modals * TW-1542 Change a label * TW-1542 Fix font size for page header --------- Co-authored-by: Alex * TW-1543: 'General' section update (#1200) * TW-1555 Update some design and fix some bugs * TW-1555 Make some modals close after their backdrop is clicked * TW-1542 Resolve merge conflicts * TW-1542 Revert harmful changes * TW-1542 Remove unused components * TW-1542 Implement new Settings menu design * TW-1542 Remove some unused translations * TW-1542 Fix find-deadcode errors * TW-1542 Add changes from comments * TW-1543 Redesign 'General' settings section * TW-1543 Refactoring * TW-1542 Move localStorage clearing to frontend * TW-1542 Update a label * TW-1555 Some more bugfixes * TW-1543 Change error output * TW-1543 Apply design updates * TW-1555 Remove some commented out code * TW-1543 Remove excessive locales loading checks * TW-1555 Refactor setting classes Co-authored-by: Alex * TW-1555 Fix prettier problem * TW-1555 Agree styles for app content wrapper and action modals * TW-1543 Bugfixes according to the comment from Figma * TW-1542 Change a label * TW-1542 Fix font size for page header * TW-1543 Remove an unused import --------- Co-authored-by: Alex * TW-1548: Redesign 'Advanced Features' section (#1205) * TW-1548 Redesign 'Advanced Features' section * TW-1548 Some refactoring * TW-1548 Remove old EnablingSetting component * TW-1548 Remove unused exports * TW-1548 Refactoring according to comments * TW-1541 Fix ts error --------- Co-authored-by: Alex --- e2e/src/page-objects/index.ts | 2 - .../page-objects/pages/reveal-secrets.page.ts | 16 - public/_locales/de/messages.json | 31 +- public/_locales/en/messages.json | 193 ++++++++--- public/_locales/en_GB/messages.json | 32 +- public/_locales/fr/messages.json | 28 +- public/_locales/ja/messages.json | 28 +- public/_locales/ko/messages.json | 28 +- public/_locales/pt/messages.json | 31 +- public/_locales/ru/messages.json | 3 - public/_locales/tr/messages.json | 31 +- public/_locales/uk/messages.json | 132 +++++-- public/_locales/zh_CN/messages.json | 25 +- public/_locales/zh_TW/messages.json | 28 +- public/misc/country-flags/cn.png | Bin 0 -> 778 bytes public/misc/country-flags/cn.svg | 11 - public/misc/country-flags/de.png | Bin 0 -> 363 bytes public/misc/country-flags/de.svg | 5 - public/misc/country-flags/fr.png | Bin 0 -> 506 bytes public/misc/country-flags/fr.svg | 5 - public/misc/country-flags/gb.png | Bin 0 -> 1021 bytes public/misc/country-flags/gb.svg | 10 - public/misc/country-flags/jp.png | Bin 0 -> 437 bytes public/misc/country-flags/jp.svg | 4 - public/misc/country-flags/kr.png | Bin 0 -> 1029 bytes public/misc/country-flags/kr.svg | 16 - public/misc/country-flags/pt.png | Bin 0 -> 1413 bytes public/misc/country-flags/pt.svg | 64 ---- public/misc/country-flags/ru.svg | 5 - public/misc/country-flags/tr.png | Bin 0 -> 667 bytes public/misc/country-flags/tr.svg | 6 - public/misc/country-flags/tw.png | Bin 0 -> 795 bytes public/misc/country-flags/tw.svg | 9 - public/misc/country-flags/ua.png | Bin 0 -> 407 bytes public/misc/country-flags/ua.svg | 4 - public/misc/country-flags/us.png | Bin 0 -> 809 bytes public/misc/country-flags/us.svg | 25 -- src/app/atoms/BakingButtons/index.tsx | 3 +- src/app/atoms/Flag.tsx | 15 +- src/app/atoms/FormCheckbox.tsx | 2 +- .../SettingsCell.tsx} | 19 +- src/app/atoms/SettingsCellGroup.tsx | 20 ++ src/app/atoms/action-modal/action-modal.tsx | 8 +- src/app/atoms/index.ts | 1 - src/app/icons/additional.svg | 6 - src/app/icons/apps.svg | 15 - src/app/icons/base/additional.svg | 6 + src/app/icons/base/addressbook.svg | 6 + src/app/icons/base/browse.svg | 4 +- src/app/icons/base/exit.svg | 7 + src/app/icons/base/info.svg | 6 + src/app/icons/base/link.svg | 6 + src/app/icons/base/refresh.svg | 6 + src/app/icons/canny.svg | 19 - src/app/icons/helpcrunch.svg | 17 - src/app/icons/monochrome/extension.svg | 8 - src/app/icons/monochrome/help.svg | 10 - src/app/icons/monochrome/key.svg | 9 - src/app/icons/monochrome/people.svg | 8 - src/app/icons/monochrome/sticker.svg | 9 - src/app/icons/monochrome/sync.svg | 10 - src/app/layouts/Dialogs.tsx | 12 +- src/app/layouts/PageLayout/DefaultHeader.tsx | 4 +- src/app/pages/AccountSettings/index.tsx | 72 ++-- .../Tokens/components/TokenTag/ScamTag.tsx | 3 +- src/app/pages/Settings/Settings.selectors.ts | 7 +- src/app/pages/Settings/Settings.tsx | 325 ++++++++---------- .../pages/Settings/reset-extension-modal.tsx | 88 +++++ .../account-already-exists-warning.tsx | 10 +- src/app/templates/AdvancedFeatures/index.tsx | 2 +- .../partners-promotion-settings.tsx | 69 ++-- .../referral-links-settings.tsx | 10 +- .../templates/AdvancedFeatures/selectors.ts | 3 +- src/app/templates/AlertModal.tsx | 42 ++- .../ConfirmationModal/ConfirmationModal.tsx | 79 +++-- .../templates/DAppSettings/DAppSettings.tsx | 2 +- src/app/templates/DialogBody.tsx | 14 + src/app/templates/EnablingSetting.tsx | 44 --- .../HelpAndCommunity/ResourceLink.tsx | 32 -- src/app/templates/HelpAndCommunity/index.tsx | 99 ------ .../templates/HelpAndCommunity/selectors.ts | 5 - src/app/templates/ModalWithTitle.tsx | 2 +- .../RevealSecrets/PasswordForRevealField.tsx | 73 ---- .../RevealSecrets/RevealPrivateKeys.tsx | 120 ------- .../RevealSecrets/RevealSecrets.selectors.ts | 6 - .../RevealSecrets/RevealSeedPhrase.tsx | 71 ---- .../templates/RevealSecrets/SecretField.tsx | 67 ---- src/app/templates/RevealSecrets/index.ts | 2 - .../Components/AnalyticsSettings.tsx | 28 -- .../Components/FiatCurrencySelect.tsx | 123 ------- .../Components/LocaleSelect.tsx | 205 ----------- .../Components/LockUpSettings.tsx | 22 -- .../Components/PopupSettings.tsx | 38 -- .../fiat-currency-select/currency-icon.tsx | 11 + .../components/fiat-currency-select/index.tsx | 71 ++++ .../components/locale-select/index.tsx | 56 +++ .../components/locale-select/locale-icon.tsx | 13 + .../components/locale-select/options.ts | 63 ++++ .../components/notifications-settings.tsx | 30 ++ .../components/popup-settings.tsx | 31 ++ .../components/select-with-modal/index.tsx | 71 ++++ .../select-with-modal/select-modal-option.tsx | 48 +++ .../select-with-modal/select-modal.tsx | 74 ++++ src/app/templates/SettingsGeneral/index.tsx | 17 +- .../templates/SettingsGeneral/selectors.ts | 3 +- src/app/templates/enabling-setting.tsx | 31 ++ src/lib/fiat-currency/consts.ts | 27 +- src/lib/fiat-currency/core.ts | 10 +- src/lib/fiat-currency/index.ts | 4 +- src/lib/fiat-currency/types.ts | 7 +- src/lib/i18n/cldrjs-locales.json | 227 ------------ src/lib/i18n/core.ts | 5 +- src/lib/i18n/index.ts | 2 +- src/lib/i18n/react.tsx | 2 +- src/lib/lock-up/index.ts | 2 + src/lib/notifications/components/index.ts | 1 - src/lib/notifications/components/settings.tsx | 26 -- src/lib/temple/back/actions.ts | 4 + src/lib/temple/back/main.ts | 6 + src/lib/temple/back/vault/index.ts | 6 + src/lib/temple/back/vault/vault.test.ts | 18 + src/lib/temple/front/client.ts | 14 +- src/lib/temple/types.ts | 19 +- src/lib/types.d.ts | 2 + src/lib/ui/dialog.tsx | 2 +- src/lib/ui/utils.ts | 9 - src/temple/front/index.ts | 1 - src/temple/front/ready/index.ts | 2 - src/temple/networks.ts | 11 - yarn.lock | 22 +- 130 files changed, 1349 insertions(+), 2270 deletions(-) delete mode 100644 e2e/src/page-objects/pages/reveal-secrets.page.ts create mode 100644 public/misc/country-flags/cn.png delete mode 100644 public/misc/country-flags/cn.svg create mode 100644 public/misc/country-flags/de.png delete mode 100644 public/misc/country-flags/de.svg create mode 100644 public/misc/country-flags/fr.png delete mode 100644 public/misc/country-flags/fr.svg create mode 100644 public/misc/country-flags/gb.png delete mode 100644 public/misc/country-flags/gb.svg create mode 100644 public/misc/country-flags/jp.png delete mode 100644 public/misc/country-flags/jp.svg create mode 100644 public/misc/country-flags/kr.png delete mode 100644 public/misc/country-flags/kr.svg create mode 100644 public/misc/country-flags/pt.png delete mode 100644 public/misc/country-flags/pt.svg delete mode 100644 public/misc/country-flags/ru.svg create mode 100644 public/misc/country-flags/tr.png delete mode 100644 public/misc/country-flags/tr.svg create mode 100644 public/misc/country-flags/tw.png delete mode 100644 public/misc/country-flags/tw.svg create mode 100644 public/misc/country-flags/ua.png delete mode 100644 public/misc/country-flags/ua.svg create mode 100644 public/misc/country-flags/us.png delete mode 100644 public/misc/country-flags/us.svg rename src/app/{pages/AccountSettings/settings-cell.tsx => atoms/SettingsCell.tsx} (67%) create mode 100644 src/app/atoms/SettingsCellGroup.tsx delete mode 100644 src/app/icons/additional.svg delete mode 100644 src/app/icons/apps.svg create mode 100644 src/app/icons/base/additional.svg create mode 100644 src/app/icons/base/addressbook.svg create mode 100644 src/app/icons/base/exit.svg create mode 100644 src/app/icons/base/info.svg create mode 100644 src/app/icons/base/link.svg create mode 100644 src/app/icons/base/refresh.svg delete mode 100644 src/app/icons/canny.svg delete mode 100644 src/app/icons/helpcrunch.svg delete mode 100644 src/app/icons/monochrome/extension.svg delete mode 100644 src/app/icons/monochrome/help.svg delete mode 100644 src/app/icons/monochrome/key.svg delete mode 100644 src/app/icons/monochrome/people.svg delete mode 100644 src/app/icons/monochrome/sticker.svg delete mode 100644 src/app/icons/monochrome/sync.svg create mode 100644 src/app/pages/Settings/reset-extension-modal.tsx create mode 100644 src/app/templates/DialogBody.tsx delete mode 100644 src/app/templates/EnablingSetting.tsx delete mode 100644 src/app/templates/HelpAndCommunity/ResourceLink.tsx delete mode 100644 src/app/templates/HelpAndCommunity/index.tsx delete mode 100644 src/app/templates/HelpAndCommunity/selectors.ts delete mode 100644 src/app/templates/RevealSecrets/PasswordForRevealField.tsx delete mode 100644 src/app/templates/RevealSecrets/RevealPrivateKeys.tsx delete mode 100644 src/app/templates/RevealSecrets/RevealSecrets.selectors.ts delete mode 100644 src/app/templates/RevealSecrets/RevealSeedPhrase.tsx delete mode 100644 src/app/templates/RevealSecrets/SecretField.tsx delete mode 100644 src/app/templates/RevealSecrets/index.ts delete mode 100644 src/app/templates/SettingsGeneral/Components/AnalyticsSettings.tsx delete mode 100644 src/app/templates/SettingsGeneral/Components/FiatCurrencySelect.tsx delete mode 100644 src/app/templates/SettingsGeneral/Components/LocaleSelect.tsx delete mode 100644 src/app/templates/SettingsGeneral/Components/LockUpSettings.tsx delete mode 100644 src/app/templates/SettingsGeneral/Components/PopupSettings.tsx create mode 100644 src/app/templates/SettingsGeneral/components/fiat-currency-select/currency-icon.tsx create mode 100644 src/app/templates/SettingsGeneral/components/fiat-currency-select/index.tsx create mode 100644 src/app/templates/SettingsGeneral/components/locale-select/index.tsx create mode 100644 src/app/templates/SettingsGeneral/components/locale-select/locale-icon.tsx create mode 100644 src/app/templates/SettingsGeneral/components/locale-select/options.ts create mode 100644 src/app/templates/SettingsGeneral/components/notifications-settings.tsx create mode 100644 src/app/templates/SettingsGeneral/components/popup-settings.tsx create mode 100644 src/app/templates/SettingsGeneral/components/select-with-modal/index.tsx create mode 100644 src/app/templates/SettingsGeneral/components/select-with-modal/select-modal-option.tsx create mode 100644 src/app/templates/SettingsGeneral/components/select-with-modal/select-modal.tsx create mode 100644 src/app/templates/enabling-setting.tsx delete mode 100644 src/lib/notifications/components/settings.tsx diff --git a/e2e/src/page-objects/index.ts b/e2e/src/page-objects/index.ts index 874df24101..17c6913b1d 100644 --- a/e2e/src/page-objects/index.ts +++ b/e2e/src/page-objects/index.ts @@ -18,7 +18,6 @@ import { InternalConfirmationPage } from './pages/internal-confirmation.page'; import { ManualBackupModalPage } from './pages/modal/manual-backup-modal.page'; import { NewsletterModalPage } from './pages/modal/newsletter-modal.page'; import { OnRumModalPage } from './pages/modal/on-rum-modal.page'; -import { RevealSecretsPage } from './pages/reveal-secrets.page'; import { SendPage } from './pages/send.page'; import { SettingsPage } from './pages/settings.page'; import { setWalletPage } from './pages/setWalletPassword.page'; @@ -30,7 +29,6 @@ export const Pages = { ImportExistingWallet: new ImportExistingWalletPage(), SetWallet: new setWalletPage(), Settings: new SettingsPage(), - RevealSecrets: new RevealSecretsPage(), UnlockScreen: new UnlockScreenPage(), DelegateTab: new DelegateTab(), DelegateForm: new DelegateFormPage(), diff --git a/e2e/src/page-objects/pages/reveal-secrets.page.ts b/e2e/src/page-objects/pages/reveal-secrets.page.ts deleted file mode 100644 index addfabbe1f..0000000000 --- a/e2e/src/page-objects/pages/reveal-secrets.page.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { RevealSecretsSelectors } from 'src/app/templates/RevealSecrets/RevealSecrets.selectors'; - -import { Page } from '../../classes/page.class'; -import { createPageElement } from '../../utils/search.utils'; - -export class RevealSecretsPage extends Page { - revealButton = createPageElement(RevealSecretsSelectors.RevealButton); - revealPasswordField = createPageElement(RevealSecretsSelectors.RevealPasswordInput); - revealSecretsProtectedMask = createPageElement(RevealSecretsSelectors.RevealSecretsProtectedMask); - revealSecretsValue = createPageElement(RevealSecretsSelectors.RevealSecretsValue); - - async isVisible() { - await this.revealButton.waitForDisplayed(); - await this.revealPasswordField.waitForDisplayed(); - } -} diff --git a/public/_locales/de/messages.json b/public/_locales/de/messages.json index aa432b03de..967b3ed120 100644 --- a/public/_locales/de/messages.json +++ b/public/_locales/de/messages.json @@ -34,10 +34,6 @@ } } }, - "authorizedDApps": { - "message": "Autorisierte DApps", - "description": "DApps = Decentralized Applications" - }, "clickIconToResetPermissions": { "message": "Klicken Sie auf das X-Symbol, um die Berechtigungen zurückzusetzen." }, @@ -647,38 +643,19 @@ "revealPrivateKey": { "message": "Privaten Schlüssel freigeben" }, - "revealPrivateKeyDescription": { - "message": "Auch bekannt als „Exportkonto“, zeigt den privaten Schlüssel für Ihr ausgewähltes Konto an." - }, "revealSeedPhrase": { "message": "Seed-Phrase freigeben" }, - "revealSeedPhraseDescription": { - "message": "Auch als \"Export-Wallet\" bekannt, Sie benötigen diese Seed-Phrase möglicherweise, um auf Ihre Wallet und Konten auf anderen Geräten zuzugreifen." - }, "dApps": { "message": "DApps", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "In diesem Abschnitt können Sie die Möglichkeit zur Interaktion mit dezentralen Anwendungen aktivieren, die Temple Wallet unterstützen." - }, - "networksDescription": { - "message": "In diesem Abschnitt können Sie benutzerdefinierte Tezos-Netzwerke hinzufügen oder löschen.", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "Konto entfernen" }, "removeAccountDescription": { "message": "Verwenden Sie diesen Abschnitt, um Ihr ausgewähltes Konto zu entfernen. Nur importierte Konten können entfernt werden." }, - "about": { - "message": "Über" - }, - "aboutDescription": { - "message": "Verwenden Sie diesen Abschnitt, um Metainformationen zu Temple Wallet anzuzeigen." - }, "unlockWallet": { "message": "Die Wallet entsperren" }, @@ -1268,15 +1245,12 @@ "upload": { "message": "Hochladen" }, - "languageAndCountry": { + "language": { "message": "Sprache" }, "generalSettings": { "message": "Allgemein" }, - "generalSettingsDescription": { - "message": "Hier können Sie die Spracheinstellungen und den Anzeigemodus verwalten." - }, "swapNoun": { "message": "Wechseln" }, @@ -1895,9 +1869,6 @@ "addressBook": { "message": "Adressbuch" }, - "addressBookDescription": { - "message": "Fügen Sie Ihre Kontakte hinzu, entfernen und verwalten Sie sie." - }, "addNewContact": { "message": "Neuer Kontakt" }, diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index e21c90f0b0..924d228613 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -51,15 +51,9 @@ } } }, - "authorizedDApps": { - "message": "Authorized DApps", - "description": "DApps = Decentralized Applications" - }, - "advancedFeatures": { - "message": "Advanced Features" - }, - "advancedFeaturesDescription": { - "message": "In this section you can customize additional Temple extension features" + "connectedDApps": { + "message": "Connected Dapps", + "description": "Dapps = Decentralized Applications" }, "clickIconToResetPermissions": { "message": "Click on the X icon to reset permissions." @@ -699,6 +693,18 @@ "resetExtension": { "message": "Reset Extension" }, + "resetExtensionModalTitle": { + "message": "Reset Extension?" + }, + "resetExtensionModalDescription": { + "message": "Resetting will delete wallets, accounts and erase all data. Ensure your Seed Phrases and Private Keys are backed up to avoid permanent loss and recover access to assets later." + }, + "resetPasswordInputLabel": { + "message": "Enter the password to confirm reset" + }, + "reset": { + "message": "Reset" + }, "resetExtensionConfirmation": { "message": "Are you sure you want to reset the Temple Wallet?\nAs a result, all your data will be deleted." }, @@ -944,29 +950,16 @@ "revealPrivateKey": { "message": "Reveal Private Key" }, - "revealPrivateKeyDescription": { - "message": "Also known as \"Export Account\", reveals private key for your selected account." - }, "revealPrivateKeyPasswordLabel": { "message": "Enter your password to reveal private key" }, "revealSeedPhrase": { "message": "Reveal Seed Phrase" }, - "revealSeedPhraseDescription": { - "message": "Also known as \"Export Wallet\", you may need this seed phrase to access your wallet and accounts on other devices." - }, "dApps": { "message": "DApps", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "In this section you can enable ability to interact with decentralized applications that support Temple Wallet." - }, - "networksDescription": { - "message": "In this section you can add or delete custom Tezos networks.", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "Remove Account" }, @@ -976,8 +969,8 @@ "accountsManagement": { "message": "Accounts management" }, - "accountsManagementDescription": { - "message": "Use this section to create, edit, and delete accounts." + "securityAndPrivacy": { + "message": "Security & Privacy" }, "editAccount": { "message": "Edit Account" @@ -1022,15 +1015,15 @@ "selectNetworkToReveal": { "message": "Select Network to reveal" }, - "about": { - "message": "About" + "advancedFeatures": { + "message": "Advanced Features" + }, + "aboutAndSupport": { + "message": "About & Support" }, "info": { "message": "Info" }, - "aboutDescription": { - "message": "Use this section to view meta info about Temple Wallet." - }, "unlockWallet": { "message": "Unlock the Wallet" }, @@ -1802,7 +1795,7 @@ "upload": { "message": "Upload" }, - "languageAndCountry": { + "language": { "message": "Language" }, "fiatCurrency": { @@ -1811,9 +1804,6 @@ "generalSettings": { "message": "General" }, - "generalSettingsDescription": { - "message": "Here you can manage languages preferences and display mode." - }, "swapNoun": { "message": "Swap" }, @@ -1989,10 +1979,10 @@ } }, "popupSettings": { - "message": "Popup mode" + "message": "Pop-up Mode" }, "popupSettingsDescription": { - "message": "Here you can configure the popup which appears on plugin's icon click in extensions panel." + "message": "Here you can configure the pop-up which appears on plugin's icon click in extensions panel." }, "analyticsSettings": { "message": "Anonymous Analytics" @@ -2156,8 +2146,14 @@ "actionConfirmation": { "message": "Confirm the action" }, - "closePartnersPromotion": { - "message": "Are you sure you want to disable all ads?" + "adsEnabledAlertTitle": { + "message": "Earn TKEY & Support Temple" + }, + "adsEnabledAlertDescription": { + "message": "Congrats, you've started earning TKEY tokens!\nBy enabling this feature, you agreed to share your Wallet address and IP to receive tokens and view ads. You can turn ads off or on anytime in the settings." + }, + "disableAdsModalTitle": { + "message": "Disable advertising?" }, "hideAd": { "message": "Hide Ad" @@ -2584,9 +2580,6 @@ "addressBook": { "message": "Address Book" }, - "addressBookDescription": { - "message": "Add, remove and manage your contacts." - }, "addNewContact": { "message": "New contact" }, @@ -2608,8 +2601,8 @@ "deleteContactConfirm": { "message": "Are you sure you want to delete this contact?" }, - "closePartnersPromoConfirm": { - "message": "Pay attention: you can receive rewards in TKEY tokens for viewing ads in our wallet. If you disabled Ads, you can always activate it in the settings." + "disableAdsModalDescription": { + "message": "Did you know, you can earn TKEY tokens by viewing ads? If ads are turned off, you can easily enable them anytime in the settings and start earning rewards!" }, "enablePartnersPromotionConfirm": { "message": "Support the development team and earn TKEY tokens by viewing ads." @@ -2816,12 +2809,7 @@ "description": "Part of partnersPromoDescription phrase" }, "partnersPromoDescription": { - "message": "Here you can configure displaying of ads in Temple wallet. Remember, you get $rewards$ at TKEY tokens for viewing ads.", - "placeholders": { - "rewards": { - "content": "$1" - } - } + "message": "Here you can configure displaying ads in Temple Wallet and getting reward in TKEY tokens. By enabling this, you agree to share your wallet address and IP to receive tokens and view ads." }, "referralLinks": { "message": "Referral Links" @@ -3202,11 +3190,8 @@ "sync": { "message": "Sync" }, - "synchronization": { - "message": "Synchronization" - }, - "synchronizationSettingsDescription": { - "message": "Sync with Mobile Temple Wallet." + "templeSync": { + "message": "Temple Sync" }, "syncSettingsTitle": { "message": "Sync with Mobile Temple Wallet" @@ -3476,5 +3461,107 @@ }, "allNetworks": { "message": "All Networks" + }, + "enLangName": { + "message": "English" + }, + "en_GBLangName": { + "message": "English ‒ United Kingdom" + }, + "frLangName": { + "message": "French" + }, + "deLangName": { + "message": "German" + }, + "zh_CNLangName": { + "message": "Chinese ‒ Simplified" + }, + "zh_TWLangName": { + "message": "Chinese ‒ Traditional" + }, + "jaLangName": { + "message": "Japanese" + }, + "koLangName": { + "message": "Korean" + }, + "ukLangName": { + "message": "Ukrainian" + }, + "trLangName": { + "message": "Turkish" + }, + "ptLangName": { + "message": "Portuguese" + }, + "usdName": { + "message": "United States Dollar" + }, + "eurName": { + "message": "Euro" + }, + "gbpName": { + "message": "British Pound" + }, + "jpyName": { + "message": "Japanese Yen" + }, + "audName": { + "message": "Australian Dollar" + }, + "cadName": { + "message": "Canadian Dollar" + }, + "chfName": { + "message": "Swiss Franc" + }, + "cnyName": { + "message": "Chinese Yuan" + }, + "dkkName": { + "message": "Danish Krone" + }, + "hkdName": { + "message": "Hong Kong Dollar" + }, + "idrName": { + "message": "Indonesian Rupiah" + }, + "inrName": { + "message": "Indian Rupee" + }, + "krwName": { + "message": "South Korean Won" + }, + "mxnName": { + "message": "Mexican Peso" + }, + "nzdName": { + "message": "New Zealand Dollar" + }, + "plnName": { + "message": "Polish Zloty" + }, + "sekName": { + "message": "Swedish Krona" + }, + "sgdName": { + "message": "Singapore Dollar" + }, + "thbName": { + "message": "Thai Baht" + }, + "tryName": { + "message": "Turkish Lira" + }, + "twdName": { + "message": "Taiwan Dollar" + }, + "uahName": { + "message": "Ukrainian Hryvnia" + }, + "zarName": { + "message": "South African Rand" } } diff --git a/public/_locales/en_GB/messages.json b/public/_locales/en_GB/messages.json index 2cdca72869..2f3485445c 100644 --- a/public/_locales/en_GB/messages.json +++ b/public/_locales/en_GB/messages.json @@ -34,10 +34,6 @@ } } }, - "authorizedDApps": { - "message": "Authorized DApps", - "description": "DApps = Decentralized Applications" - }, "clickIconToResetPermissions": { "message": "Click on the X icon to reset permissions." }, @@ -638,38 +634,19 @@ "revealPrivateKey": { "message": "Reveal Private Key" }, - "revealPrivateKeyDescription": { - "message": "Also known as \"Export Account\", reveals private key for your selected account." - }, "revealSeedPhrase": { "message": "Reveal Seed Phrase" }, - "revealSeedPhraseDescription": { - "message": "Also known as \"Export Wallet\", you may need this seed phrase to access your wallet and accounts on other devices." - }, "dApps": { "message": "DApps", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "In this section you can enable ability to interact with decentralized applications that support Temple Wallet." - }, - "networksDescription": { - "message": "In this section you can add or delete custom Tezos networks.", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "Remove Account" }, "removeAccountDescription": { "message": "Use this section to remove your selected account. Only imported accounts can be removed." }, - "about": { - "message": "About" - }, - "aboutDescription": { - "message": "Use this section to view meta info about Temple Wallet." - }, "unlockWallet": { "message": "Unlock the Wallet" }, @@ -1238,15 +1215,12 @@ "upload": { "message": "Upload" }, - "languageAndCountry": { + "language": { "message": "Language" }, "generalSettings": { "message": "General" }, - "generalSettingsDescription": { - "message": "Here you can manage languages preferences and display mode." - }, "swapNoun": { "message": "Swap" }, @@ -1381,10 +1355,10 @@ } }, "popupSettings": { - "message": "Popup mode" + "message": "Pop-up Mode" }, "popupSettingsDescription": { - "message": "Here you can configure the popup which appears on plugin's icon click in extensions panel." + "message": "Here you can configure the pop-up which appears on plugin's icon click in extensions panel." }, "referredByTokenContractNotFound": { "message": "Contract $address$, which is referred by token contract to, was not found.", diff --git a/public/_locales/fr/messages.json b/public/_locales/fr/messages.json index 8ab824f0dc..af5ab7754b 100644 --- a/public/_locales/fr/messages.json +++ b/public/_locales/fr/messages.json @@ -31,10 +31,6 @@ } } }, - "authorizedDApps": { - "message": "Applications décentralisées autorisées", - "description": "DApps = Decentralized Applications" - }, "clickIconToResetPermissions": { "message": "Cliquez sur l'icône X pour réinitialiser les permissions." }, @@ -607,38 +603,19 @@ "revealPrivateKey": { "message": "Révéler la clé privée" }, - "revealPrivateKeyDescription": { - "message": "Connu aussi comme « Exporter le compte », révèle la clé privée pour votre compte sélectionné." - }, "revealSeedPhrase": { "message": "Révéler la phrase mnémonique" }, - "revealSeedPhraseDescription": { - "message": "Connu aussi comme « Exporter le compte », vous pourriez avoir besoin de cette phrase mnémonique pour accéder à votre portefeuille et vos comptes sur d'autres appareils." - }, "dApps": { "message": "Applications décentralisées", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "Dans cette section, vous pouvez activer la possibilité d'interagir avec les applications décentralisées qui prennent en charge le portefeuille Temple." - }, - "networksDescription": { - "message": "Dans cette section, vous pouvez ajouter ou supprimer des réseaux Tezos personnalisés.", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "Retirer le compte" }, "removeAccountDescription": { "message": "Utilisez cette section pour retirer votre compte sélectionné. Seuls les comptes importés peuvent être retirés." }, - "about": { - "message": "À propos" - }, - "aboutDescription": { - "message": "Utilisez cette section pour afficher les méta-informations concernant le portefeuille Temple." - }, "unlockWallet": { "message": "Déverrouiller le portefeuille" }, @@ -1201,15 +1178,12 @@ "upload": { "message": "Téléverser" }, - "languageAndCountry": { + "language": { "message": "Langue" }, "generalSettings": { "message": "Général" }, - "generalSettingsDescription": { - "message": "Vous pouvez gérer ici les préférences de langue et le mode d'affichage." - }, "swapNoun": { "message": "Échanger" }, diff --git a/public/_locales/ja/messages.json b/public/_locales/ja/messages.json index 284d8bc03b..f8a2a1621a 100644 --- a/public/_locales/ja/messages.json +++ b/public/_locales/ja/messages.json @@ -31,10 +31,6 @@ } } }, - "authorizedDApps": { - "message": "認証済みDApps", - "description": "DApps = Decentralized Applications" - }, "clickIconToResetPermissions": { "message": "Xアイコンをクリックして権限をリセットします。" }, @@ -607,38 +603,19 @@ "revealPrivateKey": { "message": "秘密鍵を表示" }, - "revealPrivateKeyDescription": { - "message": "「アカウントのエクスポート」としても知られ、選択したアカウントの秘密鍵を表示します。" - }, "revealSeedPhrase": { "message": "シードフレーズを表示" }, - "revealSeedPhraseDescription": { - "message": "「ウォレットのエクスポート」としても知られ、他のデバイスでウォレットやアカウントにアクセスするには、このシードフレーズが必要な場合があります。" - }, "dApps": { "message": "DApps", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "このセクションでは、テンプルウォレットをサポートする分散型アプリケーションとのインタラクションを有効にすることができます。" - }, - "networksDescription": { - "message": "このセクションでは、カスタムテゾスネットワークの追加や削除を行うことができます。", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "アカウントを削除" }, "removeAccountDescription": { "message": "このセクションを使用して、選択したアカウントを削除します。インポートしたアカウントのみ削除することができます。" }, - "about": { - "message": "概要" - }, - "aboutDescription": { - "message": "テンプルウォレットのメタ情報を表示するには、このセクションを使用します。" - }, "unlockWallet": { "message": "ウォレットをアンロック" }, @@ -1192,15 +1169,12 @@ "upload": { "message": "アップロード" }, - "languageAndCountry": { + "language": { "message": "言語" }, "generalSettings": { "message": "一般" }, - "generalSettingsDescription": { - "message": "ここでは、言語設定や表示モードを管理することができます。" - }, "swapNoun": { "message": "スワップ" }, diff --git a/public/_locales/ko/messages.json b/public/_locales/ko/messages.json index 73841bd053..5dbc69139a 100644 --- a/public/_locales/ko/messages.json +++ b/public/_locales/ko/messages.json @@ -31,10 +31,6 @@ } } }, - "authorizedDApps": { - "message": "인증된 분산 앱", - "description": "DApps = Decentralized Applications" - }, "clickIconToResetPermissions": { "message": "X 아이콘을 클릭하여 접근 권한을 초기화하세요." }, @@ -607,38 +603,19 @@ "revealPrivateKey": { "message": "비공개 키 공개" }, - "revealPrivateKeyDescription": { - "message": "\"계정 내보내기\"라고도 하는데, 선택한 계정의 비공개 키가 공개됩니다" - }, "revealSeedPhrase": { "message": "비밀 문구 공개" }, - "revealSeedPhraseDescription": { - "message": "\"지갑 내보내기\"라고도 하는데, 다른 기기에서 지갑 및 계정에 액세스 하려면 이 비밀 문구가 있어야 합니다." - }, "dApps": { "message": "분산 앱", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "이 섹션에서 타노스 지갑을 지원하는 분산 애플리케이션과 상호 소통하는 기능을 활성화할 수 있습니다." - }, - "networksDescription": { - "message": "이 섹션에서 맞춤형 테조스 네트워크를 추가하거나 삭제할 수 있습니다.", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "계정 제거" }, "removeAccountDescription": { "message": "이 섹션을 활용하여 선택한 계정을 제거하세요. 불러온 계정만 제거할 수 있습니다." }, - "about": { - "message": "정보" - }, - "aboutDescription": { - "message": "이 섹션을 활용하여 타노스 지갑에 관한 메타 징보를 확인하세요." - }, "unlockWallet": { "message": "지갑 잠금 해제" }, @@ -1192,15 +1169,12 @@ "upload": { "message": "업로드" }, - "languageAndCountry": { + "language": { "message": "언어" }, "generalSettings": { "message": "일반" }, - "generalSettingsDescription": { - "message": "여기에서 선호하는 언어와 디스플레이 모드를 관리할 수 있습니다." - }, "swapNoun": { "message": "스왑" }, diff --git a/public/_locales/pt/messages.json b/public/_locales/pt/messages.json index bec84ecd1f..d2ab4f47bd 100644 --- a/public/_locales/pt/messages.json +++ b/public/_locales/pt/messages.json @@ -34,10 +34,6 @@ } } }, - "authorizedDApps": { - "message": "DApps autorizados", - "description": "DApps = Decentralized Applications" - }, "clickIconToResetPermissions": { "message": "Clique no ícone X para repor as permissões." }, @@ -643,38 +639,19 @@ "revealPrivateKey": { "message": "Revelar chave privada" }, - "revealPrivateKeyDescription": { - "message": "Também conhecida como \"Exportar conta\", revela a chave privada da sua conta selecionada." - }, "revealSeedPhrase": { "message": "Revelar frase semente" }, - "revealSeedPhraseDescription": { - "message": "Também conhecida como \"Exportar carteira\", pode precisar desta frase semente para aceder à sua carteira e às suas contas noutros dispositivos." - }, "dApps": { "message": "DApps", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "Nesta secção pode ativar a capacidade de interagir com aplicações descentralizadas que suportam a Carteira Temple." - }, - "networksDescription": { - "message": "Nesta secção pode adicionar ou apagar redes Tezos personalizadas.", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "Remover conta" }, "removeAccountDescription": { "message": "Utilize esta secção para remover a sua conta selecionada. Apenas as contas importadas podem ser removidas." }, - "about": { - "message": "Sobre" - }, - "aboutDescription": { - "message": "Utilize esta secção para ver meta informações sobre a Carteira Temple." - }, "unlockWallet": { "message": "Desbloquear a Carteira" }, @@ -1264,15 +1241,12 @@ "upload": { "message": "Carregar" }, - "languageAndCountry": { + "language": { "message": "Idioma" }, "generalSettings": { "message": "Geral" }, - "generalSettingsDescription": { - "message": "Aqui pode gerir as preferências de idioma e o modo de visualização." - }, "swapNoun": { "message": "Trocar" }, @@ -1891,9 +1865,6 @@ "addressBook": { "message": "Livro de endereços" }, - "addressBookDescription": { - "message": "Adicione, remova e gira os seus contactos." - }, "addNewContact": { "message": "Novo contacto" }, diff --git a/public/_locales/ru/messages.json b/public/_locales/ru/messages.json index 95269de662..febb850092 100644 --- a/public/_locales/ru/messages.json +++ b/public/_locales/ru/messages.json @@ -17,9 +17,6 @@ "maximiseView": { "message": "Maximise view" }, - "authorizedDApps": { - "message": "Authorized DApps" - }, "clickIconToResetPermissions": { "message": "Click on the X icon to reset permissions." }, diff --git a/public/_locales/tr/messages.json b/public/_locales/tr/messages.json index 2eab433640..6a68750c92 100644 --- a/public/_locales/tr/messages.json +++ b/public/_locales/tr/messages.json @@ -34,10 +34,6 @@ } } }, - "authorizedDApps": { - "message": "İzin Verilen DApps", - "description": "DApps = Decentralized Applications" - }, "clickIconToResetPermissions": { "message": "İzinleri sıfırlamak için X simgesine tıklayın." }, @@ -643,38 +639,19 @@ "revealPrivateKey": { "message": "Özel Anahtarı Göster" }, - "revealPrivateKeyDescription": { - "message": "\"Hesabı Dışa Aktar\" olarak da bilinen bu özellik, seçtiğiniz hesap için özel anahtarı gösterir." - }, "revealSeedPhrase": { "message": "Kurtarma Sözcüğünü Göster" }, - "revealSeedPhraseDescription": { - "message": "\"Cüzdanı Dışa Aktar\" olarak da bilinir; başka cihazlarda hesaplarınıza ve cüzdanınıza erişmek için bu kurtarma sözcüğüne ihtiyacınız olabilir." - }, "dApps": { "message": "DApps", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "Bu bölümde, Temple Wallet'i destekleyen merkezi olmayan uygulamalarla etkileşim kurabilmeyi etkinleştirebilirsiniz." - }, - "networksDescription": { - "message": "Bu bölümde, özel Tezos ağları ekleyebilir ya da silebilirsiniz.", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "Hesabı Kaldır" }, "removeAccountDescription": { "message": "Seçtiğiniz hesabı kaldırmak için bu bölümü kullanın. Yalnızca içe aktarılmış olan hesaplar kaldırılabilir." }, - "about": { - "message": "Hakkında" - }, - "aboutDescription": { - "message": "Temple Wallet hakkında meta verileri görüntülemek için bu bölümü kullanın." - }, "unlockWallet": { "message": "Cüzdan Kilidini Aç" }, @@ -1264,15 +1241,12 @@ "upload": { "message": "Yükle" }, - "languageAndCountry": { + "language": { "message": "Dil" }, "generalSettings": { "message": "Genel" }, - "generalSettingsDescription": { - "message": "Dil tercihlerini ve ekran modunu buradan yönetebilirsiniz." - }, "swapNoun": { "message": "Takas" }, @@ -1891,9 +1865,6 @@ "addressBook": { "message": "Adres Defteri" }, - "addressBookDescription": { - "message": "Kişilerinizi ekleyin, çıkarın ve yönetin." - }, "addNewContact": { "message": "Yeni kişi" }, diff --git a/public/_locales/uk/messages.json b/public/_locales/uk/messages.json index 0a41bd6e03..f7ef48c6d4 100644 --- a/public/_locales/uk/messages.json +++ b/public/_locales/uk/messages.json @@ -31,9 +31,9 @@ } } }, - "authorizedDApps": { - "message": "Авторизовані Dapp`ки", - "description": "DApps = децентралізовані додатки" + "connectedDApps": { + "message": "Підключені Dapp`ки", + "description": "Dapps = децентралізовані додатки" }, "clickIconToResetPermissions": { "message": "Натисни X іконку щоб скинути дозволи." @@ -630,38 +630,19 @@ "revealPrivateKey": { "message": "Розкрити приватний ключ" }, - "revealPrivateKeyDescription": { - "message": "Також відоме як \"Export Account\", відкриває приватний ключ для вибраного облікового запису." - }, "revealSeedPhrase": { "message": "Розкрийте Сід Фразу" }, - "revealSeedPhraseDescription": { - "message": "Також відоме як \"Export Wallet\", ця сід фраза може знадобитися для доступу до вашого гаманця та облікових записів на інших пристроях." - }, "dApps": { "message": "DApps", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "У цьому розділі ви можете включити можливість взаємодії з децентралізованими додатками, які підтримують Temple Wallet." - }, - "networksDescription": { - "message": "У цій секції ти можеш додати або видалити кастомні Tezos мережі", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "Видалити Аккаунт" }, "removeAccountDescription": { "message": "Використовуйте цей розділ, щоб видалити вибраний обліковий запис. Видалити можна лише імпортовані облікові записи." }, - "about": { - "message": "Додатково" - }, - "aboutDescription": { - "message": "Використовуйте цей розділ, щоб переглянути метаінформацію про Temple Wallet." - }, "unlockWallet": { "message": "Розблокувати гаманець" }, @@ -1245,15 +1226,12 @@ "upload": { "message": "Завантажити" }, - "languageAndCountry": { + "language": { "message": "Мова" }, "generalSettings": { "message": "Загальне" }, - "generalSettingsDescription": { - "message": "Тут ви можете керувати налаштуваннями мови та режимом відображення." - }, "swapNoun": { "message": "Своп" }, @@ -1883,5 +1861,107 @@ "content": "$1" } } + }, + "enLangName": { + "message": "Англійська" + }, + "en_GBLangName": { + "message": "Англійська ‒ Велика Британія" + }, + "frLangName": { + "message": "Французька" + }, + "deLangName": { + "message": "Німецька" + }, + "zh_CNLangName": { + "message": "Китайська ‒ Спрощена" + }, + "zh_TWLangName": { + "message": "Китайська ‒ Традиційна" + }, + "jaLangName": { + "message": "Японська" + }, + "koLangName": { + "message": "Корейська" + }, + "ukLangName": { + "message": "Українська" + }, + "trLangName": { + "message": "Турецька" + }, + "ptLangName": { + "message": "Португальська" + }, + "usdName": { + "message": "Долар США" + }, + "eurName": { + "message": "Євро" + }, + "gbpName": { + "message": "Фунт стерлінгів" + }, + "jpyName": { + "message": "Японська єна" + }, + "audName": { + "message": "Австралійський долар" + }, + "cadName": { + "message": "Канадський долар" + }, + "chfName": { + "message": "Швейцарський франк" + }, + "cnyName": { + "message": "Китайський юань" + }, + "dkkName": { + "message": "Датська крона" + }, + "hkdName": { + "message": "Гонконгський долар" + }, + "idrName": { + "message": "Індонезійська рупія" + }, + "inrName": { + "message": "Індійська рупія" + }, + "krwName": { + "message": "Південнокорейська вона" + }, + "mxnName": { + "message": "Мексиканське песо" + }, + "nzdName": { + "message": "Новозеландський долар" + }, + "plnName": { + "message": "Польський злотий" + }, + "sekName": { + "message": "Шведська крона" + }, + "sgdName": { + "message": "Сінгапурський долар" + }, + "thbName": { + "message": "Тайський бат" + }, + "tryName": { + "message": "Турецька ліра" + }, + "twdName": { + "message": "Тайванський долар" + }, + "uahName": { + "message": "Українська гривня" + }, + "zarName": { + "message": "Південноафриканський ранд" } } diff --git a/public/_locales/zh_CN/messages.json b/public/_locales/zh_CN/messages.json index eefc8118f2..62c61fc118 100644 --- a/public/_locales/zh_CN/messages.json +++ b/public/_locales/zh_CN/messages.json @@ -31,10 +31,6 @@ } } }, - "authorizedDApps": { - "message": "授权DApps", - "description": "DApps = Decentralized Applications" - }, "clickIconToResetPermissions": { "message": "点击X图标来重置权限。" }, @@ -607,26 +603,13 @@ "revealPrivateKey": { "message": "显示私钥" }, - "revealPrivateKeyDescription": { - "message": "也称为“导出账户”,显示所选账户的私钥。" - }, "revealSeedPhrase": { "message": "显示助记词" }, - "revealSeedPhraseDescription": { - "message": "也称为“导出钱包”,您可能需要此助记词来在其他设备上访问您的钱包和账户。" - }, "dApps": { "message": "DApp", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "在此处,您可以获得与支持Temple钱包的去中心化应用互动的能力。" - }, - "networksDescription": { - "message": "在此处,您可以添加或删除自定义Tezos网络。", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "移除账户" }, @@ -636,9 +619,6 @@ "about": { "message": "关于" }, - "aboutDescription": { - "message": "使用此板块来查看关于Temple钱包的元信息。" - }, "unlockWallet": { "message": "解锁钱包" }, @@ -1192,15 +1172,12 @@ "upload": { "message": "上传" }, - "languageAndCountry": { + "language": { "message": "语言" }, "generalSettings": { "message": "通用" }, - "generalSettingsDescription": { - "message": "在此处您可以管理语言偏好和显示模式。" - }, "swapNoun": { "message": "交换" }, diff --git a/public/_locales/zh_TW/messages.json b/public/_locales/zh_TW/messages.json index 972cdcee80..d4ac754831 100644 --- a/public/_locales/zh_TW/messages.json +++ b/public/_locales/zh_TW/messages.json @@ -31,10 +31,6 @@ } } }, - "authorizedDApps": { - "message": "授權的分散式應用程式", - "description": "DApps = Decentralized Applications" - }, "clickIconToResetPermissions": { "message": "點擊 X 圖示重新設定權限。" }, @@ -607,38 +603,19 @@ "revealPrivateKey": { "message": "顯示私密金鑰" }, - "revealPrivateKeyDescription": { - "message": "也稱為「匯出帳戶」,這會顯示所選取帳戶的私密金鑰。" - }, "revealSeedPhrase": { "message": "顯示助記詞" }, - "revealSeedPhraseDescription": { - "message": "也稱為「匯出錢包」,您可能需要此助記詞,才能透過其他裝置存取您的錢包和帳戶。" - }, "dApps": { "message": "分散式應用程式", "description": "DApps = Decentralized Applications" }, - "dAppsDescription": { - "message": "在此區段,您可以啟用與支援 Temple 錢包的分散式應用程式互動的能力。" - }, - "networksDescription": { - "message": "在此區段,您可以新增或刪除自訂的 Tezos 網路。", - "description": "Tezos = blockchain name (https://tezos.com/)" - }, "removeAccount": { "message": "移除帳戶" }, "removeAccountDescription": { "message": "使用此區段移除您選取的帳戶。只能移除匯入的帳戶。" }, - "about": { - "message": "關於" - }, - "aboutDescription": { - "message": "使用此區段檢視 Temple 錢包的元資料。" - }, "unlockWallet": { "message": "解鎖錢包" }, @@ -1192,15 +1169,12 @@ "upload": { "message": "上傳" }, - "languageAndCountry": { + "language": { "message": "語言" }, "generalSettings": { "message": "一般" }, - "generalSettingsDescription": { - "message": "您可以在此管理語言偏好和顯示模式。" - }, "swapNoun": { "message": "交換" }, diff --git a/public/misc/country-flags/cn.png b/public/misc/country-flags/cn.png new file mode 100644 index 0000000000000000000000000000000000000000..0093d23d4ec65d5a5186e9dcf611af436177b7dc GIT binary patch literal 778 zcmV+l1NHogP)tSp9URRX8UEJ**CizW#sU7|0NE%e)*~Y1CmH537xR1$@pKOQstD{%7vUoo>{Ao> zlnwf?2K>GS{>%aX$pG&&B<(vN^kN(JZW-}q74?AP|`>_Q4!2|O` zCG}b$>MkGbIUeUJ9P2?D=QX;wE~bh7v6{%?fOhEif7wMaZ(U!?b6(E94q##~Fw>uCA^LRQf) zFSW@WZcg395v07|$n#R%^-=0w43o(7kmGD|%@_V0cDltzx3eX198_|4m~OGyVsEQa z1f3lL3rpKf-L?<-&@$O1DwR++Yt&5Bv;jN^hGA3t@xc&evk>a-$=1rHEu|$dz=jO zc?dDaca&a^C>>ztG@>Rw#R(7=3K*X?CuNMI<~6~vMx!zw1cVTb;Q+V_1qcZl!~p@( z#3w#kc5-G&<~ zA`3!GoqB?QczZsq1XrravSuNuo93($!*p6wVZnz~xf|ZxNI-=Rhg12LPP1^TQjw%U z`cg9Fej@z0fbWE|yhtd^2+0@oy9?-6 - - - - - - - - - - diff --git a/public/misc/country-flags/de.png b/public/misc/country-flags/de.png new file mode 100644 index 0000000000000000000000000000000000000000..798ef00c909599814cc0d60cc1602cdf2596b6d2 GIT binary patch literal 363 zcmV-x0hIoUP)Nt`FfF z8RsD&x z4gipla#)fG0002CNkl - - - - diff --git a/public/misc/country-flags/fr.png b/public/misc/country-flags/fr.png new file mode 100644 index 0000000000000000000000000000000000000000..f41e5c28338985deae7a358f04c4681acff837d1 GIT binary patch literal 506 zcmVLm zEPypkt0_B_CpeEJG>RfIhafM5KU%*uO0hgvxj0a;GDxN4@JuNH000kkQchFw?}QEj z@bK^Nmz9u^hk#b9RZ;)|0M|)GK~y-)t;*L9f>01e(Xn?CMO5ry?}}Y4|Nm9$O*q6M zUU_g$a^_`IG@sbGDvaR@Wuuhod;B4UDe3gqt}@ecm5dNMP7iz`7zW*L1K?o^Rx2{i zArzU9@O~eGG~DkS@SpJUFyVXH?b3ET2Bj$OO)Lv-+rD1kV=IgXBAkFUw5%ye!^2?) zKf*ak!{c!QJS=EhLC|#l6*j>a!Ye$T0*4kz!}ECwil8d0DjpA8pfVrf - - - - diff --git a/public/misc/country-flags/gb.png b/public/misc/country-flags/gb.png new file mode 100644 index 0000000000000000000000000000000000000000..68a19e5085365815a59874ebc5490b6025e48a7a GIT binary patch literal 1021 zcmVn`v5)uFa0N!hA<>lq$tE=Gx0RR90^Z@|%0RZ>`0Q!J{<>lr20Ra2I zzx}_z9V&g<0RZ6w0Neop{@>prFpNcH%Q#TD;d66BV8%LBy&Wlh`5_?Z>-f>w^vKKO zNN3mLtgIq2k0CIH{D6P;At1fP-u}hI7E&6VPE+X z5cClc+u`-&(<%ow!i0pmEm7{+|13`m8IC_*VnDH*PEu%LtxI6o61jT#bR!; zb$qM+prAfVnxU0s!v;0OaQK)!6Exu;-z#=l|c|*xKLN z+1{L}-Lkyfke%6ulF5;n$9js#NMXcDVZ(KQxNCQ~{jab4pr8GppZt)JLQRn4W@PtZ zU-wZ^^f55|At3V+5aJLH+7Aw$75Ab5000YgQchEo@bK@54gm1)fPj9t7SI3y0v<_3 zK~y-)wUB31B0&&_+jyZx27zTcIFcku0)pfm%sHM}FXx=&Prsg7c9p}c@{3Px)lR?j z?Dq7)@a=)Gj99%R2(gHCdMZU&NU2v@V&T#7#~bv7A; z4Hg{bxMWfvZj#6=5;q^A(Z$zoYR5Lf_A>sdEzA#O&d;Jz5ohP|v+{>9^?GfCOeW=) zT_Or1p^Au65tgWvJC(^mHtTq^n24#NCdwrdwGxPnZynhz~PBLaPQ>!=844srb`0L|KY@)4_Zs<^N~xnBLg)`TZa z>k-Dfzp9E=|0^;ZGh*xeT8*X-tEaB)`2FLmIPUkqt7s#Y)4+~@iDeWY>{+eWbCHU@ zIWm9n+FXVk<}>9O^#g0SNF3Ca0nW_*FlZ+J_@3^X1XIk%10S1G>RrZ|odSR%=r@Tq-{8<+4%&AJUZiQ700000NkvXXu0mjfS4aVr literal 0 HcmV?d00001 diff --git a/public/misc/country-flags/gb.svg b/public/misc/country-flags/gb.svg deleted file mode 100644 index eea7c8f080..0000000000 --- a/public/misc/country-flags/gb.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/public/misc/country-flags/jp.png b/public/misc/country-flags/jp.png new file mode 100644 index 0000000000000000000000000000000000000000..de0bf28aef6f5728bccc37375855d6bdb72339f7 GIT binary patch literal 437 zcmV;m0ZRUfP)DI};29X+7Z&Fs zAmkk!f3B=N+?_wVuZ?eXuas_}z^>3e+cT3YwV$@u&H^7s4p)YkFQ)b*^c z?4_sgXJ_VLVB}Fzf6k#X;nKi^REY%P@HeCG#+PNJVq7xGS+4*r+fu zL*Lc%B?x28b!opS+U`zYUh4VfXkYMH+dbQl;RJRPML%#f+D6d|4< z#Ex_8<7fYhL4p{jx|>i3Qy9w-;>pFJL9wzO*o%P<Lb literal 0 HcmV?d00001 diff --git a/public/misc/country-flags/jp.svg b/public/misc/country-flags/jp.svg deleted file mode 100644 index d2cf0c37f8..0000000000 --- a/public/misc/country-flags/jp.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/public/misc/country-flags/kr.png b/public/misc/country-flags/kr.png new file mode 100644 index 0000000000000000000000000000000000000000..f865eaf0d834060cc8c32991c33bfaf31b77400c GIT binary patch literal 1029 zcmV+g1p51lP)BPz)7abLo_`~Lsp z*y?C|o<($&Yx%VK0@FfcIc@A3HJ<1$Fpp`)dhmzar+j(vZDKtVw? zG&JEG8l|YJNJ&X7EG*|CAl~Kr$;tfr5kac6M-b zb6Q$jQ&d$_Qc_M%PwPEB>hb;Z_xtJX@p_BoVsqcu+1fu<*hNsy^Pit@L!Ob6lx}fy znKf=+UtsD=O4}nU*B>U|=la#%_|x6@(cAaL&h)s$@uINpmZj@scHdBD-7-kkOSz1(9 zS4Bof(kVF5CN;|vGb7xV()Jn$p6^3J6t=2Et}RqW!G5WBqGavKF_hS?rg6vNGJq1 zfdmVX<5%j%EM=v@g}4a3C~kIUt8dG>CY-Mttdddzk# zxOgGF^Wt1E#{o#> zrJy^CR?9c-%B%1~H>n3-Tae}uMo}Rs=Yn4ly1#w9*LD#hxPc2nwjhmhP9-bqx*SYn zTr9`q&*Jg;lOo2lzK%&+3#xuh(vms7NDN+zMa>jwsr8hYZ4mN}iq?)FH8z`01q}Bk0T2ciMr--Bv z9rT*@KWYC6s9A1}zD7~>m71WYCLEVD2Q~E%;r?;FmnPY500000NkvXXu0mjf9&`OF literal 0 HcmV?d00001 diff --git a/public/misc/country-flags/kr.svg b/public/misc/country-flags/kr.svg deleted file mode 100644 index ed2f463ad3..0000000000 --- a/public/misc/country-flags/kr.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/public/misc/country-flags/pt.png b/public/misc/country-flags/pt.png new file mode 100644 index 0000000000000000000000000000000000000000..32ad7b86744683f8a7f3bdfb3338100385741718 GIT binary patch literal 1413 zcmV;01$z34P)?hI0PFw&_5c9!007be z0PX+)-~a&g0016f03vSy_y7R-{Qn|t0M!5hNz4F8#sEaX07t_BCU*cty#OR~07AL| z*8l*)7Z$q|6eoHBKeYfouK+u%03~z)`q38o+%^Vy1@EXb+8v5%M|J)StV+r&g12>=mAZGyG005e> z*L;}H+HY|A${FwL7yafJtwI;s78cJ)6{(34&?6D~iVok@4fn_m_Nfc^eG8Se3iERb z@i_%Vz5qF*05g{W^X~Dv%H^uQ;ftftZH&jsG$7tl8`oMIwm%lTBo^8u7W&{7!Xp*< z!xXhj6wTukwl5Q}C=;|H6QL{;`nD0Ud=dH95ctUu>)j5=(hm2!4fu5pn9&S=Y7E55 z3!=0OvB3)VVhVPX3G|K$_F4(_QwZ@^22HU7KY;@69RlnQ0YI_2r6<$4?6LK@ye8u05G-&+~`>le@47r$W_YhMWE7}M z6#2jty*d-V6BFRx63fmK_{5bsksW0 zsS15)3WHk;gvSYrya}AM3HC<`cfbgRuLyyo2X&zaTxteqm<3tF1X_^<@+<^by#r3A z1NI&RLWlx5ivc%>0W^I9FmM6!4*}-@0JV8U*#H0l4|GyaQ}FPF4gl}(@9&qDkdTLf z!%&J10007HNklZc5rcxJEjAbMoMtT>_!H5cX!ujth>9r zySux)^RL(u^m*>(!sGYE^Lz1m@dNhbhfO2oWU&!r?ZFrq7neB$7v*FnTQJ;hGOLBDZ8kk9up_98U2uG3>zEz`e^!|`XDg$=Wa#b=#A1WN@Df3l3c=td5UNxW4uAc=m_vy~ zAQ0RHi3 z@)C(e)#tS>*+pxDla~dh24xpVwTMFW@-ZF?k_O!tuzM<{AwNIy(al zlSm|Q&;0z2UMiX1UrA)XIya7H31Vyvd(XY| z^m-|BN24|Et#Nayu&)m@_OUAVGxq1IhDOuHBS(b+0W(c?J>kZ_ij7aGsYskhGmpVQ z&~>n`cTElPts2BEL0{jA#3+OcSwleJ%OYmk{bSgGaT7=}tTY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/public/misc/country-flags/ru.svg b/public/misc/country-flags/ru.svg deleted file mode 100644 index 72df4f327b..0000000000 --- a/public/misc/country-flags/ru.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/public/misc/country-flags/tr.png b/public/misc/country-flags/tr.png new file mode 100644 index 0000000000000000000000000000000000000000..2c762410b9083cde0a608c6a6fbf1146f219a782 GIT binary patch literal 667 zcmV;M0%ZM(P)P^ zAnYb2_x%6cDk$+RD&!p;^DQjpARpZ6peaA)z|XT)Az{9@WaLPtE}{(pz&#G>tkc^TwCrzK-d)&_tn<#w72%H zuIreY<{93v^OWQ}FMQh=2|N@9&qDw4!}k0004ANklET6oogoG%;9-5~Pa)V((qk-~WMfFRZXJ&cL61%kG>r^KoHGE_2gpG@4D=aQKlX z%=EcQPxHbbi8>zUWkTK4B7d!4nc8>42Hpq^EP^OR$xR$DV^C=fO%NQr3gh~MGd@uDXP;_ z$6>`f#leB&dWdFenoTo^o+n9?APADwL9r8L>3fLt_ZTHOJdc>BK=H+W*al!~Hf^Q} zVnGlJh>hX|vH%MhR(id@3jr#Ks#-W>;bmw>u@_}kWyKMWoJG~X5cxA*{C~~nuK=Pb zM%BfSTazxnG;>)|6hX}MxOm(y&TLiI>!r2K2k>}Mk>TsZYWci%^DLpr@HrX`CNl_e zA`2^W++zYb?jJ - - - - - diff --git a/public/misc/country-flags/tw.png b/public/misc/country-flags/tw.png new file mode 100644 index 0000000000000000000000000000000000000000..6e99b3c8a3a870a535b70eede4ca085de606393f GIT binary patch literal 795 zcmV+$1LXXPP) z0P_F<_y7QmA5TJH#w2V0O0@tMP$m=008p!`$c2YLtxH8T*)*_u`)=l zFh!~_L#NjO06bT~I#awjP`Ex>#YJSxHchnK007zm0G_PjMP$-1L#E~E^@y3>HB756 zLY*o-m)!sW%+u_bsOY7y+lQ9bf|Ap9gv*vGUXUVH=IZyh!Rf%r=%BCXsI%ddqu-94 z)^>={e~rw0h{jH4#&CbbUvR%XR=GJ-wK!0)GDxK`MWQG=lPEcmpE7EkFJ+Q3WRoRX zejG>V007(J_QTEa&D8J0%k8YW>Z!Hlvbx~0x!-h(-DrT@nWfm6qt{Sv)oz2-VtLS3 zZp&wP#6euaS7^FPTd_!6v6(Dly$>jc?I4)|000eiQchFwmWU1j@9*#LkdT0Y(>b^s z0004MNklsm7v|te=)}=6PHtqHpCV4<{574+Boeqb7zaGWmp%_ZPMWCV=$wQL~ zLj$@2@H|E+g{VQ491a5kBf71W!9(Gr7%_@Qh8%amaoi{UDg$nK@I!J#3d2@wx9>=p zfvw@N-QF2N9%?kC+ua)B2Y;?fLycx_0)Gh^W|EL${%J^<-uSME-83_iDKaxf#%E-D Z<`+7ybd_e*JVpQj002ovPDHLkV1j>sYsmlr literal 0 HcmV?d00001 diff --git a/public/misc/country-flags/tw.svg b/public/misc/country-flags/tw.svg deleted file mode 100644 index cb96a8a4ea..0000000000 --- a/public/misc/country-flags/tw.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/public/misc/country-flags/ua.png b/public/misc/country-flags/ua.png new file mode 100644 index 0000000000000000000000000000000000000000..044d48a2fa4c3f33ee8c7a4af63c512d7bb9bf96 GIT binary patch literal 407 zcmV;I0cie-P)h z#p6V~;@Y7ANW$Yt!Q&DV5&!@IK(+flu=_i!`ZuHcHJvm

QtP1GFY%4gh1w+9SYP5@HSz0uRe_1`s6}mOq4?=K#+C5>DUb z{`%rW0OQ0M6f!&{*7f~%uf;|*VUUQ@h=wy7rw - - - diff --git a/public/misc/country-flags/us.png b/public/misc/country-flags/us.png new file mode 100644 index 0000000000000000000000000000000000000000..efc8a09e6ba119584191442163af1f6ce1cd924b GIT binary patch literal 809 zcmV+^1J?YBP)!bKvuOkPOdRVq%1(1C^?eYfr67mch)2# z&mJAi85qFJ@2a`#yT<3GvEYT5+i!%{eT~jdXvb!G#y(laG)u9dujiDY)IeOxK3Tzn zjk-2Xv@}YoDm<0tg@%qcY17;BuDRivr`?#Q+iQT(O=!qub;6&1w!W0DmvgC*Yo6VP zhKMg;F>i>TL000hjQchFwmWYTB0Pyhd@9*!BfTVvi|CjeGDBWGyL0Bw&Ux62G^)0dMiTvi z&Mpm784O#G2CNIAa0ux}?fK<}#g$c&o<||?9Vi@L(#<&5MY_^K>~g~G4| zFB1@oLIk0e0YS(Q-R>S4xZUzYit3fYzbr%3eKMeF9GZt}r;Ztq-{ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/app/atoms/BakingButtons/index.tsx b/src/app/atoms/BakingButtons/index.tsx index ea928e511e..be6ce10077 100644 --- a/src/app/atoms/BakingButtons/index.tsx +++ b/src/app/atoms/BakingButtons/index.tsx @@ -116,8 +116,7 @@ const RedelegateButtonWithConfirmation = memo { if (confirmed) navigate(`/delegate/${chainId}`); }), diff --git a/src/app/atoms/Flag.tsx b/src/app/atoms/Flag.tsx index 5048384dc7..9e30951eae 100644 --- a/src/app/atoms/Flag.tsx +++ b/src/app/atoms/Flag.tsx @@ -1,4 +1,4 @@ -import React, { FC, HTMLAttributes, memo, useCallback, useState } from 'react'; +import React, { HTMLAttributes, memo, useCallback, useState } from 'react'; import classNames from 'clsx'; @@ -8,23 +8,18 @@ type FlagProps = { src?: string; }; -const Flag: FC = props => { - const { alt, className, src } = props; +const Flag = memo(({ alt, className, src }) => { const [error, setError] = useState(false); const handleError = useCallback(() => { setError(true); }, [setError]); - if (!src) { - return ; - } - return ( -

+
{src ? ( <> - {alt} + {alt} {error && } ) : ( @@ -32,7 +27,7 @@ const Flag: FC = props => { )}
); -}; +}); export default Flag; diff --git a/src/app/atoms/FormCheckbox.tsx b/src/app/atoms/FormCheckbox.tsx index 02e30d8925..97e2a84849 100644 --- a/src/app/atoms/FormCheckbox.tsx +++ b/src/app/atoms/FormCheckbox.tsx @@ -5,7 +5,7 @@ import clsx from 'clsx'; import Checkbox, { CheckboxProps } from 'app/atoms/Checkbox'; import { AnalyticsEventCategory, setTestID, useAnalytics } from 'lib/analytics'; -export interface FormCheckboxProps extends CheckboxProps { +interface FormCheckboxProps extends CheckboxProps { basic?: boolean; label?: ReactNode; labelDescription?: ReactNode; diff --git a/src/app/pages/AccountSettings/settings-cell.tsx b/src/app/atoms/SettingsCell.tsx similarity index 67% rename from src/app/pages/AccountSettings/settings-cell.tsx rename to src/app/atoms/SettingsCell.tsx index 45954933bd..cca98ffbea 100644 --- a/src/app/pages/AccountSettings/settings-cell.tsx +++ b/src/app/atoms/SettingsCell.tsx @@ -8,7 +8,10 @@ interface ComponentBase { } interface SettingsCellPropsBase

{ + isLast?: boolean; + cellIcon?: ReactNode; cellName: ReactNode; + cellNameClassName?: string; Component: 'div' | FC

; } @@ -24,20 +27,24 @@ type SettingsCellProps

= P extends { Component: 'div' } export const SettingsCell =

({ className, - cellName: name, + cellIcon, + cellName, + cellNameClassName = 'text-font-medium-bold', + isLast = true, children, Component, ...restProps }: SettingsCellProps

) => { return ( - {name} +

+ {cellIcon} + + {cellName} +
{children} diff --git a/src/app/atoms/SettingsCellGroup.tsx b/src/app/atoms/SettingsCellGroup.tsx new file mode 100644 index 0000000000..32df443b50 --- /dev/null +++ b/src/app/atoms/SettingsCellGroup.tsx @@ -0,0 +1,20 @@ +import React, { Children, FC, HTMLAttributes } from 'react'; + +import clsx from 'clsx'; + +export const SettingsCellGroup: FC>> = ({ + className, + children, + ...restProps +}) => ( +
+ {children} +
+); diff --git a/src/app/atoms/action-modal/action-modal.tsx b/src/app/atoms/action-modal/action-modal.tsx index 0e3b67c0a7..c11e2b5415 100644 --- a/src/app/atoms/action-modal/action-modal.tsx +++ b/src/app/atoms/action-modal/action-modal.tsx @@ -1,4 +1,4 @@ -import React, { memo } from 'react'; +import React, { ReactNode, memo } from 'react'; import clsx from 'clsx'; @@ -14,11 +14,11 @@ import { import actionModalStyles from './action-modal.module.css'; -interface ActionModalProps { +export interface ActionModalProps { hasCloseButton?: boolean; onClose?: EmptyFn; - children: JSX.Element | JSX.Element[]; - title: string; + children?: ReactNode | ReactNode[]; + title?: ReactNode; className?: string; } diff --git a/src/app/atoms/index.ts b/src/app/atoms/index.ts index 0997b28489..522350af8b 100644 --- a/src/app/atoms/index.ts +++ b/src/app/atoms/index.ts @@ -37,7 +37,6 @@ export { FormSubmitButton } from './FormSubmitButton'; export { FormSecondaryButton } from './FormSecondaryButton'; -export type { FormCheckboxProps } from './FormCheckbox'; export { FormCheckbox } from './FormCheckbox'; export { SyncSpinner } from './SyncSpinner'; diff --git a/src/app/icons/additional.svg b/src/app/icons/additional.svg deleted file mode 100644 index 67e741ca83..0000000000 --- a/src/app/icons/additional.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/src/app/icons/apps.svg b/src/app/icons/apps.svg deleted file mode 100644 index 8863f7bb53..0000000000 --- a/src/app/icons/apps.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/app/icons/base/additional.svg b/src/app/icons/base/additional.svg new file mode 100644 index 0000000000..8e30602ed1 --- /dev/null +++ b/src/app/icons/base/additional.svg @@ -0,0 +1,6 @@ + + + diff --git a/src/app/icons/base/addressbook.svg b/src/app/icons/base/addressbook.svg new file mode 100644 index 0000000000..8a23b76602 --- /dev/null +++ b/src/app/icons/base/addressbook.svg @@ -0,0 +1,6 @@ + + + diff --git a/src/app/icons/base/browse.svg b/src/app/icons/base/browse.svg index 1c97721dad..095ad60bcf 100644 --- a/src/app/icons/base/browse.svg +++ b/src/app/icons/base/browse.svg @@ -1,6 +1,6 @@ - + diff --git a/src/app/icons/base/exit.svg b/src/app/icons/base/exit.svg new file mode 100644 index 0000000000..8c18d77578 --- /dev/null +++ b/src/app/icons/base/exit.svg @@ -0,0 +1,7 @@ + + + + diff --git a/src/app/icons/base/info.svg b/src/app/icons/base/info.svg new file mode 100644 index 0000000000..e4f31c622b --- /dev/null +++ b/src/app/icons/base/info.svg @@ -0,0 +1,6 @@ + + + diff --git a/src/app/icons/base/link.svg b/src/app/icons/base/link.svg new file mode 100644 index 0000000000..2ea8c85afb --- /dev/null +++ b/src/app/icons/base/link.svg @@ -0,0 +1,6 @@ + + + diff --git a/src/app/icons/base/refresh.svg b/src/app/icons/base/refresh.svg new file mode 100644 index 0000000000..5ca74d40b2 --- /dev/null +++ b/src/app/icons/base/refresh.svg @@ -0,0 +1,6 @@ + + + diff --git a/src/app/icons/canny.svg b/src/app/icons/canny.svg deleted file mode 100644 index e6bb0370c6..0000000000 --- a/src/app/icons/canny.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/app/icons/helpcrunch.svg b/src/app/icons/helpcrunch.svg deleted file mode 100644 index 5d5b3e6560..0000000000 --- a/src/app/icons/helpcrunch.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - diff --git a/src/app/icons/monochrome/extension.svg b/src/app/icons/monochrome/extension.svg deleted file mode 100644 index 7ccbaa087a..0000000000 --- a/src/app/icons/monochrome/extension.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/src/app/icons/monochrome/help.svg b/src/app/icons/monochrome/help.svg deleted file mode 100644 index 1b4a9efe82..0000000000 --- a/src/app/icons/monochrome/help.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/src/app/icons/monochrome/key.svg b/src/app/icons/monochrome/key.svg deleted file mode 100644 index ca17a9583b..0000000000 --- a/src/app/icons/monochrome/key.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - diff --git a/src/app/icons/monochrome/people.svg b/src/app/icons/monochrome/people.svg deleted file mode 100644 index b59d26f83d..0000000000 --- a/src/app/icons/monochrome/people.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/src/app/icons/monochrome/sticker.svg b/src/app/icons/monochrome/sticker.svg deleted file mode 100644 index c52b5d23e6..0000000000 --- a/src/app/icons/monochrome/sticker.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/src/app/icons/monochrome/sync.svg b/src/app/icons/monochrome/sync.svg deleted file mode 100644 index 9dd0aee25e..0000000000 --- a/src/app/icons/monochrome/sync.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/src/app/layouts/Dialogs.tsx b/src/app/layouts/Dialogs.tsx index 2f49216f0f..c1e0c6da20 100644 --- a/src/app/layouts/Dialogs.tsx +++ b/src/app/layouts/Dialogs.tsx @@ -1,7 +1,7 @@ import React, { FC, useCallback } from 'react'; -import AlertModal from 'app/templates/AlertModal'; -import ConfirmationModal from 'app/templates/ConfirmationModal/ConfirmationModal'; +import { AlertModal } from 'app/templates/AlertModal'; +import { ConfirmationModal } from 'app/templates/ConfirmationModal/ConfirmationModal'; import { dispatchAlertClose, dispatchConfirmClose, useModalsParams } from 'lib/ui/dialog'; const Dialogs: FC = () => { @@ -17,12 +17,8 @@ const Dialogs: FC = () => { return ( <> - - + + ); }; diff --git a/src/app/layouts/PageLayout/DefaultHeader.tsx b/src/app/layouts/PageLayout/DefaultHeader.tsx index 5ec03979cf..949e12f3a3 100644 --- a/src/app/layouts/PageLayout/DefaultHeader.tsx +++ b/src/app/layouts/PageLayout/DefaultHeader.tsx @@ -68,7 +68,9 @@ export const DefaultHeader = memo>(
- {pageTitle &&
{pageTitle}
} + {pageTitle && ( +
{pageTitle}
+ )}
{headerRightElem}
diff --git a/src/app/pages/AccountSettings/index.tsx b/src/app/pages/AccountSettings/index.tsx index 61cb3e8bcf..18178bf23d 100644 --- a/src/app/pages/AccountSettings/index.tsx +++ b/src/app/pages/AccountSettings/index.tsx @@ -7,6 +7,8 @@ import { AccountName } from 'app/atoms/AccountName'; import { CopyButton } from 'app/atoms/CopyButton'; import { EvmNetworksLogos, TezNetworkLogo } from 'app/atoms/NetworksLogos'; import { ActionsButtonsBox } from 'app/atoms/PageModal/actions-buttons-box'; +import { SettingsCell } from 'app/atoms/SettingsCell'; +import { SettingsCellGroup } from 'app/atoms/SettingsCellGroup'; import { StyledButton } from 'app/atoms/StyledButton'; import { TotalEquity } from 'app/atoms/TotalEquity'; import { useAllAccountsReactiveOnRemoval } from 'app/hooks/use-all-accounts-reactive'; @@ -25,7 +27,6 @@ import { EditAccountNameModal } from './edit-account-name-modal'; import { RemoveAccountModal } from './remove-account-modal'; import { RevealPrivateKeyModal } from './reveal-private-key-modal'; import { AccountSettingsSelectors } from './selectors'; -import { SettingsCell } from './settings-cell'; import { PrivateKeyPayload } from './types'; interface AccountSettingsProps { @@ -158,33 +159,39 @@ export const AccountSettings = memo(({ id }) => {
- } Component="div"> - - - - } - Component={Button} - onClick={openEditNameModal} - testID={AccountSettingsSelectors.editName} - > - - + + } Component="div"> + + + - {(account.type === TempleAccountType.HD || account.type === TempleAccountType.Imported) && ( + } + cellName={} Component={Button} - onClick={openRevealPrivateKeyModal} - testID={AccountSettingsSelectors.revealPrivateKey} + onClick={openEditNameModal} + testID={AccountSettingsSelectors.editName} > + + + {(account.type === TempleAccountType.HD || account.type === TempleAccountType.Imported) && ( + + } + Component={Button} + onClick={openRevealPrivateKeyModal} + testID={AccountSettingsSelectors.revealPrivateKey} + > + + + )}
@@ -194,16 +201,17 @@ export const AccountSettings = memo(({ id }) => {

{derivationPaths.map(({ chainName, path }) => ( - - {chainName === 'tezos' ? : } - + + + {chainName === 'tezos' ? : } + + ))} )} diff --git a/src/app/pages/Home/OtherComponents/Tokens/components/TokenTag/ScamTag.tsx b/src/app/pages/Home/OtherComponents/Tokens/components/TokenTag/ScamTag.tsx index 0e158673cc..0e4c83a36c 100644 --- a/src/app/pages/Home/OtherComponents/Tokens/components/TokenTag/ScamTag.tsx +++ b/src/app/pages/Home/OtherComponents/Tokens/components/TokenTag/ScamTag.tsx @@ -25,9 +25,8 @@ export const ScamTag = memo(({ assetSlug, tezPkh, tezosChainId }) => { try { const confirmed = await confirm({ title: t('deleteScamTokenConfirmTitle'), - titleClassName: 'font-bold', description: t('deleteScamTokenConfirmDescription'), - comfirmButtonText: t('delete') + confirmButtonText: t('delete') }); if (confirmed) diff --git a/src/app/pages/Settings/Settings.selectors.ts b/src/app/pages/Settings/Settings.selectors.ts index efd28540bb..6ca5f22d43 100644 --- a/src/app/pages/Settings/Settings.selectors.ts +++ b/src/app/pages/Settings/Settings.selectors.ts @@ -9,5 +9,10 @@ export enum SettingsSelectors { removeAccountButton = 'Settings/Remove Account Button', aboutButton = 'Settings/About Button', accountsManagementButton = 'Settings/Accounts Management Button', - advancedFeaturesButton = 'Settings/Advanced Features Button' + advancedFeaturesButton = 'Settings/Advanced Features Button', + securityAndPrivacyButton = 'Settings/Security and Privacy Button', + passwordInput = 'Settings/Password Input', + cancelResetExtensionButton = 'Settings/Cancel Reset Extension Button', + confirmResetExtensionButton = 'Settings/Confirm Reset Extension Button', + resetExtensionButton = 'Settings/Reset Extension Button' } diff --git a/src/app/pages/Settings/Settings.tsx b/src/app/pages/Settings/Settings.tsx index 097fbd7fdd..1159747afd 100644 --- a/src/app/pages/Settings/Settings.tsx +++ b/src/app/pages/Settings/Settings.tsx @@ -1,33 +1,35 @@ -import React, { memo, ReactNode, useMemo, useState } from 'react'; - -import clsx from 'clsx'; +import React, { FC, ReactNode, SetStateAction, memo, useMemo, useState } from 'react'; import { IconBase } from 'app/atoms'; -import { ReactComponent as AdditionalIcon } from 'app/icons/additional.svg'; -import { ReactComponent as AppsIcon } from 'app/icons/apps.svg'; -import { ReactComponent as SettingsIcon } from 'app/icons/base/settings.svg'; -import { ReactComponent as ContactBookIcon } from 'app/icons/monochrome/contact-book.svg'; -import { ReactComponent as ExtensionIcon } from 'app/icons/monochrome/extension.svg'; -import { ReactComponent as HelpIcon } from 'app/icons/monochrome/help.svg'; -import { ReactComponent as KeyIcon } from 'app/icons/monochrome/key.svg'; -import { ReactComponent as PeopleIcon } from 'app/icons/monochrome/people.svg'; -import { ReactComponent as SignalAltIcon } from 'app/icons/monochrome/signal-alt.svg'; -import { ReactComponent as StickerIcon } from 'app/icons/monochrome/sticker.svg'; -import { ReactComponent as SyncIcon } from 'app/icons/monochrome/sync.svg'; +import { AccountAvatar } from 'app/atoms/AccountAvatar'; +import { SettingsCell } from 'app/atoms/SettingsCell'; +import { SettingsCellGroup } from 'app/atoms/SettingsCellGroup'; +import { StyledButton } from 'app/atoms/StyledButton'; +import { ReactComponent as AdditionalFeaturesIcon } from 'app/icons/base/additional.svg'; +import { ReactComponent as AddressBookIcon } from 'app/icons/base/addressbook.svg'; +import { ReactComponent as BrowseIcon } from 'app/icons/base/browse.svg'; +import { ReactComponent as ChevronRightIcon } from 'app/icons/base/chevron_right.svg'; +import { ReactComponent as ExitIcon } from 'app/icons/base/exit.svg'; +import { ReactComponent as InfoIcon } from 'app/icons/base/info.svg'; +import { ReactComponent as LinkIcon } from 'app/icons/base/link.svg'; +import { ReactComponent as LockIcon } from 'app/icons/base/lock.svg'; +import { ReactComponent as ManageIcon } from 'app/icons/base/manage.svg'; +import { ReactComponent as RefreshIcon } from 'app/icons/base/refresh.svg'; import PageLayout from 'app/layouts/PageLayout'; import About from 'app/templates/About/About'; import { AccountsManagement } from 'app/templates/AccountsManagement'; import AddressBook from 'app/templates/AddressBook/AddressBook'; import { AdvancedFeatures } from 'app/templates/AdvancedFeatures'; import DAppSettings from 'app/templates/DAppSettings/DAppSettings'; -import HelpAndCommunity from 'app/templates/HelpAndCommunity'; -import { RevealSeedPhrase, RevealPrivateKeys } from 'app/templates/RevealSecrets'; import GeneralSettings from 'app/templates/SettingsGeneral'; import SyncSettings from 'app/templates/Synchronization/SyncSettings'; import { TID, T } from 'lib/i18n'; +import { useBooleanState } from 'lib/ui/hooks'; import { Link } from 'lib/woozie'; +import { useAccount } from 'temple/front'; import NetworksSettings from './Networks'; +import { ResetExtensionModal } from './reset-extension-modal'; import { SettingsSelectors } from './Settings.selectors'; interface SettingsProps { @@ -37,190 +39,141 @@ interface SettingsProps { interface Tab { slug: string; titleI18nKey: TID; - Icon: React.FC>; - Component: React.FC<{ setHeaderChildren: (children: ReactNode) => void }>; - color: string; - descriptionI18nKey: TID; + Icon: FC; + Component: FC<{ setHeaderChildren: React.Dispatch> }>; testID?: SettingsSelectors; } -const TABS: Tab[] = [ - { - slug: 'general-settings', - titleI18nKey: 'generalSettings', - Icon: SettingsIcon, - Component: GeneralSettings, - color: '#667EEA', - descriptionI18nKey: 'generalSettingsDescription', - testID: SettingsSelectors.generalButton - }, - { - slug: 'synchronization', - titleI18nKey: 'synchronization', - Icon: SyncIcon, - Component: SyncSettings, - color: '#7ED9A7', - descriptionI18nKey: 'synchronizationSettingsDescription', - testID: SettingsSelectors.synchronizationButton - }, - { - slug: 'address-book', - titleI18nKey: 'addressBook', - Icon: ContactBookIcon, - Component: AddressBook, - color: '#d53f8c', - descriptionI18nKey: 'addressBookDescription', - testID: SettingsSelectors.addressBookButton - }, - { - slug: 'reveal-private-key', - titleI18nKey: 'revealPrivateKey', - Icon: KeyIcon, - Component: RevealPrivateKeys, - color: '#3182CE', - descriptionI18nKey: 'revealPrivateKeyDescription', - testID: SettingsSelectors.revealPrivateKeyButton - }, - { - slug: 'reveal-seed-phrase', - titleI18nKey: 'revealSeedPhrase', - Icon: StickerIcon, - Component: RevealSeedPhrase, - color: '#F6AD55', - descriptionI18nKey: 'revealSeedPhraseDescription', - testID: SettingsSelectors.revealSeedPhraseButton - }, - { - slug: 'dapps', - titleI18nKey: 'authorizedDApps', - Icon: AppsIcon, - Component: DAppSettings, - color: '#9F7AEA', - descriptionI18nKey: 'dAppsDescription', - testID: SettingsSelectors.dAppsButton - }, - { - slug: 'networks', - titleI18nKey: 'networks', - Icon: SignalAltIcon, - Component: NetworksSettings, - color: '#F6C90E', - descriptionI18nKey: 'networksDescription', - testID: SettingsSelectors.networksButton - }, - { - slug: 'advanced-features', - titleI18nKey: 'advancedFeatures', - Icon: AdditionalIcon, - Component: AdvancedFeatures, - color: '#88E0E6', - descriptionI18nKey: 'advancedFeaturesDescription', - testID: SettingsSelectors.advancedFeaturesButton - }, - { - slug: 'accounts-management', - titleI18nKey: 'accountsManagement', - Icon: PeopleIcon, - Component: AccountsManagement, - color: 'teal', - descriptionI18nKey: 'accountsManagementDescription', - testID: SettingsSelectors.accountsManagementButton - }, - { - slug: 'about', - titleI18nKey: 'about', - Icon: ExtensionIcon, - Component: About, - color: '#A0AEC0', - descriptionI18nKey: 'aboutDescription', - testID: SettingsSelectors.aboutButton - }, - { - slug: 'help-and-community', - titleI18nKey: 'helpAndCommunity', - Icon: HelpIcon, - Component: HelpAndCommunity, - color: '#38B2AC', - descriptionI18nKey: 'helpAndCommunityDescription' - } +const DefaultSettingsIconHOC = (Icon: React.FC>) => + memo(() => ); + +const TABS_GROUPS: Tab[][] = [ + [ + { + slug: 'accounts-management', + titleI18nKey: 'accountsManagement', + Icon: memo(() => { + const { id } = useAccount(); + + return ; + }), + Component: AccountsManagement, + testID: SettingsSelectors.accountsManagementButton + } + ], + [ + { + slug: 'general-settings', + titleI18nKey: 'generalSettings', + Icon: DefaultSettingsIconHOC(ManageIcon), + Component: GeneralSettings, + testID: SettingsSelectors.generalButton + }, + { + slug: 'networks', + titleI18nKey: 'networks', + Icon: DefaultSettingsIconHOC(BrowseIcon), + Component: NetworksSettings, + testID: SettingsSelectors.networksButton + }, + { + slug: 'security-and-privacy', + titleI18nKey: 'securityAndPrivacy', + Icon: DefaultSettingsIconHOC(LockIcon), + Component: () =>
TODO: add some content
, + testID: SettingsSelectors.securityAndPrivacyButton + } + ], + [ + { + slug: 'address-book', + titleI18nKey: 'addressBook', + Icon: DefaultSettingsIconHOC(AddressBookIcon), + Component: AddressBook, + testID: SettingsSelectors.addressBookButton + }, + { + slug: 'dapps', + titleI18nKey: 'connectedDApps', + Icon: DefaultSettingsIconHOC(LinkIcon), + Component: DAppSettings, + testID: SettingsSelectors.dAppsButton + }, + { + slug: 'additional-settings', + titleI18nKey: 'advancedFeatures', + Icon: DefaultSettingsIconHOC(AdditionalFeaturesIcon), + Component: AdvancedFeatures, + testID: SettingsSelectors.advancedFeaturesButton + }, + { + slug: 'synchronization', + titleI18nKey: 'templeSync', + Icon: DefaultSettingsIconHOC(RefreshIcon), + Component: SyncSettings, + testID: SettingsSelectors.synchronizationButton + } + ], + [ + { + slug: 'about', + titleI18nKey: 'aboutAndSupport', + Icon: DefaultSettingsIconHOC(InfoIcon), + Component: About, + testID: SettingsSelectors.aboutButton + } + ] ]; +const TABS = TABS_GROUPS.flat(); const Settings = memo(({ tabSlug }) => { const activeTab = useMemo(() => TABS.find(t => t.slug === tabSlug) || null, [tabSlug]); const [headerChildren, setHeaderChildren] = useState(null); + const [extensionModalOpened, openResetExtensionModal, closeResetExtensionModal] = useBooleanState(false); return ( - {!activeTab && } - - - - - } + pageTitle={} + paperClassName="!bg-background" headerChildren={headerChildren} > -
- {activeTab ? ( - - ) : ( -
    - {TABS.map(({ slug, titleI18nKey, descriptionI18nKey, Icon, color, testID }, i) => { - const first = i === 0; - const linkTo = `/settings/${slug}`; - - return ( - -
    -
    -
    - -
    -
    - -
    - - {message => ( -
    - {message} -
    - )} -
    + {extensionModalOpened && } + {activeTab ? ( + + ) : ( +
    + {TABS_GROUPS.map((tabs, i) => ( + + {tabs.map(({ slug, titleI18nKey, Icon, testID }, j) => ( + } + cellName={} + isLast={j === tabs.length - 1} + testID={testID} + > + + + ))} + + ))} - - {message =>

    {message}

    } -
    -
    -
    - - ); - })} -
- )} -
+
+ + + + +
+ + )}
); }); diff --git a/src/app/pages/Settings/reset-extension-modal.tsx b/src/app/pages/Settings/reset-extension-modal.tsx new file mode 100644 index 0000000000..463ab2a3b4 --- /dev/null +++ b/src/app/pages/Settings/reset-extension-modal.tsx @@ -0,0 +1,88 @@ +import React, { memo, useCallback } from 'react'; + +import { Alert, FormField } from 'app/atoms'; +import { + ActionModal, + ActionModalBodyContainer, + ActionModalButton, + ActionModalButtonsContainer +} from 'app/atoms/action-modal'; +import { useTempleBackendActionForm } from 'app/hooks/use-temple-backend-action-form'; +import { DEFAULT_PASSWORD_INPUT_PLACEHOLDER } from 'lib/constants'; +import { T, t } from 'lib/i18n'; +import { useTempleClient } from 'lib/temple/front'; + +import { SettingsSelectors } from './Settings.selectors'; + +interface ResetExtensionModalProps { + onClose: EmptyFn; +} + +interface FormData { + password: string; +} + +export const ResetExtensionModal = memo(({ onClose }) => { + const { resetExtension } = useTempleClient(); + + const handleResetPasswordSubmit = useCallback(({ password }: FormData) => resetExtension(password), [resetExtension]); + + const { register, handleSubmit, errors, formState, onSubmit } = useTempleBackendActionForm( + handleResetPasswordSubmit, + 'password' + ); + const submitting = formState.isSubmitting; + + return ( + +
+ + + +

+ } + /> + + } + labelContainerClassName="text-grey-2" + placeholder={DEFAULT_PASSWORD_INPUT_PLACEHOLDER} + errorCaption={errors.password?.message} + containerClassName="mb-2" + testID={SettingsSelectors.passwordInput} + /> +
+ + + + + + + + + + +
+
+ ); +}); diff --git a/src/app/templates/AccountsManagement/account-already-exists-warning.tsx b/src/app/templates/AccountsManagement/account-already-exists-warning.tsx index 93e8a9a165..806946efb1 100644 --- a/src/app/templates/AccountsManagement/account-already-exists-warning.tsx +++ b/src/app/templates/AccountsManagement/account-already-exists-warning.tsx @@ -6,7 +6,7 @@ import { ActionModalButton, ActionModalButtonsContainer } from 'app/atoms/action-modal'; -import { t } from 'lib/i18n'; +import { T } from 'lib/i18n'; import { DisplayedGroup, StoredAccount } from 'lib/temple/types'; import { useHDGroups } from 'temple/front'; import { getAllGroups } from 'temple/front/accounts-groups'; @@ -25,10 +25,10 @@ export const AccountAlreadyExistsWarning = memo getAllGroups(hdGroups, [oldAccount])[0].name, [hdGroups, oldAccount]); return ( - + } hasCloseButton={false} onClose={onClose}> - - {t('accountAlreadyExistsWarning', [newAccountGroup.name, oldAccountGroupName])} + + @@ -38,7 +38,7 @@ export const AccountAlreadyExistsWarning = memo - Got it + diff --git a/src/app/templates/AdvancedFeatures/index.tsx b/src/app/templates/AdvancedFeatures/index.tsx index e6e21462f0..4850430fd5 100644 --- a/src/app/templates/AdvancedFeatures/index.tsx +++ b/src/app/templates/AdvancedFeatures/index.tsx @@ -5,7 +5,7 @@ import { ReferralLinksSettings } from './referral-links-settings'; export const AdvancedFeatures = memo(() => { return ( -
+
diff --git a/src/app/templates/AdvancedFeatures/partners-promotion-settings.tsx b/src/app/templates/AdvancedFeatures/partners-promotion-settings.tsx index bb64727d4a..5f1bf6baf2 100644 --- a/src/app/templates/AdvancedFeatures/partners-promotion-settings.tsx +++ b/src/app/templates/AdvancedFeatures/partners-promotion-settings.tsx @@ -1,44 +1,50 @@ -import React, { ChangeEvent, FC } from 'react'; +import React, { ChangeEvent, memo, useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { togglePartnersPromotionAction } from 'app/store/partners-promotion/actions'; import { useShouldShowPartnersPromoSelector } from 'app/store/partners-promotion/selectors'; -import { T, t } from 'lib/i18n'; -import { useConfirm } from 'lib/ui/dialog'; +import { T } from 'lib/i18n'; +import { useAlert, useConfirm } from 'lib/ui/dialog'; -import { EnablingSetting } from '../EnablingSetting'; -import { SettingsGeneralSelectors } from '../SettingsGeneral/selectors'; +import { EnablingSetting } from '../enabling-setting'; -export const PartnersPromotionSettings: FC = () => { +import { AdvancedFeaturesSelectors } from './selectors'; + +export const PartnersPromotionSettings = memo(() => { const dispatch = useDispatch(); + const alert = useAlert(); const confirm = useConfirm(); const shouldShowPartnersPromo = useShouldShowPartnersPromoSelector(); - const handleHidePromotion = async (toChecked: boolean) => { - const confirmed = await confirm({ - title: t('closePartnersPromotion'), - children: t('closePartnersPromoConfirm'), - comfirmButtonText: t('disable') - }); + const handleHidePromotion = useCallback( + async (toChecked: boolean) => { + const confirmed = await confirm({ + title: , + description: , + confirmButtonText: ( + + + + ), + hasCloseButton: false + }); - if (confirmed) { - dispatch(togglePartnersPromotionAction(toChecked)); - } - }; - - const handleShowPromotion = async (toChecked: boolean) => { - const confirmed = await confirm({ - title: t('enablePartnersPromotionConfirm'), - children: t('enablePartnersPromotionDescriptionConfirm'), - comfirmButtonText: t('enable') - }); + if (confirmed) { + dispatch(togglePartnersPromotionAction(toChecked)); + } + }, + [confirm, dispatch] + ); - if (confirmed) { + const handleShowPromotion = useCallback( + async (toChecked: boolean) => { dispatch(togglePartnersPromotionAction(toChecked)); - } - }; + alert({ title: , description: }); + }, + [alert, dispatch] + ); const togglePartnersPromotion = (toChecked: boolean, event: ChangeEvent) => { event?.preventDefault(); @@ -49,15 +55,10 @@ export const PartnersPromotionSettings: FC = () => { return ( - - - } + description={} enabled={shouldShowPartnersPromo} onChange={togglePartnersPromotion} - testID={SettingsGeneralSelectors.partnersPromotion} + testID={AdvancedFeaturesSelectors.partnersPromotionToggle} /> ); -}; +}); diff --git a/src/app/templates/AdvancedFeatures/referral-links-settings.tsx b/src/app/templates/AdvancedFeatures/referral-links-settings.tsx index 0e219d1d53..e7e656864a 100644 --- a/src/app/templates/AdvancedFeatures/referral-links-settings.tsx +++ b/src/app/templates/AdvancedFeatures/referral-links-settings.tsx @@ -15,7 +15,7 @@ import { t, T } from 'lib/i18n'; import { putToStorage } from 'lib/storage'; import { useConfirm } from 'lib/ui/dialog'; -import { EnablingSetting } from '../EnablingSetting'; +import { EnablingSetting } from '../enabling-setting'; import { AdvancedFeaturesSelectors } from './selectors'; @@ -38,6 +38,7 @@ export const ReferralLinksSettings = memo(() => { substitutions={[ { , { ]} /> ), - comfirmButtonText: t('agreeAndContinue') + confirmButtonText: t('agreeAndContinue') }); if (!confirmed) { @@ -73,10 +75,10 @@ export const ReferralLinksSettings = memo(() => { return ( } enabled={referralLinksEnabled} onChange={toggleReferralLinks} - testID={AdvancedFeaturesSelectors.referralLinksCheckbox} + testID={AdvancedFeaturesSelectors.referralLinksToggle} /> ); }); diff --git a/src/app/templates/AdvancedFeatures/selectors.ts b/src/app/templates/AdvancedFeatures/selectors.ts index b511db8540..83d7347f38 100644 --- a/src/app/templates/AdvancedFeatures/selectors.ts +++ b/src/app/templates/AdvancedFeatures/selectors.ts @@ -1,3 +1,4 @@ export enum AdvancedFeaturesSelectors { - referralLinksCheckbox = 'Advanced Features/Referral Links Checkbox' + referralLinksToggle = 'Advanced Features/Referral Links Toggle', + partnersPromotionToggle = 'Advanced Features/Partners Promotion Toggle' } diff --git a/src/app/templates/AlertModal.tsx b/src/app/templates/AlertModal.tsx index 21c0b7e5df..cf39517805 100644 --- a/src/app/templates/AlertModal.tsx +++ b/src/app/templates/AlertModal.tsx @@ -1,26 +1,24 @@ -import React, { FC } from 'react'; +import React, { memo } from 'react'; -import { FormSubmitButton } from 'app/atoms'; -import ModalWithTitle, { ModalWithTitleProps } from 'app/templates/ModalWithTitle'; -import { t } from 'lib/i18n'; +import { ActionModal, ActionModalButton, ActionModalButtonsContainer, ActionModalProps } from 'app/atoms/action-modal'; +import { T } from 'lib/i18n'; -export type AlertModalProps = ModalWithTitleProps; +import { DialogBody } from './DialogBody'; -const AlertModal: FC = props => { - const { onRequestClose, children, ...restProps } = props; +export interface AlertModalProps extends ActionModalProps { + description?: ActionModalProps['children']; + isOpen: boolean; +} - return ( - -
-
{children}
-
- - {t('ok')} - -
-
-
- ); -}; - -export default AlertModal; +export const AlertModal = memo(({ children, description, isOpen, onClose, ...restProps }) => + isOpen ? ( + + {children} + + + + + + + ) : null +); diff --git a/src/app/templates/ConfirmationModal/ConfirmationModal.tsx b/src/app/templates/ConfirmationModal/ConfirmationModal.tsx index 11568d6ef6..db5b587b59 100644 --- a/src/app/templates/ConfirmationModal/ConfirmationModal.tsx +++ b/src/app/templates/ConfirmationModal/ConfirmationModal.tsx @@ -1,52 +1,55 @@ -import React, { FC } from 'react'; +import React, { ReactNode, memo } from 'react'; -import clsx from 'clsx'; - -import { FormSubmitButton, FormSecondaryButton } from 'app/atoms'; -import ModalWithTitle, { ModalWithTitleProps } from 'app/templates/ModalWithTitle'; +import { ActionModal, ActionModalButton, ActionModalButtonsContainer, ActionModalProps } from 'app/atoms/action-modal'; import { T } from 'lib/i18n'; +import { StyledButtonColor } from 'lib/ui/button-like-styles'; + +import { DialogBody } from '../DialogBody'; import { ConfirmatonModalSelectors } from './ConfirmatonModal.selectors'; -export interface ConfirmationModalProps extends ModalWithTitleProps { - onConfirm: () => void; - comfirmButtonText?: string; - stretchButtons?: boolean; +export interface ConfirmationModalProps extends ActionModalProps { + description?: ActionModalProps['children']; + isOpen: boolean; + confirmButtonText?: ReactNode; + confirmButtonColor?: StyledButtonColor; + onConfirm: EmptyFn; } -const ConfirmationModal: FC = props => { - const { onRequestClose, children, onConfirm, comfirmButtonText, stretchButtons, ...restProps } = props; - - return ( - - <> -
{children}
- -
- ( + ({ + onClose, + isOpen, + children, + description, + onConfirm, + confirmButtonText, + confirmButtonColor = 'primary', + ...restProps + }) => + isOpen ? ( + + {children} + + + - + - - {comfirmButtonText ?? } - -
- -
- ); -}; - -export default ConfirmationModal; + {confirmButtonText ?? } + + + + ) : null +); diff --git a/src/app/templates/DAppSettings/DAppSettings.tsx b/src/app/templates/DAppSettings/DAppSettings.tsx index 572b90ccee..c76ce8c335 100644 --- a/src/app/templates/DAppSettings/DAppSettings.tsx +++ b/src/app/templates/DAppSettings/DAppSettings.tsx @@ -91,7 +91,7 @@ const DAppSettings: FC = () => { <>

- +

diff --git a/src/app/templates/DialogBody.tsx b/src/app/templates/DialogBody.tsx new file mode 100644 index 0000000000..e44078ae91 --- /dev/null +++ b/src/app/templates/DialogBody.tsx @@ -0,0 +1,14 @@ +import React, { FC, ReactNode } from 'react'; + +import { ActionModalBodyContainer } from 'app/atoms/action-modal'; + +interface DialogBodyProps { + description?: ReactNode | ReactNode[]; +} + +export const DialogBody: FC> = ({ children, description }) => ( + + {description &&

{description}

} + {children} +
+); diff --git a/src/app/templates/EnablingSetting.tsx b/src/app/templates/EnablingSetting.tsx deleted file mode 100644 index 0816bb26a9..0000000000 --- a/src/app/templates/EnablingSetting.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; - -import { FormCheckboxProps, FormCheckbox } from 'app/atoms'; -import { T, TID, t, ReactSubstitutions } from 'lib/i18n'; - -interface Props extends Pick { - titleI18nKey: TID; - titleSubstituions?: ReactSubstitutions; - descriptionI18nKey: TID; - descriptionSubstitutions?: ReactSubstitutions; - enabled?: boolean; -} - -export const EnablingSetting = ({ - titleI18nKey, - titleSubstituions, - descriptionI18nKey, - descriptionSubstitutions, - enabled, - onChange, - testID, - errorCaption -}: Props) => ( - <> -
- - - - - - - -
- - - -); diff --git a/src/app/templates/HelpAndCommunity/ResourceLink.tsx b/src/app/templates/HelpAndCommunity/ResourceLink.tsx deleted file mode 100644 index 67845d4e8a..0000000000 --- a/src/app/templates/HelpAndCommunity/ResourceLink.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import React, { FC, SVGProps } from 'react'; - -import { Anchor } from 'app/atoms/Anchor'; -import { TestIDProps } from 'lib/analytics'; - -interface Props extends TestIDProps { - title: string; - href: string; - background?: string; - Icon: React.FC>; -} - -export const ResourceLink: FC = ({ title, href, background, Icon, testID, testIDProperties }) => { - return ( -
  • - -
    - -
    - {title} -
    -
  • - ); -}; diff --git a/src/app/templates/HelpAndCommunity/index.tsx b/src/app/templates/HelpAndCommunity/index.tsx deleted file mode 100644 index 8584a5cb2d..0000000000 --- a/src/app/templates/HelpAndCommunity/index.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import React, { FC, useMemo } from 'react'; - -import { ReactComponent as CannyIcon } from 'app/icons/canny.svg'; -import { ReactComponent as DiscordIcon } from 'app/icons/discord.svg'; -import { ReactComponent as HelpCrunchIcon } from 'app/icons/helpcrunch.svg'; -import { ReactComponent as RedditIcon } from 'app/icons/reddit.svg'; -import { ReactComponent as TelegramIcon } from 'app/icons/telegram.svg'; -import { ReactComponent as TwitterIcon } from 'app/icons/twitter.svg'; -import { ReactComponent as YoutubeIcon } from 'app/icons/youtube.svg'; -import { T } from 'lib/i18n'; - -import { ResourceLink } from './ResourceLink'; -import { HelpAndCommunitySelectors } from './selectors'; - -const HelpAndCommunity: FC = () => { - const generalLinks = useMemo( - () => [ - { - title: 'Knowledge Base', - href: 'https://madfish.crunch.help/temple-wallet', - background: '#2182f7', - Icon: HelpCrunchIcon, - testID: HelpAndCommunitySelectors.knowledgeBaseLinkButton - }, - { - title: 'Feature Request', - href: 'https://madfish.canny.io/feature-requests', - Icon: CannyIcon, - testID: HelpAndCommunitySelectors.featureRequestLinkButton - } - ], - [] - ); - - const socialMediaLinks = useMemo( - () => [ - { - title: 'Twitter', - href: 'https://twitter.com/madfishofficial', - background: '#1DA1F2', - Icon: TwitterIcon - }, - { - title: 'Telegram', - href: 'https://t.me/MadFishCommunity', - background: '#26A5E4', - Icon: TelegramIcon - }, - { - title: 'Discord', - href: 'https://www.madfish.solutions/discord', - background: '#7289DA', - Icon: DiscordIcon - }, - { - title: 'Reddit', - href: 'https://www.reddit.com/r/MadFishCommunity', - background: '#FF4500', - Icon: RedditIcon - }, - { - title: 'Youtube', - href: 'https://www.youtube.com/channel/UCUp80EXfJEigks3xU5hiwyA', - background: '#FF0000', - Icon: YoutubeIcon - } - ], - [] - ); - - return ( -
    -

    - -

    - -
      - {generalLinks.map(({ title, ...props }) => ( - - ))} - {socialMediaLinks.map(({ title, ...props }) => ( - - ))} -
    - -

    - -

    -
    - ); -}; - -export default HelpAndCommunity; diff --git a/src/app/templates/HelpAndCommunity/selectors.ts b/src/app/templates/HelpAndCommunity/selectors.ts deleted file mode 100644 index 567dd1e161..0000000000 --- a/src/app/templates/HelpAndCommunity/selectors.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum HelpAndCommunitySelectors { - knowledgeBaseLinkButton = 'Help & Community/Knowledge Base Link Button', - featureRequestLinkButton = 'Help & Community/Feature Request Link Button', - socialMediaLinkButton = 'Help & Community/Social Media Link Button' -} diff --git a/src/app/templates/ModalWithTitle.tsx b/src/app/templates/ModalWithTitle.tsx index a7767f08a1..e8bd057bcc 100644 --- a/src/app/templates/ModalWithTitle.tsx +++ b/src/app/templates/ModalWithTitle.tsx @@ -5,7 +5,7 @@ import clsx from 'clsx'; import CustomModal, { CustomModalProps } from 'app/atoms/CustomModal'; import { useAppEnv } from 'app/env'; -export interface ModalWithTitleProps extends CustomModalProps { +interface ModalWithTitleProps extends CustomModalProps { title?: ReactNode; titleClassName?: string; description?: ReactNode; diff --git a/src/app/templates/RevealSecrets/PasswordForRevealField.tsx b/src/app/templates/RevealSecrets/PasswordForRevealField.tsx deleted file mode 100644 index d54bd7c8ed..0000000000 --- a/src/app/templates/RevealSecrets/PasswordForRevealField.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import React, { memo, useRef, useCallback, useLayoutEffect } from 'react'; - -import { OnSubmit, useForm } from 'react-hook-form'; - -import { FormField, FormSubmitButton } from 'app/atoms'; -import { DEFAULT_PASSWORD_INPUT_PLACEHOLDER } from 'lib/constants'; -import { TID, T, t } from 'lib/i18n'; - -import { RevealSecretsSelectors } from './RevealSecrets.selectors'; - -interface Props { - labelDescriptionForName: TID; - onSubmit: (password: string) => Promise; -} - -const SUBMIT_ERROR_TYPE = 'submit-error'; - -interface FormData { - password: string; -} - -export const PasswordForRevealField = memo(({ labelDescriptionForName, onSubmit }) => { - const { register, handleSubmit, errors, setError, clearError, formState } = useForm(); - const submitting = formState.isSubmitting; - - const formRef = useRef(null); - - const focusPasswordField = useCallback(() => { - formRef.current?.querySelector("input[name='password']")?.focus(); - }, []); - - useLayoutEffect(() => { - focusPasswordField(); - }, [focusPasswordField]); - - const onSubmitLocal = useCallback>( - ({ password }) => { - if (submitting) return; - - clearError('password'); - - onSubmit(password).catch(err => { - console.error(err); - - setError('password', SUBMIT_ERROR_TYPE, err.message); - focusPasswordField(); - }); - }, - [onSubmit, submitting, clearError, setError, focusPasswordField] - ); - - return ( -
    - clearError()} - testID={RevealSecretsSelectors.RevealPasswordInput} - /> - - - - - - ); -}); diff --git a/src/app/templates/RevealSecrets/RevealPrivateKeys.tsx b/src/app/templates/RevealSecrets/RevealPrivateKeys.tsx deleted file mode 100644 index 9e809dcc2f..0000000000 --- a/src/app/templates/RevealSecrets/RevealPrivateKeys.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import React, { FC, memo, useCallback, useMemo } from 'react'; - -import clsx from 'clsx'; - -import { Alert } from 'app/atoms'; -import { getAccountBadgeTitle } from 'app/defaults'; -import AccountBanner from 'app/templates/AccountBanner'; -import { T, t } from 'lib/i18n'; -import { useTempleClient } from 'lib/temple/front'; -import { TempleAccountType } from 'lib/temple/types'; -import { useDidUpdate, useVanishingState } from 'lib/ui/hooks'; -import { AccountForChain } from 'temple/accounts'; -import { useAccountForEvm, useAccountForTezos } from 'temple/front'; -import { TempleChainTitle } from 'temple/types'; - -import { PasswordForRevealField } from './PasswordForRevealField'; -import { SecretField } from './SecretField'; - -export const RevealPrivateKeys = memo(() => { - const accForTezos = useAccountForTezos(); - const accForEvm = useAccountForEvm(); - - return ( - <> - {accForTezos ? : null} - {accForEvm ? : null} - - ); -}); - -interface RevealForChainProps { - account: AccountForChain; -} - -const RevealForChain: FC = ({ account }) => { - const { chain, address } = account; - - const { revealPrivateKey } = useTempleClient(); - - const [secret, setSecret] = useVanishingState(); - - // eslint-disable-next-line react-hooks/exhaustive-deps - useDidUpdate(() => void setSecret(null), [account.id, setSecret]); - - const onPasswordSubmit = useCallback( - async (password: string) => revealPrivateKey(address, password).then(scrt => void setSecret(scrt)), - [address, setSecret, revealPrivateKey] - ); - - const mainContent = useMemo(() => { - const forbidRevealing = [ - TempleAccountType.Ledger, - TempleAccountType.ManagedKT, - TempleAccountType.WatchOnly - ].includes(account.type); - - if (forbidRevealing) { - return ( - - - {getAccountBadgeTitle(account.type)} - - ]} - /> -

    - } - className="my-4" - /> - ); - } - - if (secret) return ; - - return ; - }, [account.type, secret, onPasswordSubmit]); - - return ( -
    - - - {account.derivationPath && ( -
    - - -
    - )} - - {mainContent} -
    - ); -}; diff --git a/src/app/templates/RevealSecrets/RevealSecrets.selectors.ts b/src/app/templates/RevealSecrets/RevealSecrets.selectors.ts deleted file mode 100644 index 96fa8582e8..0000000000 --- a/src/app/templates/RevealSecrets/RevealSecrets.selectors.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum RevealSecretsSelectors { - RevealButton = 'Reveal Secrets/Reveal Button', - RevealPasswordInput = 'Reveal Secrets/Reveal Password Input', - RevealSecretsProtectedMask = 'Reveal Secrets/Reveal Secrets Protected Mask', - RevealSecretsValue = 'Reveal Secrets/Reveal Secrets Value' -} diff --git a/src/app/templates/RevealSecrets/RevealSeedPhrase.tsx b/src/app/templates/RevealSecrets/RevealSeedPhrase.tsx deleted file mode 100644 index 5975942781..0000000000 --- a/src/app/templates/RevealSecrets/RevealSeedPhrase.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import React, { memo, useCallback } from 'react'; - -import { T } from 'lib/i18n'; -import { useTempleClient } from 'lib/temple/front'; -import { StoredHDAccount, TempleAccountType } from 'lib/temple/types'; -import { useDidUpdate, useVanishingState } from 'lib/ui/hooks'; -import { useAccount, useAllAccounts } from 'temple/front'; - -import { PasswordForRevealField } from './PasswordForRevealField'; -import { SecretField } from './SecretField'; - -export const RevealSeedPhrase = memo(() => { - const { revealMnemonic } = useTempleClient(); - - const allAccounts = useAllAccounts(); - const currentAccount = useAccount(); - const walletId = - currentAccount.type === TempleAccountType.HD - ? currentAccount.walletId - : allAccounts.find((acc): acc is StoredHDAccount => acc.type === TempleAccountType.HD)!.walletId; - - const [secret, setSecret] = useVanishingState(); - - // eslint-disable-next-line react-hooks/exhaustive-deps - useDidUpdate(() => void setSecret(null), [currentAccount.id, setSecret]); - - const onPasswordSubmit = useCallback( - async (password: string) => revealMnemonic(walletId, password).then(scrt => void setSecret(scrt)), - [revealMnemonic, walletId, setSecret] - ); - - return ( -
    - - - {secret ? ( - - ) : ( - - )} -
    - ); -}); - -const DerivationPathBanner = memo(() => ( -
    -

    - - - - - - - -

    - -

    Tezos:

    - -
    - - - -
    - -

    EVM:

    - -
    - {`m/44'/60'/0'/0/`} -
    -
    -)); diff --git a/src/app/templates/RevealSecrets/SecretField.tsx b/src/app/templates/RevealSecrets/SecretField.tsx deleted file mode 100644 index 6f22097c32..0000000000 --- a/src/app/templates/RevealSecrets/SecretField.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import React, { FC, useMemo } from 'react'; - -import { Alert } from 'app/atoms/Alert'; -import { ReadOnlySecretField } from 'app/atoms/ReadOnlySecretField'; -import { TID, T } from 'lib/i18n'; -import { SPACE_CHAR } from 'lib/ui/utils'; - -import { RevealSecretsSelectors } from './RevealSecrets.selectors'; - -interface Props { - revealType: 'private-key' | 'seed-phrase'; - value: string; -} - -interface Texts { - title: TID; - description: React.ReactNode; - attention: TID; -} - -export const SecretField: FC = ({ revealType, value }) => { - const texts = useMemo(() => { - switch (revealType) { - case 'private-key': - return { - title: 'privateKey', - description: , - attention: 'doNotSharePrivateKey' - }; - - case 'seed-phrase': - return { - title: 'seedPhrase', - description: ( - <> - - {SPACE_CHAR} - - - ), - attention: 'doNotSharePhrase' - }; - } - }, [revealType]); - - return ( - <> - - - } - description={ -

    - -

    - } - className="my-4" - /> - - ); -}; diff --git a/src/app/templates/RevealSecrets/index.ts b/src/app/templates/RevealSecrets/index.ts deleted file mode 100644 index 5d84754fe3..0000000000 --- a/src/app/templates/RevealSecrets/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { RevealSeedPhrase } from './RevealSeedPhrase'; -export { RevealPrivateKeys } from './RevealPrivateKeys'; diff --git a/src/app/templates/SettingsGeneral/Components/AnalyticsSettings.tsx b/src/app/templates/SettingsGeneral/Components/AnalyticsSettings.tsx deleted file mode 100644 index 8c14099ece..0000000000 --- a/src/app/templates/SettingsGeneral/Components/AnalyticsSettings.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react'; - -import { useDispatch } from 'react-redux'; - -import { setIsAnalyticsEnabledAction } from 'app/store/settings/actions'; -import { useAnalyticsEnabledSelector } from 'app/store/settings/selectors'; -import { EnablingSetting } from 'app/templates/EnablingSetting'; - -import { SettingsGeneralSelectors } from '../selectors'; - -const AnalyticsSettings: React.FC = () => { - const dispatch = useDispatch(); - const analyticsEnabled = useAnalyticsEnabledSelector(); - - const setAnalyticsEnabled = () => dispatch(setIsAnalyticsEnabledAction(!analyticsEnabled)); - - return ( - - ); -}; - -export default AnalyticsSettings; diff --git a/src/app/templates/SettingsGeneral/Components/FiatCurrencySelect.tsx b/src/app/templates/SettingsGeneral/Components/FiatCurrencySelect.tsx deleted file mode 100644 index 64ca574954..0000000000 --- a/src/app/templates/SettingsGeneral/Components/FiatCurrencySelect.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import React, { useCallback, FC, useState, useMemo } from 'react'; - -import classNames from 'clsx'; - -import { DropdownSelect } from 'app/templates/DropdownSelect/DropdownSelect'; -import { InputContainer } from 'app/templates/InputContainer/InputContainer'; -import { AnalyticsEventCategory, AnalyticsEventEnum, setTestID, useAnalytics } from 'lib/analytics'; -import { FIAT_CURRENCIES, FiatCurrencyOption, useFiatCurrency } from 'lib/fiat-currency'; -import { T } from 'lib/i18n'; -import { searchAndFilterItems } from 'lib/utils/search-items'; - -import { SettingsGeneralSelectors } from '../selectors'; - -const renderOptionContent = (option: FiatCurrencyOption, isSelected: boolean) => ( - -); - -const FiatCurrencySelect: FC = () => { - const { trackEvent } = useAnalytics(); - const { selectedFiatCurrency, setSelectedFiatCurrency } = useFiatCurrency(); - - const value = selectedFiatCurrency; - - const [searchValue, setSearchValue] = useState(''); - - const options = useMemo>( - () => - searchAndFilterItems( - FIAT_CURRENCIES, - searchValue, - [ - { name: 'name', weight: 1 }, - { name: 'fullname', weight: 0.75 } - ], - null, - 0.25 - ), - [searchValue] - ); - - const handleFiatCurrencyChange = useCallback( - (fiatOption: FiatCurrencyOption) => { - trackEvent(AnalyticsEventEnum.FiatCurrencyChanged, AnalyticsEventCategory.ButtonPress, { - name: fiatOption.name - }); - setSelectedFiatCurrency(fiatOption); - }, - [setSelectedFiatCurrency, trackEvent] - ); - - return ( - }> - } - optionsProps={{ - options, - noItemsText: 'No items', - getKey: option => option.fullname, - renderOptionContent: option => renderOptionContent(option, option.fullname === selectedFiatCurrency.fullname), - onOptionChange: handleFiatCurrencyChange - }} - searchProps={{ - searchValue, - onSearchChange: event => setSearchValue(event.target.value) - }} - /> - - ); -}; - -export default FiatCurrencySelect; - -const FiatCurrencyTitle: FC = () => ( -

    - - - -

    -); - -interface FiatCurrencyOptionContentProps { - option: FiatCurrencyOption; - isSelected?: boolean; -} - -const FiatCurrencyIcon: FC = ({ option: { symbol } }) => ( -
    - {symbol} -
    -); - -const FiatCurrencyFieldContent: FC = ({ option }) => { - return ( -
    - - - {option.name} -
    - ); -}; - -const FiatCurrencyOptionContent: FC = ({ option, isSelected }) => { - return ( -
    - - -
    - {option.name} ({option.fullname}) -
    -
    - ); -}; diff --git a/src/app/templates/SettingsGeneral/Components/LocaleSelect.tsx b/src/app/templates/SettingsGeneral/Components/LocaleSelect.tsx deleted file mode 100644 index a7587092e9..0000000000 --- a/src/app/templates/SettingsGeneral/Components/LocaleSelect.tsx +++ /dev/null @@ -1,205 +0,0 @@ -import React, { useMemo, useCallback, FC, useState } from 'react'; - -import classNames from 'clsx'; -import browser from 'webextension-polyfill'; - -import Flag from 'app/atoms/Flag'; -import { DropdownSelect } from 'app/templates/DropdownSelect/DropdownSelect'; -import { InputContainer } from 'app/templates/InputContainer/InputContainer'; -import { AnalyticsEventCategory, AnalyticsEventEnum, setTestID, useAnalytics } from 'lib/analytics'; -import { getCurrentLocale, updateLocale, T } from 'lib/i18n'; -import { searchAndFilterItems } from 'lib/utils/search-items'; - -import { SettingsGeneralSelectors } from '../selectors'; - -type LocaleOption = { - code: string; - disabled: boolean; - flagName: string; - label: string; -}; - -const LOCALE_OPTIONS: LocaleOption[] = [ - { - code: 'en', - flagName: 'us', - label: 'English', - disabled: false - }, - { - code: 'en_GB', - flagName: 'gb', - label: 'English ‒ United Kingdom', - disabled: false - }, - { - code: 'fr', - flagName: 'fr', - label: 'French (Français)', - disabled: false - }, - { - code: 'de', - flagName: 'de', - label: 'German (Deutsch)', - disabled: false - }, - { - code: 'zh_CN', - flagName: 'cn', - label: 'Chinese ‒ Simplified (简体中文)', - disabled: false - }, - { - code: 'zh_TW', - flagName: 'tw', - label: 'Chinese ‒ Traditional (繁體中文)', - disabled: false - }, - { - code: 'ja', - flagName: 'jp', - label: 'Japanese (日本語)', - disabled: false - }, - { - code: 'ko', - flagName: 'kr', - label: 'Korean', - disabled: false - }, - { - code: 'uk', - flagName: 'ua', - label: 'Ukrainian (Українська)', - disabled: false - }, - { - code: 'tr', - flagName: 'tr', - label: 'Turkish (Türk)', - disabled: false - }, - { - code: 'pt', - flagName: 'pt', - label: 'Portuguese (Português)', - disabled: false - }, - // Disabled - { - code: 'ru', - flagName: 'ru', - label: 'Russian (Русский)', - disabled: true - } -]; - -const LocaleSelect: FC = () => { - const selectedLocale = getCurrentLocale(); - const { trackEvent } = useAnalytics(); - const [searchValue, setSearchValue] = useState(''); - - const options = useMemo( - () => - searchAndFilterItems(LOCALE_OPTIONS, searchValue, [ - { name: 'code', weight: 0.75 }, - { name: 'flagName', weight: 1 }, - { name: 'label', weight: 0.5 } - ]), - [searchValue] - ); - - const value = useMemo( - () => options.find(({ code }) => code === selectedLocale) ?? LOCALE_OPTIONS[0], - [selectedLocale] - ); - - const handleLocaleChange = useCallback( - ({ code }: LocaleOption) => { - trackEvent(AnalyticsEventEnum.LanguageChanged, AnalyticsEventCategory.ButtonPress, { code }); - updateLocale(code); - }, - [trackEvent] - ); - - return ( - }> - } - optionsProps={{ - options, - noItemsText: 'No items', - getKey: option => option.code, - renderOptionContent: option => renderOptionContent(option, option.code === value.code), - onOptionChange: handleLocaleChange - }} - searchProps={{ - searchValue, - onSearchChange: event => setSearchValue(event?.target.value) - }} - /> - - ); -}; - -export default LocaleSelect; - -const LocaleTitle: FC = () => ( -

    - - - -

    -); - -interface LocaleOptionContentProps { - option: LocaleOption; - isSelected?: boolean; -} - -const LocaleIcon: FC = ({ option: { flagName, code } }) => ( - -); - -const LocaleFieldContent = (option: LocaleOption) => ( -
    - - - {option.label} -
    -); - -const LocaleOptionContent: FC = ({ option, isSelected }) => { - return ( -
    - - -
    - {option.label} - - {option.disabled && ( -
    -
    - -
    -
    - )} -
    -
    - ); -}; - -const renderOptionContent = (option: LocaleOption, isSelected: boolean) => ( - -); diff --git a/src/app/templates/SettingsGeneral/Components/LockUpSettings.tsx b/src/app/templates/SettingsGeneral/Components/LockUpSettings.tsx deleted file mode 100644 index fd5ae4a912..0000000000 --- a/src/app/templates/SettingsGeneral/Components/LockUpSettings.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React, { FC } from 'react'; - -import { EnablingSetting } from 'app/templates/EnablingSetting'; -import { useIsLockUpEnabled } from 'lib/lock-up'; - -import { SettingsGeneralSelectors } from '../selectors'; - -const LockUpSettings: FC<{}> = () => { - const [isLockUpEnabled, saveIsLockUpEnabled] = useIsLockUpEnabled(); - - return ( - - ); -}; - -export default LockUpSettings; diff --git a/src/app/templates/SettingsGeneral/Components/PopupSettings.tsx b/src/app/templates/SettingsGeneral/Components/PopupSettings.tsx deleted file mode 100644 index 133f12ad45..0000000000 --- a/src/app/templates/SettingsGeneral/Components/PopupSettings.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, { FC, useCallback, useRef, useState } from 'react'; - -import { EnablingSetting } from 'app/templates/EnablingSetting'; -import { isPopupModeEnabled, setPopupMode } from 'lib/popup-mode'; - -import { SettingsGeneralSelectors } from '../selectors'; - -const PopupSettings: FC<{}> = () => { - const popupEnabled = isPopupModeEnabled(); - const changingRef = useRef(false); - const [error, setError] = useState(null); - - const handlePopupModeChange = useCallback( - (checked: boolean) => { - if (changingRef.current) return; - changingRef.current = true; - setError(null); - - setPopupMode(checked); - changingRef.current = false; - window.location.reload(); - }, - [setError] - ); - - return ( - - ); -}; - -export default PopupSettings; diff --git a/src/app/templates/SettingsGeneral/components/fiat-currency-select/currency-icon.tsx b/src/app/templates/SettingsGeneral/components/fiat-currency-select/currency-icon.tsx new file mode 100644 index 0000000000..7e2469140a --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/fiat-currency-select/currency-icon.tsx @@ -0,0 +1,11 @@ +import React, { memo } from 'react'; + +import { FiatCurrencyOption } from 'lib/fiat-currency'; + +import { CellPartProps } from '../select-with-modal'; + +export const CurrencyIcon = memo>(({ option: { symbol } }) => ( +
    + {symbol} +
    +)); diff --git a/src/app/templates/SettingsGeneral/components/fiat-currency-select/index.tsx b/src/app/templates/SettingsGeneral/components/fiat-currency-select/index.tsx new file mode 100644 index 0000000000..fc310a5e9b --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/fiat-currency-select/index.tsx @@ -0,0 +1,71 @@ +import React, { memo, useCallback, useMemo } from 'react'; + +import { AnalyticsEventCategory, AnalyticsEventEnum, useAnalytics } from 'lib/analytics'; +import { + FIAT_CURRENCIES_BASE, + FiatCurrencyOption, + FiatCurrenciesEnum, + FiatCurrencyOptionBase, + useFiatCurrency +} from 'lib/fiat-currency'; +import { t } from 'lib/i18n'; + +import { SettingsGeneralSelectors } from '../../selectors'; +import { CellPartProps, SelectWithModal } from '../select-with-modal'; + +import { CurrencyIcon } from './currency-icon'; + +const searchKeys = [ + { name: 'name', weight: 1 }, + { name: 'fullname', weight: 0.75 } +]; + +const currencyOptionKeyFn = ({ name }: FiatCurrencyOption) => name; + +const CellName = ({ option: { fullname } }: CellPartProps) => {fullname}; + +const makeOptionWithFullName = (option: FiatCurrencyOptionBase) => { + const keyPrefix = option.name.toLowerCase() as Lowercase; + + return { + ...option, + fullname: t(`${keyPrefix}Name`) + }; +}; + +export const FiatCurrencySelect = memo(() => { + const { selectedFiatCurrency, setSelectedFiatCurrency } = useFiatCurrency(); + const { trackEvent } = useAnalytics(); + + const options = useMemo(() => FIAT_CURRENCIES_BASE.map(makeOptionWithFullName), []); + const value = useMemo( + () => + options.find(({ name }) => name === selectedFiatCurrency.name) ?? makeOptionWithFullName(FIAT_CURRENCIES_BASE[0]), + [options, selectedFiatCurrency.name] + ); + + const handleCurrencyChange = useCallback( + (option: FiatCurrencyOption) => { + trackEvent(AnalyticsEventEnum.FiatCurrencyChanged, AnalyticsEventCategory.ButtonPress, { name: option.name }); + setSelectedFiatCurrency(option); + }, + [setSelectedFiatCurrency, trackEvent] + ); + + return ( + + ); +}); diff --git a/src/app/templates/SettingsGeneral/components/locale-select/index.tsx b/src/app/templates/SettingsGeneral/components/locale-select/index.tsx new file mode 100644 index 0000000000..5c41549fa5 --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/locale-select/index.tsx @@ -0,0 +1,56 @@ +import React, { memo, useCallback, useMemo } from 'react'; + +import { AnalyticsEventCategory, AnalyticsEventEnum, useAnalytics } from 'lib/analytics'; +import { getCurrentLocale, t, updateLocale } from 'lib/i18n'; + +import { SettingsGeneralSelectors } from '../../selectors'; +import { CellPartProps, SelectWithModal } from '../select-with-modal'; + +import { LocaleIcon } from './locale-icon'; +import { LOCALE_OPTIONS, LocaleOption } from './options'; + +const searchKeys = [ + { name: 'code', weight: 0.75 }, + { name: 'flagName', weight: 1 }, + { name: 'label', weight: 0.5 } +]; + +const localeOptionKeyFn = ({ code }: LocaleOption) => code; + +const CellName = ({ option: { label } }: CellPartProps<{ label: string }>) => {label}; + +const makeOptionWithLabel = (option: LocaleOption) => ({ ...option, label: t(`${option.code}LangName`) }); + +export const LocaleSelect = memo(() => { + const selectedLocale = getCurrentLocale(); + const { trackEvent } = useAnalytics(); + + const options = useMemo(() => LOCALE_OPTIONS.map(makeOptionWithLabel), []); + const value = useMemo( + () => options.find(({ code }) => code === selectedLocale) ?? makeOptionWithLabel(LOCALE_OPTIONS[0]), + [options, selectedLocale] + ); + + const handleLocaleChange = useCallback( + ({ code }: LocaleOption) => { + trackEvent(AnalyticsEventEnum.LanguageChanged, AnalyticsEventCategory.ButtonPress, { code }); + updateLocale(code); + }, + [trackEvent] + ); + + return ( + + ); +}); diff --git a/src/app/templates/SettingsGeneral/components/locale-select/locale-icon.tsx b/src/app/templates/SettingsGeneral/components/locale-select/locale-icon.tsx new file mode 100644 index 0000000000..7a9aa70931 --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/locale-select/locale-icon.tsx @@ -0,0 +1,13 @@ +import React, { memo } from 'react'; + +import browser from 'webextension-polyfill'; + +import Flag from 'app/atoms/Flag'; + +import { CellPartProps } from '../select-with-modal'; + +import { LocaleOption } from './options'; + +export const LocaleIcon = memo>(({ option: { flagName, code } }) => ( + +)); diff --git a/src/app/templates/SettingsGeneral/components/locale-select/options.ts b/src/app/templates/SettingsGeneral/components/locale-select/options.ts new file mode 100644 index 0000000000..bb3df730fe --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/locale-select/options.ts @@ -0,0 +1,63 @@ +export interface LocaleOption { + code: 'en' | 'en_GB' | 'fr' | 'de' | 'zh_CN' | 'zh_TW' | 'ja' | 'ko' | 'uk' | 'tr' | 'pt'; + disabled: boolean; + flagName: string; +} + +export const LOCALE_OPTIONS: LocaleOption[] = [ + { + code: 'en', + flagName: 'us', + disabled: false + }, + { + code: 'en_GB', + flagName: 'gb', + disabled: false + }, + { + code: 'fr', + flagName: 'fr', + disabled: false + }, + { + code: 'de', + flagName: 'de', + disabled: false + }, + { + code: 'zh_CN', + flagName: 'cn', + disabled: false + }, + { + code: 'zh_TW', + flagName: 'tw', + disabled: false + }, + { + code: 'ja', + flagName: 'jp', + disabled: false + }, + { + code: 'ko', + flagName: 'kr', + disabled: false + }, + { + code: 'uk', + flagName: 'ua', + disabled: false + }, + { + code: 'tr', + flagName: 'tr', + disabled: false + }, + { + code: 'pt', + flagName: 'pt', + disabled: false + } +]; diff --git a/src/app/templates/SettingsGeneral/components/notifications-settings.tsx b/src/app/templates/SettingsGeneral/components/notifications-settings.tsx new file mode 100644 index 0000000000..c5e7196cf2 --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/notifications-settings.tsx @@ -0,0 +1,30 @@ +import React, { memo, useCallback } from 'react'; + +import { useDispatch } from 'react-redux'; + +import { EnablingSetting } from 'app/templates/enabling-setting'; +import { T } from 'lib/i18n'; +import { setIsNewsEnabledAction } from 'lib/notifications/store/actions'; +import { useIsNewsEnabledSelector } from 'lib/notifications/store/selectors'; + +import { SettingsGeneralSelectors } from '../selectors'; + +export const NotificationsSettings = memo(() => { + const dispatch = useDispatch(); + const isNewsEnabled = useIsNewsEnabledSelector(); + + const handleNewsNotificationsChange = useCallback( + (checked: boolean) => dispatch(setIsNewsEnabledAction(checked)), + [dispatch] + ); + + return ( + } + enabled={isNewsEnabled} + onChange={handleNewsNotificationsChange} + testID={SettingsGeneralSelectors.notificationCheckBox} + /> + ); +}); diff --git a/src/app/templates/SettingsGeneral/components/popup-settings.tsx b/src/app/templates/SettingsGeneral/components/popup-settings.tsx new file mode 100644 index 0000000000..a6bcf1472b --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/popup-settings.tsx @@ -0,0 +1,31 @@ +import React, { memo, useCallback, useRef } from 'react'; + +import { EnablingSetting } from 'app/templates/enabling-setting'; +import { T } from 'lib/i18n'; +import { isPopupModeEnabled, setPopupMode } from 'lib/popup-mode'; + +import { SettingsGeneralSelectors } from '../selectors'; + +export const PopupSettings = memo(() => { + const popupEnabled = isPopupModeEnabled(); + const changingRef = useRef(false); + + const handlePopupModeChange = useCallback((checked: boolean) => { + if (changingRef.current) return; + changingRef.current = true; + + setPopupMode(checked); + changingRef.current = false; + window.location.reload(); + }, []); + + return ( + } + enabled={popupEnabled} + onChange={handlePopupModeChange} + testID={SettingsGeneralSelectors.popUpCheckBox} + /> + ); +}); diff --git a/src/app/templates/SettingsGeneral/components/select-with-modal/index.tsx b/src/app/templates/SettingsGeneral/components/select-with-modal/index.tsx new file mode 100644 index 0000000000..893ee3ae16 --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/select-with-modal/index.tsx @@ -0,0 +1,71 @@ +import React, { useCallback } from 'react'; + +import { Button, IconBase } from 'app/atoms'; +import { SettingsCell } from 'app/atoms/SettingsCell'; +import { SettingsCellGroup } from 'app/atoms/SettingsCellGroup'; +import { ReactComponent as CompactDownIcon } from 'app/icons/base/compact_down.svg'; +import { InputContainer } from 'app/templates/InputContainer/InputContainer'; +import { useBooleanState } from 'lib/ui/hooks'; + +import { SelectModal, SelectModalProps } from './select-modal'; + +const NullComponent = () => null; + +interface SelectWithModalProps any)> + extends Omit, 'opened' | 'onRequestClose' | 'CellIcon'> { + CellIcon?: SelectModalProps['CellIcon']; + testID: string; + className?: string; +} + +export type { CellPartProps } from './select-modal-option'; + +export const SelectWithModal = any)>({ + title, + testID, + CellIcon = NullComponent, + CellName, + value, + className, + onSelect, + ...restProps +}: SelectWithModalProps) => { + const [selectModalOpened, openSelectModal, closeSelectModal] = useBooleanState(false); + + const handleSelect = useCallback( + (item: T) => { + onSelect(item); + closeSelectModal(); + }, + [closeSelectModal, onSelect] + ); + + return ( + <> + {title}}> + + } + cellName={} + testID={testID} + onClick={openSelectModal} + > + + + + + + + {...restProps} + title={title} + opened={selectModalOpened} + value={value} + CellIcon={CellIcon} + CellName={CellName} + onRequestClose={closeSelectModal} + onSelect={handleSelect} + /> + + ); +}; diff --git a/src/app/templates/SettingsGeneral/components/select-with-modal/select-modal-option.tsx b/src/app/templates/SettingsGeneral/components/select-with-modal/select-modal-option.tsx new file mode 100644 index 0000000000..6639e2a073 --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/select-with-modal/select-modal-option.tsx @@ -0,0 +1,48 @@ +import React, { ComponentType, useCallback } from 'react'; + +import { Button, IconBase } from 'app/atoms'; +import { SettingsCell } from 'app/atoms/SettingsCell'; +import { SettingsCellGroup } from 'app/atoms/SettingsCellGroup'; +import { ReactComponent as OkFillIcon } from 'app/icons/base/ok_fill.svg'; +import { setTestID } from 'lib/analytics'; + +export interface CellPartProps { + option: T; +} + +export interface SelectModalOptionProps { + option: T; + className?: string; + isSelected: boolean; + CellIcon: ComponentType>; + CellName: ComponentType>; + onSelect: SyncFn; + testID: string; +} + +// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint +export const SelectModalOption = ({ + option, + className, + isSelected, + CellIcon, + CellName, + onSelect, + testID +}: SelectModalOptionProps) => { + const handleClick = useCallback(() => onSelect(option), [onSelect, option]); + + return ( + + } + cellName={} + onClick={handleClick} + {...setTestID(testID)} + > + {isSelected && } + + + ); +}; diff --git a/src/app/templates/SettingsGeneral/components/select-with-modal/select-modal.tsx b/src/app/templates/SettingsGeneral/components/select-with-modal/select-modal.tsx new file mode 100644 index 0000000000..6d4055d90e --- /dev/null +++ b/src/app/templates/SettingsGeneral/components/select-with-modal/select-modal.tsx @@ -0,0 +1,74 @@ +import React, { useMemo, useState } from 'react'; + +import clsx from 'clsx'; + +import { EmptyState } from 'app/atoms/EmptyState'; +import { PageModal } from 'app/atoms/PageModal'; +import { ScrollView } from 'app/atoms/PageModal/scroll-view'; +import { SearchBarField } from 'app/templates/SearchField'; +import { searchAndFilterItems } from 'lib/utils/search-items'; + +import { SelectModalOption, SelectModalOptionProps } from './select-modal-option'; + +export interface SelectModalProps> + extends Pick, 'CellIcon' | 'CellName' | 'onSelect'> { + title: string; + opened: boolean; + options: T[]; + value: T; + searchKeys: Arguments>[2]; + searchThreshold?: number; + searchPrepare?: P; + keyFn: SyncFn; + onRequestClose: EmptyFn; + itemTestID: string; +} + +export const SelectModal = >({ + title, + opened, + options, + value, + searchKeys, + searchThreshold, + searchPrepare, + keyFn, + CellIcon, + CellName, + onSelect, + onRequestClose, + itemTestID +}: SelectModalProps) => { + const [searchValue, setSearchValue] = useState(''); + const [topEdgeIsVisible, setTopEdgeIsVisible] = useState(true); + + const filteredOptions = useMemo( + () => searchAndFilterItems(options, searchValue, searchKeys, searchPrepare, searchThreshold), + [options, searchValue, searchKeys, searchPrepare, searchThreshold] + ); + + return ( + +
    + +
    + + + {filteredOptions.length === 0 && } + + {filteredOptions.map((option, index) => ( + + className={index === 0 ? 'mt-1' : ''} + key={keyFn(option)} + option={option} + isSelected={keyFn(option) === keyFn(value)} + CellIcon={CellIcon} + CellName={CellName} + onSelect={onSelect} + testID={itemTestID} + /> + ))} + +
    + ); +}; diff --git a/src/app/templates/SettingsGeneral/index.tsx b/src/app/templates/SettingsGeneral/index.tsx index c0501d3181..6f640c7b20 100644 --- a/src/app/templates/SettingsGeneral/index.tsx +++ b/src/app/templates/SettingsGeneral/index.tsx @@ -1,25 +1,18 @@ import React, { memo } from 'react'; -import { NotificationsSettings } from 'lib/notifications/components'; - -import AnalyticsSettings from './components/AnalyticsSettings'; -import FiatCurrencySelect from './components/FiatCurrencySelect'; -import LocaleSelect from './components/LocaleSelect'; -import LockUpSettings from './components/LockUpSettings'; -import PopupSettings from './components/PopupSettings'; +import { FiatCurrencySelect } from './components/fiat-currency-select'; +import { LocaleSelect } from './components/locale-select'; +import { NotificationsSettings } from './components/notifications-settings'; +import { PopupSettings } from './components/popup-settings'; const GeneralSettings = memo(() => ( -
    +
    - - - -
    )); diff --git a/src/app/templates/SettingsGeneral/selectors.ts b/src/app/templates/SettingsGeneral/selectors.ts index db39f7e5ee..991fd2d1b4 100644 --- a/src/app/templates/SettingsGeneral/selectors.ts +++ b/src/app/templates/SettingsGeneral/selectors.ts @@ -6,6 +6,5 @@ export enum SettingsGeneralSelectors { popUpCheckBox = 'Setting General/Pop-up Check Box', extensionLockUpCheckBox = 'Setting General/Extension Lock-up Check Box', anonymousAnalyticsCheckBox = 'Setting General/Anonymous Analytics Check Box', - notificationCheckBox = 'Setting General/Notification Check Box', - partnersPromotion = 'Setting General/Partners Promotion Check Box' + notificationCheckBox = 'Setting General/Notification Check Box' } diff --git a/src/app/templates/enabling-setting.tsx b/src/app/templates/enabling-setting.tsx new file mode 100644 index 0000000000..7c54073fb8 --- /dev/null +++ b/src/app/templates/enabling-setting.tsx @@ -0,0 +1,31 @@ +import React, { ReactNode, memo } from 'react'; + +import { ToggleSwitch } from 'app/atoms'; +import { SettingsCell } from 'app/atoms/SettingsCell'; +import { SettingsCellGroup } from 'app/atoms/SettingsCellGroup'; +import { T, TID } from 'lib/i18n'; + +interface EnablingSettingProps { + titleI18nKey: TID; + enabled: boolean; + description: ReactNode; + onChange: (newValue: boolean, event: React.ChangeEvent) => void; + testID: string; +} + +export const EnablingSetting = memo( + ({ titleI18nKey, enabled, description, onChange, testID }: EnablingSettingProps) => ( + + }> + + + + {null} + + + ) +); diff --git a/src/lib/fiat-currency/consts.ts b/src/lib/fiat-currency/consts.ts index ec20d81006..ad9c1472a5 100644 --- a/src/lib/fiat-currency/consts.ts +++ b/src/lib/fiat-currency/consts.ts @@ -1,141 +1,118 @@ -import { FiatCurrenciesEnum, FiatCurrencyOption } from './types'; +import { FiatCurrenciesEnum, FiatCurrencyOptionBase } from './types'; -export const FIAT_CURRENCIES: Array = [ +export const FIAT_CURRENCIES_BASE: FiatCurrencyOptionBase[] = [ { name: FiatCurrenciesEnum.USD, - fullname: 'United States Dollar', apiLabel: 'usd', symbol: '$' }, { name: FiatCurrenciesEnum.EUR, - fullname: 'Euro', apiLabel: 'eur', symbol: '€' }, { name: FiatCurrenciesEnum.GBP, - fullname: 'British Pound', apiLabel: 'gbp', symbol: '£' }, { name: FiatCurrenciesEnum.JPY, - fullname: 'Japanese Yen', apiLabel: 'jpy', symbol: '¥' }, { name: FiatCurrenciesEnum.AUD, - fullname: 'Australian Dollar', apiLabel: 'aud', symbol: '$' }, { name: FiatCurrenciesEnum.CAD, - fullname: 'Canadian Dollar', apiLabel: 'cad', symbol: '$' }, { name: FiatCurrenciesEnum.CHF, - fullname: 'Swiss Franc', apiLabel: 'chf', symbol: 'Fr' }, { name: FiatCurrenciesEnum.CNY, - fullname: 'Chinese Yuan', apiLabel: 'cny', symbol: '¥' }, { name: FiatCurrenciesEnum.DKK, - fullname: 'Danish Krone', apiLabel: 'dkk', symbol: 'kr' }, { name: FiatCurrenciesEnum.HKD, - fullname: 'Hong Kong Dollar', apiLabel: 'hkd', symbol: '$' }, { name: FiatCurrenciesEnum.IDR, - fullname: 'Indonesian Rupiah', apiLabel: 'idr', symbol: 'Rp' }, { name: FiatCurrenciesEnum.INR, - fullname: 'Indian Rupee', apiLabel: 'inr', symbol: '₹' }, { name: FiatCurrenciesEnum.KRW, - fullname: 'South Korean Won', apiLabel: 'krw', symbol: '₩' }, { name: FiatCurrenciesEnum.MXN, - fullname: 'Mexican Peso', apiLabel: 'mxn', symbol: '$' }, { name: FiatCurrenciesEnum.NZD, - fullname: 'New Zealand Dollar', apiLabel: 'nzd', symbol: '$' }, { name: FiatCurrenciesEnum.PLN, - fullname: 'Polish Zloty', apiLabel: 'pln', symbol: 'zł' }, { name: FiatCurrenciesEnum.SEK, - fullname: 'Swedish Krona', apiLabel: 'sek', symbol: 'kr' }, { name: FiatCurrenciesEnum.SGD, - fullname: 'Singapore Dollar', apiLabel: 'sgd', symbol: '$' }, { name: FiatCurrenciesEnum.THB, - fullname: 'Thai Baht', apiLabel: 'thb', symbol: '฿' }, { name: FiatCurrenciesEnum.TRY, - fullname: 'Turkish Lira', apiLabel: 'try', symbol: '₺' }, { name: FiatCurrenciesEnum.TWD, - fullname: 'Taiwan Dollar', apiLabel: 'twd', symbol: '$' }, { name: FiatCurrenciesEnum.UAH, - fullname: 'Ukrainian Hryvnia', apiLabel: 'uah', symbol: '₴' }, { name: FiatCurrenciesEnum.ZAR, - fullname: 'South African Rand', apiLabel: 'zar', symbol: 'R' } diff --git a/src/lib/fiat-currency/core.ts b/src/lib/fiat-currency/core.ts index d93363f252..697f114696 100644 --- a/src/lib/fiat-currency/core.ts +++ b/src/lib/fiat-currency/core.ts @@ -11,8 +11,8 @@ import { useStorage } from 'lib/temple/front'; import { isTruthy } from 'lib/utils'; import { ZERO } from 'lib/utils/numbers'; -import { FIAT_CURRENCIES } from './consts'; -import type { FiatCurrencyOption, CoingeckoFiatInterface } from './types'; +import { FIAT_CURRENCIES_BASE } from './consts'; +import type { CoingeckoFiatInterface, FiatCurrencyOptionBase } from './types'; const FIAT_CURRENCY_STORAGE_KEY = 'fiat_currency'; @@ -58,9 +58,9 @@ export function useAssetFiatCurrencyPrice(slug: string, chainId: number | string export const useFiatCurrency = () => { const { data } = useSelector(state => state.currency.fiatToTezosRates); - const [selectedFiatCurrency, setSelectedFiatCurrency] = useStorage( + const [selectedFiatCurrency, setSelectedFiatCurrency] = useStorage( FIAT_CURRENCY_STORAGE_KEY, - FIAT_CURRENCIES[0]! + FIAT_CURRENCIES_BASE[0]! ); return { @@ -75,7 +75,7 @@ const coingeckoApi = axios.create({ baseURL: 'https://api.coingecko.com/api/v3/' export const fetchFiatToTezosRates = () => coingeckoApi .get( - `/simple/price?ids=tezos&vs_currencies=${FIAT_CURRENCIES.map(({ apiLabel }) => apiLabel).join(',')}` + `/simple/price?ids=tezos&vs_currencies=${FIAT_CURRENCIES_BASE.map(({ apiLabel }) => apiLabel).join(',')}` ) .then(({ data }) => { const mappedRates: Record = {}; diff --git a/src/lib/fiat-currency/index.ts b/src/lib/fiat-currency/index.ts index 941e140cad..1e3346f016 100644 --- a/src/lib/fiat-currency/index.ts +++ b/src/lib/fiat-currency/index.ts @@ -1,3 +1,3 @@ -export type { FiatCurrencyOption } from './types'; -export { FIAT_CURRENCIES } from './consts'; +export type { FiatCurrenciesEnum, FiatCurrencyOption, FiatCurrencyOptionBase } from './types'; +export { FIAT_CURRENCIES_BASE } from './consts'; export { useFiatCurrency, useFiatToUsdRate, useAssetFiatCurrencyPrice, fetchFiatToTezosRates } from './core'; diff --git a/src/lib/fiat-currency/types.ts b/src/lib/fiat-currency/types.ts index 7f72257a15..1da07658d6 100644 --- a/src/lib/fiat-currency/types.ts +++ b/src/lib/fiat-currency/types.ts @@ -24,13 +24,16 @@ export enum FiatCurrenciesEnum { ZAR = 'ZAR' } -export interface FiatCurrencyOption { +export interface FiatCurrencyOptionBase { name: FiatCurrenciesEnum; - fullname: string; apiLabel: string; symbol: string; } +export interface FiatCurrencyOption extends FiatCurrencyOptionBase { + fullname: string; +} + export interface CoingeckoFiatInterface { tezos: Record; } diff --git a/src/lib/i18n/cldrjs-locales.json b/src/lib/i18n/cldrjs-locales.json index 173c19b7ff..280b71fb0d 100644 --- a/src/lib/i18n/cldrjs-locales.json +++ b/src/lib/i18n/cldrjs-locales.json @@ -800,233 +800,6 @@ } } }, - "ru": { - "identity": { - "version": { - "_cldrVersion": "37" - }, - "language": "ru" - }, - "numbers": { - "defaultNumberingSystem": "latn", - "otherNumberingSystems": { - "native": "latn" - }, - "minimumGroupingDigits": "1", - "symbols-numberSystem-latn": { - "decimal": ",", - "group": " ", - "list": ";", - "percentSign": "%", - "plusSign": "+", - "minusSign": "-", - "exponential": "E", - "superscriptingExponent": "×", - "perMille": "‰", - "infinity": "∞", - "nan": "не число", - "timeSeparator": ":" - }, - "decimalFormats-numberSystem-latn": { - "standard": "#,##0.###", - "long": { - "decimalFormat": { - "1000-count-one": "0 тысяча", - "1000-count-few": "0 тысячи", - "1000-count-many": "0 тысяч", - "1000-count-other": "0 тысячи", - "10000-count-one": "00 тысяча", - "10000-count-few": "00 тысячи", - "10000-count-many": "00 тысяч", - "10000-count-other": "00 тысячи", - "100000-count-one": "000 тысяча", - "100000-count-few": "000 тысячи", - "100000-count-many": "000 тысяч", - "100000-count-other": "000 тысячи", - "1000000-count-one": "0 миллион", - "1000000-count-few": "0 миллиона", - "1000000-count-many": "0 миллионов", - "1000000-count-other": "0 миллиона", - "10000000-count-one": "00 миллион", - "10000000-count-few": "00 миллиона", - "10000000-count-many": "00 миллионов", - "10000000-count-other": "00 миллиона", - "100000000-count-one": "000 миллион", - "100000000-count-few": "000 миллиона", - "100000000-count-many": "000 миллионов", - "100000000-count-other": "000 миллиона", - "1000000000-count-one": "0 миллиард", - "1000000000-count-few": "0 миллиарда", - "1000000000-count-many": "0 миллиардов", - "1000000000-count-other": "0 миллиарда", - "10000000000-count-one": "00 миллиард", - "10000000000-count-few": "00 миллиарда", - "10000000000-count-many": "00 миллиардов", - "10000000000-count-other": "00 миллиарда", - "100000000000-count-one": "000 миллиард", - "100000000000-count-few": "000 миллиарда", - "100000000000-count-many": "000 миллиардов", - "100000000000-count-other": "000 миллиарда", - "1000000000000-count-one": "0 триллион", - "1000000000000-count-few": "0 триллиона", - "1000000000000-count-many": "0 триллионов", - "1000000000000-count-other": "0 триллиона", - "10000000000000-count-one": "00 триллион", - "10000000000000-count-few": "00 триллиона", - "10000000000000-count-many": "00 триллионов", - "10000000000000-count-other": "00 триллиона", - "100000000000000-count-one": "000 триллион", - "100000000000000-count-few": "000 триллиона", - "100000000000000-count-many": "000 триллионов", - "100000000000000-count-other": "000 триллиона" - } - }, - "short": { - "decimalFormat": { - "1000-count-one": "0 тыс'.'", - "1000-count-few": "0 тыс'.'", - "1000-count-many": "0 тыс'.'", - "1000-count-other": "0 тыс'.'", - "10000-count-one": "00 тыс'.'", - "10000-count-few": "00 тыс'.'", - "10000-count-many": "00 тыс'.'", - "10000-count-other": "00 тыс'.'", - "100000-count-one": "000 тыс'.'", - "100000-count-few": "000 тыс'.'", - "100000-count-many": "000 тыс'.'", - "100000-count-other": "000 тыс'.'", - "1000000-count-one": "0 млн", - "1000000-count-few": "0 млн", - "1000000-count-many": "0 млн", - "1000000-count-other": "0 млн", - "10000000-count-one": "00 млн", - "10000000-count-few": "00 млн", - "10000000-count-many": "00 млн", - "10000000-count-other": "00 млн", - "100000000-count-one": "000 млн", - "100000000-count-few": "000 млн", - "100000000-count-many": "000 млн", - "100000000-count-other": "000 млн", - "1000000000-count-one": "0 млрд", - "1000000000-count-few": "0 млрд", - "1000000000-count-many": "0 млрд", - "1000000000-count-other": "0 млрд", - "10000000000-count-one": "00 млрд", - "10000000000-count-few": "00 млрд", - "10000000000-count-many": "00 млрд", - "10000000000-count-other": "00 млрд", - "100000000000-count-one": "000 млрд", - "100000000000-count-few": "000 млрд", - "100000000000-count-many": "000 млрд", - "100000000000-count-other": "000 млрд", - "1000000000000-count-one": "0 трлн", - "1000000000000-count-few": "0 трлн", - "1000000000000-count-many": "0 трлн", - "1000000000000-count-other": "0 трлн", - "10000000000000-count-one": "00 трлн", - "10000000000000-count-few": "00 трлн", - "10000000000000-count-many": "00 трлн", - "10000000000000-count-other": "00 трлн", - "100000000000000-count-one": "000 трлн", - "100000000000000-count-few": "000 трлн", - "100000000000000-count-many": "000 трлн", - "100000000000000-count-other": "000 трлн" - } - } - }, - "scientificFormats-numberSystem-latn": { - "standard": "#E0" - }, - "percentFormats-numberSystem-latn": { - "standard": "#,##0 %" - }, - "currencyFormats-numberSystem-latn": { - "currencySpacing": { - "beforeCurrency": { - "currencyMatch": "[:^S:]", - "surroundingMatch": "[:digit:]", - "insertBetween": " " - }, - "afterCurrency": { - "currencyMatch": "[:^S:]", - "surroundingMatch": "[:digit:]", - "insertBetween": " " - } - }, - "standard": "#,##0.00 ¤", - "accounting": "#,##0.00 ¤", - "short": { - "standard": { - "1000-count-one": "0 тыс'.' ¤", - "1000-count-few": "0 тыс'.' ¤", - "1000-count-many": "0 тыс'.' ¤", - "1000-count-other": "0 тыс'.' ¤", - "10000-count-one": "00 тыс'.' ¤", - "10000-count-few": "00 тыс'.' ¤", - "10000-count-many": "00 тыс'.' ¤", - "10000-count-other": "00 тыс'.' ¤", - "100000-count-one": "000 тыс'.' ¤", - "100000-count-few": "000 тыс'.' ¤", - "100000-count-many": "000 тыс'.' ¤", - "100000-count-other": "000 тыс'.' ¤", - "1000000-count-one": "0 млн ¤", - "1000000-count-few": "0 млн ¤", - "1000000-count-many": "0 млн ¤", - "1000000-count-other": "0 млн ¤", - "10000000-count-one": "00 млн ¤", - "10000000-count-few": "00 млн ¤", - "10000000-count-many": "00 млн ¤", - "10000000-count-other": "00 млн ¤", - "100000000-count-one": "000 млн ¤", - "100000000-count-few": "000 млн ¤", - "100000000-count-many": "000 млн ¤", - "100000000-count-other": "000 млн ¤", - "1000000000-count-one": "0 млрд ¤", - "1000000000-count-few": "0 млрд ¤", - "1000000000-count-many": "0 млрд ¤", - "1000000000-count-other": "0 млрд ¤", - "10000000000-count-one": "00 млрд ¤", - "10000000000-count-few": "00 млрд ¤", - "10000000000-count-many": "00 млрд ¤", - "10000000000-count-other": "00 млрд ¤", - "100000000000-count-one": "000 млрд ¤", - "100000000000-count-few": "000 млрд ¤", - "100000000000-count-many": "000 млрд ¤", - "100000000000-count-other": "000 млрд ¤", - "1000000000000-count-one": "0 трлн ¤", - "1000000000000-count-few": "0 трлн ¤", - "1000000000000-count-many": "0 трлн ¤", - "1000000000000-count-other": "0 трлн ¤", - "10000000000000-count-one": "00 трлн ¤", - "10000000000000-count-few": "00 трлн ¤", - "10000000000000-count-many": "00 трлн ¤", - "10000000000000-count-other": "00 трлн ¤", - "100000000000000-count-one": "000 трлн ¤", - "100000000000000-count-few": "000 трлн ¤", - "100000000000000-count-many": "000 трлн ¤", - "100000000000000-count-other": "000 трлн ¤" - } - }, - "unitPattern-count-one": "{0} {1}", - "unitPattern-count-few": "{0} {1}", - "unitPattern-count-many": "{0} {1}", - "unitPattern-count-other": "{0} {1}" - }, - "miscPatterns-numberSystem-latn": { - "approximately": "≈{0}", - "atLeast": "≥{0}", - "atMost": "≤{0}", - "range": "{0}–{1}" - }, - "minimalPairs": { - "pluralMinimalPairs-count-one": "из {0} книги за {0} день", - "pluralMinimalPairs-count-few": "из {0} книг за {0} дня", - "pluralMinimalPairs-count-many": "из {0} книг за {0} дней", - "pluralMinimalPairs-count-other": "из {0} книги за {0} дня", - "other": "Сверните направо на {0}-м перекрестке." - } - } - }, "uk": { "identity": { "version": { diff --git a/src/lib/i18n/core.ts b/src/lib/i18n/core.ts index dd868ec336..344e7ba352 100644 --- a/src/lib/i18n/core.ts +++ b/src/lib/i18n/core.ts @@ -1,7 +1,7 @@ // eslint-disable-next-line import/no-duplicates import formatDateFns from 'date-fns/format'; // eslint-disable-next-line import/no-duplicates -import { enUS, enGB, fr, zhCN, zhTW, ja, ko, uk, ru } from 'date-fns/locale'; +import { enUS, enGB, fr, zhCN, zhTW, ja, ko, uk } from 'date-fns/locale'; import browser from 'webextension-polyfill'; import cldrjsLocales from './cldrjs-locales.json'; @@ -17,8 +17,7 @@ const dateFnsLocales: Record = { zh_TW: zhTW, ja, ko, - uk, - ru + uk }; let fetchedLocaleMessages: FetchedLocaleMessages = { diff --git a/src/lib/i18n/index.ts b/src/lib/i18n/index.ts index ae18de2bb0..aadbc536d6 100644 --- a/src/lib/i18n/index.ts +++ b/src/lib/i18n/index.ts @@ -6,5 +6,5 @@ export { updateLocale, onInited } from './loading'; export { toLocalFixed, toLocalFormat, toShortened, getPluralKey } from './numbers'; -export type { TProps, ReactSubstitutions } from './react'; +export type { TProps } from './react'; export { t, T } from './react'; diff --git a/src/lib/i18n/react.tsx b/src/lib/i18n/react.tsx index 5049acab70..ff8e8f5f35 100644 --- a/src/lib/i18n/react.tsx +++ b/src/lib/i18n/react.tsx @@ -4,7 +4,7 @@ import { getMessage } from './core'; import { toList } from './helpers'; import { TID, Substitutions } from './types'; -export type ReactSubstitutions = ReactNode | ReactNode[]; +type ReactSubstitutions = ReactNode | ReactNode[]; export type TProps = { id: TID; diff --git a/src/lib/lock-up/index.ts b/src/lib/lock-up/index.ts index 9bb856560d..63e602add8 100644 --- a/src/lib/lock-up/index.ts +++ b/src/lib/lock-up/index.ts @@ -9,4 +9,6 @@ export const getIsLockUpEnabled = () => { return stored ? stored === 'true' : DEFAULT_VALUE; }; +// TODO: remove this comment while making 'Security' settings section +// @ts-prune-ignore-next export const useIsLockUpEnabled = () => useLocalStorage(STORAGE_KEY, DEFAULT_VALUE); diff --git a/src/lib/notifications/components/index.ts b/src/lib/notifications/components/index.ts index 935ca7d02d..d35be8d043 100644 --- a/src/lib/notifications/components/index.ts +++ b/src/lib/notifications/components/index.ts @@ -1,3 +1,2 @@ export { NotificationsItem } from './item'; export { Notifications } from './notifications'; -export { NotificationsSettings } from './settings'; diff --git a/src/lib/notifications/components/settings.tsx b/src/lib/notifications/components/settings.tsx deleted file mode 100644 index 4adb4c2d61..0000000000 --- a/src/lib/notifications/components/settings.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React, { FC } from 'react'; - -import { useDispatch } from 'react-redux'; - -import { EnablingSetting } from 'app/templates/EnablingSetting'; -import { SettingsGeneralSelectors } from 'app/templates/SettingsGeneral/selectors'; - -import { setIsNewsEnabledAction } from '../store/actions'; -import { useIsNewsEnabledSelector } from '../store/selectors'; - -export const NotificationsSettings: FC = () => { - const dispatch = useDispatch(); - const isNewsEnabled = useIsNewsEnabledSelector(); - - const handleNewsNotificationsChange = (checked: boolean) => dispatch(setIsNewsEnabledAction(checked)); - - return ( - - ); -}; diff --git a/src/lib/temple/back/actions.ts b/src/lib/temple/back/actions.ts index f2ec84fb51..c66e044e00 100644 --- a/src/lib/temple/back/actions.ts +++ b/src/lib/temple/back/actions.ts @@ -497,6 +497,10 @@ type ProcessedBeaconMessage = { encrypted?: boolean; }; +export function resetExtension(password: string) { + return withUnlocked(async () => Vault.reset(password)); +} + export async function processBeacon( origin: string, msg: string, diff --git a/src/lib/temple/back/main.ts b/src/lib/temple/back/main.ts index d68b27360d..e0e379baa1 100644 --- a/src/lib/temple/back/main.ts +++ b/src/lib/temple/back/main.ts @@ -272,6 +272,12 @@ const processRequest = async (req: TempleRequest, port: Runtime.Port): Promise { expectRecentTimestampInMs(createdAt); }); }); + + describe('reset', () => { + it('should reset wallet if the given password is correct', async () => { + await Vault.spawn(password, defaultMnemonic); + await Vault.setup(password); + await Vault.reset(password); + expect(await getPassHash()).toBeUndefined(); + expect(await Vault.isExist()).toBe(false); + }); + + it('should throw an error if the given password is incorrect', async () => { + await Vault.spawn(password, defaultMnemonic); + await Vault.setup(password); + await expect(() => Vault.reset(invalidPassword)).rejects.toThrow('Invalid password'); + }); + }); }); diff --git a/src/lib/temple/front/client.ts b/src/lib/temple/front/client.ts index a122ab165b..9583592873 100644 --- a/src/lib/temple/front/client.ts +++ b/src/lib/temple/front/client.ts @@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import constate from 'constate'; import { omit } from 'lodash'; +import browser from 'webextension-polyfill'; import { WALLETS_SPECS_STORAGE_KEY } from 'lib/constants'; import { useRetryableSWR } from 'lib/swr'; @@ -364,6 +365,16 @@ export const [TempleClientProvider, useTempleClient] = constate(() => { return res.sessions; }, []); + const resetExtension = useCallback(async (password: string) => { + const res = await request({ + type: TempleMessageType.ResetExtensionRequest, + password + }); + assertResponse(res.type === TempleMessageType.ResetExtensionResponse); + localStorage.clear(); + browser.runtime.reload(); + }, []); + return { state, @@ -408,6 +419,7 @@ export const [TempleClientProvider, useTempleClient] = constate(() => { confirmDAppOperation, confirmDAppSign, getAllDAppSessions, - removeDAppSession + removeDAppSession, + resetExtension }; }); diff --git a/src/lib/temple/types.ts b/src/lib/temple/types.ts index 7d360aa88c..b74e52b6db 100644 --- a/src/lib/temple/types.ts +++ b/src/lib/temple/types.ts @@ -282,7 +282,9 @@ export enum TempleMessageType { SendTrackEventRequest = 'SEND_TRACK_EVENT_REQUEST', SendTrackEventResponse = 'SEND_TRACK_EVENT_RESPONSE', SendPageEventRequest = 'SEND_PAGE_EVENT_REQUEST', - SendPageEventResponse = 'SEND_PAGE_EVENT_RESPONSE' + SendPageEventResponse = 'SEND_PAGE_EVENT_RESPONSE', + ResetExtensionRequest = 'RESET_EXTENSION_REQUEST', + ResetExtensionResponse = 'RESET_EXTENSION_RESPONSE' } export type TempleNotification = @@ -325,7 +327,8 @@ export type TempleRequest = | TempleGetAllDAppSessionsRequest | TempleRemoveDAppSessionRequest | TempleSendTrackEventRequest - | TempleSendPageEventRequest; + | TempleSendPageEventRequest + | TempleResetExtensionRequest; export type TempleResponse = | TempleGetStateResponse @@ -361,7 +364,8 @@ export type TempleResponse = | TempleGetAllDAppSessionsResponse | TempleRemoveDAppSessionResponse | TempleSendTrackEventResponse - | TempleSendPageEventResponse; + | TempleSendPageEventResponse + | TempleResetExtensionResponse; export interface TempleMessageBase { type: TempleMessageType; @@ -731,4 +735,13 @@ interface TempleRemoveDAppSessionResponse extends TempleMessageBase { sessions: TempleDAppSessions; } +interface TempleResetExtensionRequest extends TempleMessageBase { + type: TempleMessageType.ResetExtensionRequest; + password: string; +} + +interface TempleResetExtensionResponse extends TempleMessageBase { + type: TempleMessageType.ResetExtensionResponse; +} + export type OperationsPreview = any[] | { branch: string; contents: any[] }; diff --git a/src/lib/types.d.ts b/src/lib/types.d.ts index e21e5f5fd7..57ffc8e7f1 100644 --- a/src/lib/types.d.ts +++ b/src/lib/types.d.ts @@ -30,3 +30,5 @@ type NonNullableField = T & NonNullableFields>; type PropsWithChildren

    = P & { children: import('react').ReactNode }; type PropsWithClassName

    = P & { className?: string }; + +type Arguments = T extends (...args: infer U) => any ? U : never; diff --git a/src/lib/ui/dialog.tsx b/src/lib/ui/dialog.tsx index 0970d77e96..857d5fc616 100644 --- a/src/lib/ui/dialog.tsx +++ b/src/lib/ui/dialog.tsx @@ -2,7 +2,7 @@ import { useCallback, useMemo, useState } from 'react'; import constate from 'constate'; -import type { AlertModalProps } from 'app/templates/AlertModal'; +import { AlertModalProps } from 'app/templates/AlertModal'; import type { ConfirmationModalProps } from 'app/templates/ConfirmationModal/ConfirmationModal'; type AlertParams = Omit; diff --git a/src/lib/ui/utils.ts b/src/lib/ui/utils.ts index 89c29ac154..de609cc99d 100644 --- a/src/lib/ui/utils.ts +++ b/src/lib/ui/utils.ts @@ -2,15 +2,6 @@ import { MutableRefObject, ForwardedRef } from 'react'; import { browser } from 'lib/browser'; -/** For that the following is not allowed by Prettier: - * ```tsx - * - * {' '} // Use {SPACE_CHAR} instead - * - * ``` - */ -export const SPACE_CHAR = ' '; - export const combineRefs = ( ...refs: (MutableRefObject | ForwardedRef | nullish)[] ) => { diff --git a/src/temple/front/index.ts b/src/temple/front/index.ts index 1528ca3c15..d058cecf1b 100644 --- a/src/temple/front/index.ts +++ b/src/temple/front/index.ts @@ -11,7 +11,6 @@ export { useAccountAddressForTezos, useAccountForTezos, useAccountAddressForEvm, - useAccountForEvm, useSetAccountId as useChangeAccount, // useHDGroups diff --git a/src/temple/front/ready/index.ts b/src/temple/front/ready/index.ts index 94c7d60a80..f0e29a323c 100644 --- a/src/temple/front/ready/index.ts +++ b/src/temple/front/ready/index.ts @@ -23,7 +23,6 @@ export const [ useAccountAddressForTezos, useAccountForTezos, useAccountAddressForEvm, - useAccountForEvm, useSetAccountId, // useSettings, @@ -44,7 +43,6 @@ export const [ v => v.accountAddressForTezos, v => v.accountForTezos, v => v.accountAddressForEvm, - v => v.accountForEvm, v => v.setAccountId, // v => v.settings, diff --git a/src/temple/networks.ts b/src/temple/networks.ts index b895a6f1ce..2dc8adcdb4 100644 --- a/src/temple/networks.ts +++ b/src/temple/networks.ts @@ -78,17 +78,6 @@ export const TEZOS_DEFAULT_NETWORKS: NonEmptyArray = [ color: '#83b300', default: true }, - { - id: 'marigold-mainnet', - name: 'Marigold Mainnet', - nameI18nKey: 'marigoldMainnet', - chain: TempleChainKind.Tezos, - chainId: TempleTezosChainId.Mainnet, - rpcBaseURL: 'https://mainnet.tezos.marigold.dev', - description: 'Marigold mainnet', - color: '#48bb78', - default: true - }, { id: 'smartpy-mainnet', name: 'SmartPy Mainnet', diff --git a/yarn.lock b/yarn.lock index d04fbfcd5a..f4578d5fbd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1605,24 +1605,24 @@ integrity sha512-tAgvZQe/t2mlvpNosA4+CkMiZ2azISW5WPAcdSalZlEjQvUfghHxfQcrCiK/7/CrfAWVxyM88kGFYO82heIGDg== "@dicebear/bottts-neutral@^8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@dicebear/bottts-neutral/-/bottts-neutral-8.0.1.tgz#22f2547cd74669f5fc38ffd5298f083b049daaba" - integrity sha512-krbD3U+UvzlY+kfQDpg9Hql1xJmmu3y9ensiU+XZXiuNw/ZavgGqpJtzpbYeF3J5GsggQlbBh/ZAK9AIKz7S3Q== + version "8.0.2" + resolved "https://registry.yarnpkg.com/@dicebear/bottts-neutral/-/bottts-neutral-8.0.2.tgz#4e3ff249202c570acd79e5cbfc4dc14a6a403962" + integrity sha512-khiccnWoo0ivb+3PyneuWcL4bJc9+izAFFKIXvE3h7ozOT6VCT4h2WtYULaPwDYBAr85CygxgdWKd7aAujK6JQ== -"@dicebear/converter@8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@dicebear/converter/-/converter-8.0.1.tgz#c037c1404f73a994ee4f943928edb367029425e1" - integrity sha512-65L04fN4V07WcUnwQuDYDH+zrP8WA6/UeIuqqH/Pv7VWoJtIk9qHlaA+XGpPr4qgRtkmY7uXVkrED/RMlqvUDA== +"@dicebear/converter@8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@dicebear/converter/-/converter-8.0.2.tgz#a1c5e8c8d324d80512786a7e8a0f3788c210ca83" + integrity sha512-mREmyQLIfHnt30Xzjc9ZHgDgIzbF7BXApBCYolnB2kO2Kpb14OdmsyLRsYe/Tt+Vt6sLgiigWoZFcRvbStRhLA== dependencies: "@types/json-schema" "^7.0.11" tmp-promise "^3.0.3" "@dicebear/core@^8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@dicebear/core/-/core-8.0.1.tgz#3ac1e98a5380071c4a1e0d874cc8ff83b1c9ba8f" - integrity sha512-HWqvQRpVjkboQXinCOjU3poZIMd5p+32wPvc9N5fYiXe3KQLhJNw5T5XiRttDUm3XpoTvhQ4DVTPDsXT8CqrTg== + version "8.0.2" + resolved "https://registry.yarnpkg.com/@dicebear/core/-/core-8.0.2.tgz#6d42cbdd1ae11a6bb344e71ddefbc654ee3f3f4f" + integrity sha512-Zr3dBAH+6BBYc2kjz7KvJCMYasQlsY9CZ7D3abgZhk/XRT4B3qxo8kP+FL8YjJvrOJyV2P7h08BAKZlTWuKXPA== dependencies: - "@dicebear/converter" "8.0.1" + "@dicebear/converter" "8.0.2" "@types/json-schema" "^7.0.11" "@discoveryjs/json-ext@^0.5.0":