From 26bfd0524d9fd2180de4ab182775dc0f0273124c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Ho=C3=A0i=20Danh?= <33005392+nguyenhoaidanh@users.noreply.github.com> Date: Wed, 19 Jul 2023 14:28:03 +0700 Subject: [PATCH] Profile improvemnt v2 (#2077) --- .env.adpr | 1 - .env.dev | 1 - .env.production | 1 - .env.stg | 1 - .../SubscribeButton/NotificationPreference/index.tsx | 6 ++---- .../swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx | 6 +++--- src/constants/env.ts | 1 - src/hooks/useKyberSwapConfig.ts | 6 +++--- src/utils/iamError.ts | 7 +++++-- 9 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.env.adpr b/.env.adpr index 74879a263b..66d33fd4bb 100644 --- a/.env.adpr +++ b/.env.adpr @@ -1,4 +1,3 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.dev.kyberengineering.io VITE_AGGREGATOR_API=https://aggregator-api.dev.kyberengineering.io VITE_AGGREGATOR_STATS_API=https://aggregator-stats.dev.kyberengineering.io VITE_SENTRY_DNS=https://d94ee2d3c22043bdaec966758680b5a8@sentry.ops.kyberengineering.io/4 diff --git a/.env.dev b/.env.dev index 74879a263b..66d33fd4bb 100644 --- a/.env.dev +++ b/.env.dev @@ -1,4 +1,3 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.dev.kyberengineering.io VITE_AGGREGATOR_API=https://aggregator-api.dev.kyberengineering.io VITE_AGGREGATOR_STATS_API=https://aggregator-stats.dev.kyberengineering.io VITE_SENTRY_DNS=https://d94ee2d3c22043bdaec966758680b5a8@sentry.ops.kyberengineering.io/4 diff --git a/.env.production b/.env.production index 5f433581ea..25a41bb57f 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,3 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator-api.kyberswap.com VITE_AGGREGATOR_API=https://aggregator-api.kyberswap.com VITE_AGGREGATOR_STATS_API=https://aggregator-stats.kyberswap.com VITE_SENTRY_DNS=https://d94ee2d3c22043bdaec966758680b5a8@sentry.ops.kyberengineering.io/4 diff --git a/.env.stg b/.env.stg index 326145bd06..df9dddb900 100644 --- a/.env.stg +++ b/.env.stg @@ -1,4 +1,3 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.stg.kyberengineering.io VITE_AGGREGATOR_API=https://aggregator-api.stg.kyberengineering.io VITE_AGGREGATOR_STATS_API=https://aggregator-stats.kyberswap.com VITE_SENTRY_DNS=https://d94ee2d3c22043bdaec966758680b5a8@sentry.ops.kyberengineering.io/4 diff --git a/src/components/SubscribeButton/NotificationPreference/index.tsx b/src/components/SubscribeButton/NotificationPreference/index.tsx index 7f92a81bb7..f6d7253857 100644 --- a/src/components/SubscribeButton/NotificationPreference/index.tsx +++ b/src/components/SubscribeButton/NotificationPreference/index.tsx @@ -175,8 +175,6 @@ function NotificationPreference({ const [selectedTopic, setSelectedTopic] = useState([]) - const notFillEmail = !inputEmail - const updateTopicGroupsLocal = useCallback( (subIds: number[], unsubIds: number[]) => { const newTopicGroups = topicGroupsGlobal.map(group => { @@ -295,7 +293,7 @@ function NotificationPreference({ const isVerifiedEmail = userInfo?.email && inputEmail === userInfo?.email const needVerifyEmail = inputEmail && inputEmail !== userInfo?.email - const disableCheckbox = needVerifyEmail || notFillEmail || hasErrorInput + const disableCheckbox = hasErrorInput const isIncludePriceAlert = useCallback(() => { const changedData = getDiffChangeTopics(topicGroups) return ( @@ -315,7 +313,7 @@ function NotificationPreference({ const checkProfileAndSave = () => { if (disableButtonSave) return - if (!userInfo?.email && !isIncludePriceAlert()) { + if (needVerifyEmail && !isIncludePriceAlert()) { showVerifyModal() return } diff --git a/src/components/swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx b/src/components/swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx index 766820b96e..1b6f2d105b 100644 --- a/src/components/swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx +++ b/src/components/swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx @@ -4,7 +4,7 @@ import { isMobile } from 'react-device-detect' import { ChevronRight } from 'react-feather' import styled from 'styled-components' -import SettingLabel from 'components/swapv2/SwapSettingsPanel/SettingLabel' +import { TextDashed } from 'components/Tooltip' import useGasPriceFromDeBank, { GasLevel } from 'hooks/useGasPriceFromDeBank' import useTheme from 'hooks/useTheme' @@ -62,9 +62,9 @@ const GasPriceTrackerSetting: React.FC = ({ onClick }) => { return ( - + Gas Price Tracker - + {getPriceInGweiText(data[GasLevel.NORMAL].gasPriceInGwei)} diff --git a/src/constants/env.ts b/src/constants/env.ts index a99a4387df..27501c13fb 100644 --- a/src/constants/env.ts +++ b/src/constants/env.ts @@ -13,7 +13,6 @@ const required = (envKey: string): string => { export const GOOGLE_RECAPTCHA_KEY = required('GOOGLE_RECAPTCHA_KEY') export const PRICE_API = required('PRICE_API') -export const DEFAULT_AGGREGATOR_API = required('DEFAULT_AGGREGATOR_API') export const AGGREGATOR_API = required('AGGREGATOR_API') export const SENTRY_DNS = required('SENTRY_DNS') export const REWARD_SERVICE_API = required('REWARD_SERVICE_API') diff --git a/src/hooks/useKyberSwapConfig.ts b/src/hooks/useKyberSwapConfig.ts index 5ef8e6e7c0..60170afc8e 100644 --- a/src/hooks/useKyberSwapConfig.ts +++ b/src/hooks/useKyberSwapConfig.ts @@ -12,7 +12,7 @@ import { useLazyGetKyberswapConfigurationQuery, } from 'services/ksSetting' -import { DEFAULT_AGGREGATOR_API } from 'constants/env' +import { AGGREGATOR_API } from 'constants/env' import { NETWORKS_INFO, SUPPORTED_NETWORKS, isEVM, isSolana } from 'constants/networks' import ethereumInfo from 'constants/networks/ethereum' import solanaInfo from 'constants/networks/solana' @@ -65,8 +65,8 @@ const parseGlobalResponse = ( chainId: ChainId, ): KyberswapGlobalConfig => { const data = responseData?.data?.config - const aggregatorDomain = data?.aggregator ?? DEFAULT_AGGREGATOR_API - const isEnableAuthenAggregator = !data ? true : !!data?.isEnableAuthenAggregator + const aggregatorDomain = data?.aggregator ?? AGGREGATOR_API + const isEnableAuthenAggregator = !!data?.isEnableAuthenAggregator return { aggregatorDomain, aggregatorAPI: `${aggregatorDomain}/${NETWORKS_INFO[chainId].aggregatorRoute}/route/encode`, diff --git a/src/utils/iamError.ts b/src/utils/iamError.ts index e00f46b848..ccf46f6087 100644 --- a/src/utils/iamError.ts +++ b/src/utils/iamError.ts @@ -1,7 +1,7 @@ import { captureException } from '@sentry/react' import { AxiosError } from 'axios' -import { BFF_API, ENV_LEVEL } from 'constants/env' +import { BFF_API, ENV_KEY, ENV_LEVEL } from 'constants/env' import { AGGREGATOR_API_PATHS } from 'constants/index' import { ENV_TYPE } from 'constants/type' @@ -24,7 +24,7 @@ const sendError = (name: string, apiUrl: string, trackData: any) => { } // hot fix to prevent spam for now. -const blacklistPathBff = ['/v1/notification/me'] +const blacklistPathBff = ['/v1/notification/me', '/v1/tokens/score'] /** * check error status: blocked, maybe cors issues or server down @@ -52,6 +52,9 @@ export const checkIamDown = (axiosErr: AxiosError) => { statusCode, message: axiosErr?.message, code: axiosErr?.code, + tokenInfoSignIn: localStorage[`${ENV_KEY}_o2_sign_in`], + tokenInfoGuest: localStorage[`${ENV_KEY}_o2_guest`], + profileInfo: localStorage.redux_localstorage_simple_profile, } const apiUrl = axiosErr?.config?.url ?? ''