Skip to content

Commit

Permalink
Profile improvemnt v2 (#2077)
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh authored Jul 19, 2023
1 parent 7090e4f commit 26bfd05
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 17 deletions.
1 change: 0 additions & 1 deletion .env.adpr
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion .env.dev
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion .env.stg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ function NotificationPreference({

const [selectedTopic, setSelectedTopic] = useState<number[]>([])

const notFillEmail = !inputEmail

const updateTopicGroupsLocal = useCallback(
(subIds: number[], unsubIds: number[]) => {
const newTopicGroups = topicGroupsGlobal.map(group => {
Expand Down Expand Up @@ -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 (
Expand All @@ -315,7 +313,7 @@ function NotificationPreference({

const checkProfileAndSave = () => {
if (disableButtonSave) return
if (!userInfo?.email && !isIncludePriceAlert()) {
if (needVerifyEmail && !isIncludePriceAlert()) {
showVerifyModal()
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -62,9 +62,9 @@ const GasPriceTrackerSetting: React.FC<Props> = ({ onClick }) => {

return (
<Container onClick={onClick}>
<SettingLabel>
<TextDashed fontSize={12} fontWeight={400} color={theme.subText} underlineColor={theme.border}>
<Trans>Gas Price Tracker</Trans>
</SettingLabel>
</TextDashed>

<Group>
<PriceInWei>{getPriceInGweiText(data[GasLevel.NORMAL].gasPriceInGwei)}</PriceInWei>
Expand Down
1 change: 0 additions & 1 deletion src/constants/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useKyberSwapConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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`,
Expand Down
7 changes: 5 additions & 2 deletions src/utils/iamError.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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
Expand Down Expand Up @@ -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 ?? ''

Expand Down

0 comments on commit 26bfd05

Please sign in to comment.