Skip to content

Commit

Permalink
update tool tip profile
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Oct 19, 2023
1 parent 132c450 commit 864686d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
40 changes: 33 additions & 7 deletions src/pages/NotificationCenter/NotificationPreference/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Trans, t } from '@lingui/macro'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { ReactNode, useCallback, useEffect, useMemo, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { Text } from 'rebass'
import styled from 'styled-components'

Expand All @@ -11,12 +12,14 @@ import Loader from 'components/Loader'
import Row from 'components/Row'
import { MouseoverTooltip } from 'components/Tooltip'
import { PRICE_ALERT_TOPIC_ID } from 'constants/env'
import { APP_PATHS } from 'constants/index'
import { useActiveWeb3React } from 'hooks'
import useMixpanel, { MIXPANEL_TYPE } from 'hooks/useMixpanel'
import useNotification, { Topic, TopicType } from 'hooks/useNotification'
import useTheme from 'hooks/useTheme'
import ActionButtons from 'pages/NotificationCenter/NotificationPreference/ActionButtons'
import InputEmail from 'pages/NotificationCenter/NotificationPreference/InputEmail'
import { PROFILE_MANAGE_ROUTES } from 'pages/NotificationCenter/const'
import VerifyCodeModal from 'pages/Verify/VerifyCodeModal'
import { useNotify } from 'state/application/hooks'
import { useSessionInfo } from 'state/authen/hooks'
Expand Down Expand Up @@ -336,7 +339,7 @@ function NotificationPreference({ toggleModal = noop }: { toggleModal?: () => vo
}, [topicGroupsGlobal])

const totalTopic = commons.length + restrict.length
const renderTopic = (topic: Topic, disabled: boolean, disableTooltip?: string) => {
const renderTopic = (topic: Topic, disabled: boolean, disableTooltip?: ReactNode) => {
return (
<MouseoverTooltip text={disabled ? disableTooltip : ''} key={topic.id}>
<TopicItem key={topic.id} htmlFor={`topic${topic.id}`} style={{ alignItems: 'flex-start' }}>
Expand All @@ -361,6 +364,7 @@ function NotificationPreference({ toggleModal = noop }: { toggleModal?: () => vo
)
}

const navigate = useNavigate()
return (
<Wrapper>
<Text fontWeight={'500'} color={theme.text} fontSize="14px">
Expand Down Expand Up @@ -401,11 +405,33 @@ function NotificationPreference({ toggleModal = noop }: { toggleModal?: () => vo
const disableKyberAI = disableCheckbox || !isLogin || !isWhiteList
return renderTopic(
topic,
(() => (topic.isKyberAI ? disableKyberAI : disableCheckbox || !isLogin))(),
topic.isKyberAI && disableKyberAI
? t`You must be whitelisted to subscribe/unsubscribe this topic`
: t`These notifications can only be subscribed by a signed-in profile. Go to Profile tab to sign-in with your wallet
`,
topic.isKyberAI ? disableKyberAI : disableCheckbox || !isLogin,
topic.isKyberAI && disableKyberAI ? (
<Trans>
Before you can subscribe to KyberAI notifications, you need to be whitelisted. Register for KyberAI{' '}
<Text
sx={{ cursor: 'pointer' }}
as="span"
color={theme.primary}
onClick={() => navigate(APP_PATHS.KYBERAI_ABOUT)}
>
here
</Text>
</Trans>
) : (
<Trans>
Before you can subscribe to this notification, sign-in to a profile first. Go the{' '}
<Text
sx={{ cursor: 'pointer' }}
as="span"
color={theme.primary}
onClick={() => navigate(`${APP_PATHS.PROFILE_MANAGE}${PROFILE_MANAGE_ROUTES.PROFILE}`)}
>
Profile
</Text>{' '}
tab to sign-in with your wallet
</Trans>
),
)
})}
</GroupColum>
Expand Down
2 changes: 1 addition & 1 deletion src/state/crossChain/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const DEFAULT_STATE: CrossChainState = {
},

crossChain: {
inputAmount: '',
inputAmount: '1',
chains: [],
tokens: [],
currencyIn: undefined,
Expand Down

0 comments on commit 864686d

Please sign in to comment.