From 32959a6a4074a3a389a84ebf57d5df33a7c072f0 Mon Sep 17 00:00:00 2001 From: Ostap Piatkovskyi <44294945+ost-ptk@users.noreply.github.com> Date: Thu, 14 Nov 2024 20:03:47 +0200 Subject: [PATCH] feature: add Terms & Conditions and Privacy Policy link to the navigation menu (#1073) * added Terms & Conditions and Privacy Policy link to the navigation menu * moved urls to constants * removed unused constants --- .../pages/create-vault-password/index.tsx | 6 ++-- .../popup/pages/navigation-menu/index.tsx | 30 +++++++++++++++---- src/constants.ts | 24 +++++++-------- src/libs/services/deployer-service/index.ts | 6 ++-- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/src/apps/onboarding/pages/create-vault-password/index.tsx b/src/apps/onboarding/pages/create-vault-password/index.tsx index efbd80f11..0c08c95e0 100644 --- a/src/apps/onboarding/pages/create-vault-password/index.tsx +++ b/src/apps/onboarding/pages/create-vault-password/index.tsx @@ -3,7 +3,7 @@ import { useWatch } from 'react-hook-form'; import { Trans, useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; -import { TermsLink } from '@src/constants'; +import { TERMS_URLS } from '@src/constants'; import { Stepper } from '@onboarding/components/stepper'; import { RouterPath } from '@onboarding/router'; @@ -69,7 +69,7 @@ export function CreateVaultPasswordPage({ onClick={event => { event.stopPropagation(); event.preventDefault(); - window.open(TermsLink.Tos, '_blank'); + window.open(TERMS_URLS.tos, '_blank'); }} color="contentAction" > @@ -80,7 +80,7 @@ export function CreateVaultPasswordPage({ onClick={event => { event.stopPropagation(); event.preventDefault(); - window.open(TermsLink.Privacy, '_blank'); + window.open(TERMS_URLS.privacy, '_blank'); }} color="contentAction" > diff --git a/src/apps/popup/pages/navigation-menu/index.tsx b/src/apps/popup/pages/navigation-menu/index.tsx index ac068c39a..fc5377a18 100644 --- a/src/apps/popup/pages/navigation-menu/index.tsx +++ b/src/apps/popup/pages/navigation-menu/index.tsx @@ -3,6 +3,12 @@ import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; import styled from 'styled-components'; +import { + ABOUT_US_URL, + SHARE_FEEDBACK_URL, + TERMS_URLS, + USER_GUIDES_URL +} from '@src/constants'; import { isLedgerAvailable, isSafariBuild } from '@src/utils'; import { TimeoutDurationSetting } from '@popup/constants'; @@ -320,23 +326,37 @@ export function NavigationMenuPageContent() { items: [ { id: 1, + title: t('Terms & Conditions'), + iconPath: 'assets/icons/books.svg', + href: TERMS_URLS.tos, + disabled: false + }, + { + id: 2, + title: t('Privacy Policy'), + iconPath: 'assets/icons/books.svg', + href: TERMS_URLS.privacy, + disabled: false + }, + { + id: 3, title: t('Share feedback'), iconPath: 'assets/icons/chat.svg', - href: 'https://casper-wallet.canny.io/feature-requests', + href: SHARE_FEEDBACK_URL, disabled: false }, { - id: 2, + id: 4, title: t('User guides'), iconPath: 'assets/icons/books.svg', - href: 'https://casperwallet.io/user-guide', + href: USER_GUIDES_URL, disabled: false }, { - id: 3, + id: 5, title: t('About us'), iconPath: 'assets/icons/team.svg', - href: 'https://make.services/', + href: ABOUT_US_URL, disabled: false } ] diff --git a/src/constants.ts b/src/constants.ts index 918356617..a52b7fc0c 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,17 +1,10 @@ const SECOND = 1000; -export const FETCH_QUERY_OPTIONS = { - // cached for 30 sec - apiCacheTime: 30 * SECOND -}; - export const BALANCE_REFRESH_RATE = 15 * SECOND; export const CURRENCY_REFRESH_RATE = 30 * SECOND; export const TOKENS_REFRESH_RATE = 15 * SECOND; export const NFT_TOKENS_REFRESH_RATE = 60 * SECOND; -export const ACCOUNT_DEPLOY_REFRESH_RATE = 30 * SECOND; export const ACCOUNT_CASPER_ACTIVITY_REFRESH_RATE = 30 * SECOND; -export const ERC20_TOKEN_ACTIVITY_REFRESH_RATE = 30 * SECOND; export const VALIDATORS_REFRESH_RATE = 30 * SECOND; export const PENDING_DEPLOY_REFETCH_INTERVAL = 5 * SECOND; export const DEPLOY_DETAILS_REFRESH_RATE = 30 * SECOND; @@ -29,6 +22,16 @@ export const STAKE_COST_MOTES = '2500000000'; // 2.5 CSPR export const DELEGATION_MIN_AMOUNT_MOTES = '500000000000'; // 500 CSPR export const MAX_DELEGATORS = 1200; +export const USER_GUIDES_URL = 'https://casperwallet.io/user-guide'; +export const SHARE_FEEDBACK_URL = + 'https://casper-wallet.canny.io/feature-requests'; +export const ABOUT_US_URL = 'https://make.services'; +export const TERMS_URLS = { + tos: 'https://www.casperwallet.io/tos', + privacy: 'https://www.casperwallet.io/privacy' +}; +export const REFERRER_URL = 'https://casperwallet.io'; + export const getBlockExplorerAccountUrl = ( casperLiveUrl: string, publicKey: string @@ -84,18 +87,11 @@ export enum Browser { Edge = 'edge' } -export enum TermsLink { - Tos = 'https://www.casperwallet.io/tos', - Privacy = 'https://www.casperwallet.io/privacy' -} - export enum CasperNodeUrl { MainnetUrl = 'https://node.cspr.cloud/rpc', TestnetUrl = 'https://node.testnet.cspr.cloud/rpc' } -export const ReferrerUrl = 'https://casperwallet.io'; - export enum NetworkName { Mainnet = 'casper', Testnet = 'casper-test' diff --git a/src/libs/services/deployer-service/index.ts b/src/libs/services/deployer-service/index.ts index 6dbe61b04..c97b42706 100644 --- a/src/libs/services/deployer-service/index.ts +++ b/src/libs/services/deployer-service/index.ts @@ -13,7 +13,7 @@ import { AuctionManagerEntryPoint, CasperNodeUrl, NetworkName, - ReferrerUrl, + REFERRER_URL, STAKE_COST_MOTES, TRANSFER_COST_MOTES } from '@src/constants'; @@ -51,7 +51,7 @@ export const getDateForDeploy = async (nodeUrl: CasperNodeUrl) => { const casperNodeTimestamp: ICasperNodeStatusResponse = await fetch( `${nodeUrl}/info_get_status`, { - referrer: ReferrerUrl + referrer: REFERRER_URL } ).then(toJson); @@ -274,7 +274,7 @@ export const sendSignDeploy = ( return fetch(nodeUrl, { method: 'POST', - referrer: ReferrerUrl, + referrer: REFERRER_URL, body: JSON.stringify({ jsonrpc: '2.0', method: 'account_put_deploy',