From a983304d4f8aeca93aa90423bd3f305a7b4b8666 Mon Sep 17 00:00:00 2001 From: itaven Date: Wed, 29 Nov 2023 13:39:29 +0500 Subject: [PATCH] Develop to Goerli (#154) * fix: disable banner * fix: rpc checker in ETH Widget IPFS in any chain * fix: remove 1inch withdrawals integration * fix: disable getInitialProps in infra mode * feat(AppWrapper): remove getInitialProps * feat: remove AppWrapperProps, remove passing envConfig to Providers * fix: use reef-knot 1.11.1 1. Hotfix for autoconnect 2. Remove some wallets * fix(providers): move envConfig parsing to contextValue memorized * fix: remove resolutions duplicate * feat: add link-arrow component * feat(ipfs-info-box): use link-arrow component * refactor(settings page): faq styles * feat(api rewards): cors * feat(settings): clear errors after click to reset button * fix: remove a page refresh when come to Withdrawals * fix(navigation): is active link * fix(SwitchItem): click area * chore: update yarn * feat: retern 1inch withdrawals integration * fix: dex-options placeholder amount --------- Co-authored-by: Anna <104974099+AnnaSila@users.noreply.github.com> Co-authored-by: Evgeny Taktarov Co-authored-by: Anton Shalimov Co-authored-by: Alexander Khramov --- features/home/stake-form/stake-form.tsx | 2 - features/ipfs/ipfs-info-box/ipfs-info-box.tsx | 14 ++---- features/ipfs/ipfs-info-box/styles.tsx | 23 --------- .../settings/settings-form/settings-form.tsx | 10 ++-- features/settings/settings-form/styles.ts | 15 +++--- package.json | 2 +- pages/api/rewards.ts | 5 ++ .../components/navigation/navigation.tsx | 7 +-- shared/components/link-arrow/link-arrow.tsx | 34 +++++++++++++ shared/components/switch/styles.tsx | 8 +++- shared/components/switch/switch-item.tsx | 11 ++--- shared/components/switch/types.ts | 2 +- yarn.lock | 48 +++++++++---------- 13 files changed, 96 insertions(+), 85 deletions(-) create mode 100644 shared/components/link-arrow/link-arrow.tsx diff --git a/features/home/stake-form/stake-form.tsx b/features/home/stake-form/stake-form.tsx index 1d4fbc29b..966a67259 100644 --- a/features/home/stake-form/stake-form.tsx +++ b/features/home/stake-form/stake-form.tsx @@ -26,7 +26,6 @@ import { DataTableRow, Eth, } from '@lidofinance/lido-ui'; -import { L2Swap } from 'shared/banners'; import { DATA_UNAVAILABLE } from 'config'; import { Connect } from 'shared/wallet'; import { TxStageModal, TX_OPERATION, TX_STAGE } from 'shared/components'; @@ -220,7 +219,6 @@ export const StakeForm: FC = memo(() => { ) : ( )} - diff --git a/features/ipfs/ipfs-info-box/ipfs-info-box.tsx b/features/ipfs/ipfs-info-box/ipfs-info-box.tsx index 3483e660f..695c7adf9 100644 --- a/features/ipfs/ipfs-info-box/ipfs-info-box.tsx +++ b/features/ipfs/ipfs-info-box/ipfs-info-box.tsx @@ -5,16 +5,10 @@ import { useRpcUrl } from 'config/rpc'; import { SETTINGS_PATH } from 'config/urls'; import { usePrefixedPush } from 'shared/hooks/use-prefixed-history'; import { useRouterPath } from 'shared/hooks/use-router-path'; +import { LinkArrow } from 'shared/components/link-arrow/link-arrow'; import { Check, Close } from '@lidofinance/lido-ui'; -import { - Wrap, - RpcStatusBox, - Button, - InfoLink, - LinkArrow, - Text, -} from './styles'; +import { Wrap, RpcStatusBox, Button, Text } from './styles'; import { checkRpcUrl } from 'utils/check-rpc-url'; import { STORAGE_IPFS_INFO_DISMISS } from 'config/storage'; @@ -58,9 +52,7 @@ export const IPFSInfoBox = () => { You are currently using the IPFS widget's version. - - IPFS - + IPFS {rpcCheckResult === true && ( <> diff --git a/features/ipfs/ipfs-info-box/styles.tsx b/features/ipfs/ipfs-info-box/styles.tsx index 3119459ed..a83707475 100644 --- a/features/ipfs/ipfs-info-box/styles.tsx +++ b/features/ipfs/ipfs-info-box/styles.tsx @@ -1,9 +1,7 @@ import { ComponentProps, FC } from 'react'; import styled, { css } from 'styled-components'; import { - ArrowBack, Button as ButtonOriginal, - Link, Text as TextOriginal, themeDefault, } from '@lidofinance/lido-ui'; @@ -87,24 +85,3 @@ export const Button = styled(ButtonOriginal)` background-color: rgba(225, 225, 225); } `; - -export const InfoLink = styled(Link)` - display: flex; - align-items: center; - font-weight: 700; - width: fit-content; - - &:hover svg { - transform: rotate(180deg) translateX(-2px); - } -`; - -export const LinkArrow = styled(ArrowBack)` - display: block; - margin-left: 3px; - width: 16px; - height: 16px; - transform: rotate(180deg); - transition: transform ${({ theme }) => theme.ease.outCubic} - ${({ theme }) => theme.duration.med}; -`; diff --git a/features/settings/settings-form/settings-form.tsx b/features/settings/settings-form/settings-form.tsx index 7e922108b..778aa738d 100644 --- a/features/settings/settings-form/settings-form.tsx +++ b/features/settings/settings-form/settings-form.tsx @@ -5,6 +5,7 @@ import { useSDK } from '@lido-sdk/react'; import { Button, ToastSuccess, Block, Input } from '@lidofinance/lido-ui'; import { useClientConfig } from 'providers/client-config'; +import { LinkArrow } from 'shared/components/link-arrow/link-arrow'; import { RPCErrorType, checkRpcUrl } from 'utils/check-rpc-url'; import { CHAINS } from 'utils/chains'; @@ -36,6 +37,7 @@ export const SettingsForm = () => { setValue, getValues, formState: { errors }, + clearErrors, } = formMethods; const saveSettings = useCallback( @@ -78,8 +80,9 @@ export const SettingsForm = () => { const handleReset = useCallback(() => { setValue('rpcUrl', ''); saveSettings(getValues()); + clearErrors(); ToastSuccess('Settings have been reset'); - }, [setValue, saveSettings, getValues]); + }, [clearErrors, setValue, saveSettings, getValues]); return ( @@ -122,14 +125,13 @@ export const SettingsForm = () => { visiting the link below.

- Ethereum nodes:{' '} - ethereumnodes.com - +

The settings are being saved in your browser's diff --git a/features/settings/settings-form/styles.ts b/features/settings/settings-form/styles.ts index 56472e845..46d1c4157 100644 --- a/features/settings/settings-form/styles.ts +++ b/features/settings/settings-form/styles.ts @@ -22,12 +22,13 @@ export const Actions = styled.div` `; export const DescriptionText = styled.div` - font-size: ${({ theme }) => theme.fontSizesMap.xs}px; - font-weight: 500; - line-height: 1.5; + font-size: ${({ theme }) => theme.fontSizesMap.xxs}px; + font-weight: 400; + line-height: 1.6em; + color: var(--lido-color-textSecondary); & p:not(:last-child) { - margin-bottom: ${({ theme }) => theme.spaceMap.sm}px; + margin-bottom: 10px; } & a { @@ -37,10 +38,10 @@ export const DescriptionText = styled.div` `; export const DescriptionTitle = styled.div` - margin-bottom: ${({ theme }) => theme.spaceMap.sm}px; - font-size: ${({ theme }) => theme.fontSizesMap.sm}px; + margin-bottom: 30px; + font-size: ${({ theme }) => theme.fontSizesMap.xs}px; font-weight: 800; - line-height: 1.5; + line-height: 1.6em; color: var(--lido-color-text); &:not(:first-child) { diff --git a/package.json b/package.json index 1836a081a..c9b55a504 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "react-hook-form": "^7.45.2", "react-is": "^18.2.0", "react-transition-group": "^4.4.2", - "reef-knot": "^1.10.6", + "reef-knot": "^1.11.1", "remark": "^13.0.0", "remark-external-links": "^8.0.0", "remark-html": "^13.0.1", diff --git a/pages/api/rewards.ts b/pages/api/rewards.ts index 4c271834e..abfaed6a9 100644 --- a/pages/api/rewards.ts +++ b/pages/api/rewards.ts @@ -8,6 +8,9 @@ import { responseTimeMetric, rateLimit, responseTimeExternalMetricWrapper, + httpMethodGuard, + HttpMethod, + cors, } from 'utilsApi'; import Metrics from 'utilsApi/metrics'; import { CACHE_REWARDS_HEADERS, API_ROUTES } from 'config'; @@ -54,6 +57,8 @@ const rewards: API = async (req, res) => { }; export default wrapNextRequest([ + httpMethodGuard([HttpMethod.GET]), + cors({ origin: ['*'], methods: [HttpMethod.GET] }), rateLimit, responseTimeMetric(Metrics.request.apiTimings, API_ROUTES.REWARDS), cacheControl({ headers: CACHE_REWARDS_HEADERS }), diff --git a/shared/components/header/components/navigation/navigation.tsx b/shared/components/header/components/navigation/navigation.tsx index 4d3f1ab59..091b4b6d7 100644 --- a/shared/components/header/components/navigation/navigation.tsx +++ b/shared/components/header/components/navigation/navigation.tsx @@ -4,7 +4,6 @@ import { Wallet, Stake, Wrap, Withdraw } from '@lidofinance/lido-ui'; import { HOME_PATH, WRAP_PATH, - WITHDRAWALS_PATH, WITHDRAWALS_REQUEST_PATH, REWARDS_PATH, } from 'config/urls'; @@ -27,7 +26,7 @@ const routes = [ }, { name: 'Withdrawals', - path: WITHDRAWALS_PATH, + path: WITHDRAWALS_REQUEST_PATH, full_path: WITHDRAWALS_REQUEST_PATH, icon: , }, @@ -39,12 +38,14 @@ const routes = [ ]; export const Navigation: FC = memo(() => { const pathname = useRouterPath(); + const pathnameWithoutQuery = pathname.split('?')[0]; return (