Skip to content

Commit

Permalink
chore: remove old select (#2281)
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh authored Oct 6, 2023
1 parent 1293920 commit 7a6feb1
Show file tree
Hide file tree
Showing 20 changed files with 191 additions and 868 deletions.
1 change: 0 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ jobs:
NODE_OPTIONS: '--max_old_space_size=4096'
run: yarn build-prod


- name: Docker build and push
uses: docker/build-push-action@v2
with:
Expand Down
58 changes: 18 additions & 40 deletions src/components/KyberAITokenBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import useMixpanel, { MIXPANEL_TYPE } from 'hooks/useMixpanel'
import useTheme from 'hooks/useTheme'
import KyberScoreMeter from 'pages/TrueSightV2/components/KyberScoreMeter'
import { NETWORK_TO_CHAINID } from 'pages/TrueSightV2/constants'
import { SUPPORTED_NETWORK_KYBERAI } from 'pages/TrueSightV2/constants/index'
import { useTokenOverviewQuery } from 'pages/TrueSightV2/hooks/useKyberAIData'
import { calculateValueToColor } from 'pages/TrueSightV2/utils'
import { useIsWhiteListKyberAI, useShowKyberAIBanner } from 'state/user/hooks'
Expand All @@ -36,7 +35,6 @@ const KyberAITokenBanner = ({
const { chainId, account } = useActiveWeb3React()
const { isWhiteList } = useIsWhiteListKyberAI()
const isShowKyberAIBanner = useShowKyberAIBanner()

const { mixpanelHandler } = useMixpanel()
const chain = Object.keys(NETWORK_TO_CHAINID).find(i => NETWORK_TO_CHAINID[i] === chainId)
const above768 = useMedia(`(min-width:${MEDIA_WIDTHS.upToSmall}px)`)
Expand Down Expand Up @@ -68,7 +66,7 @@ const KyberAITokenBanner = ({
{ skip: !account || !isWhiteList || !chain || !isShowKyberAIBanner, refetchOnMountOrArgChange: true },
)

const token: { kyberScore?: number; label?: string; address?: string; logo?: string; symbol?: string } | undefined =
const token: { kyberScore?: number; label?: string; assetId?: number; logo?: string; symbol?: string } | undefined =
useMemo(() => {
if (staticMode) {
return undefined
Expand All @@ -88,7 +86,7 @@ const KyberAITokenBanner = ({
return {
kyberScore: token?.kyberScore?.score,
label: token?.kyberScore?.label,
address: '', //todo
assetId: token?.assetId,
logo: token?.logo,
symbol: token?.symbol,
}
Expand All @@ -99,24 +97,23 @@ const KyberAITokenBanner = ({
if (staticMode && isStableCoin(currencyIn?.wrapped.address.toLowerCase())) return null
const staticModeCurrency = !currencyIn || KNC[chainId].equals(currencyIn) ? NativeCurrencies[chainId] : currencyIn
const color = staticMode ? theme.primary : calculateValueToColor(token?.kyberScore || 0, theme)

const handleBannerClick = () => {
if (staticMode) {
window.open(APP_PATHS.KYBERAI_ABOUT, '_blank')
} else {
if (!token) return
window.open(APP_PATHS.KYBERAI_EXPLORE + '/' + token?.assetId, '_blank')
}
mixpanelHandler(MIXPANEL_TYPE.KYBERAI_SWAP_INSIGHT_CLICK, {
input_token: token0?.symbol?.toUpperCase(),
output_token: token1?.symbol?.toUpperCase(),
})
}
return (
<Wrapper>
{above768 ? (
<Container
color={color}
onClick={() => {
mixpanelHandler(MIXPANEL_TYPE.KYBERAI_SWAP_INSIGHT_CLICK, {
input_token: token0?.symbol?.toUpperCase(),
output_token: token1?.symbol?.toUpperCase(),
})
staticMode
? window.open(APP_PATHS.KYBERAI_ABOUT, '_blank')
: window.open(
APP_PATHS.KYBERAI_EXPLORE + '/' + SUPPORTED_NETWORK_KYBERAI[chainId] + '/' + token?.address,
'_blank',
)
}}
>
<Container color={color} onClick={handleBannerClick}>
<RowFit gap="8px">
{staticMode ? (
<CurrencyLogo currency={staticModeCurrency} size={'32px'} />
Expand Down Expand Up @@ -172,19 +169,7 @@ const KyberAITokenBanner = ({
</Text>{' '}
here!{' '}
</Trans>
<ArrowRight
size={14}
stroke={theme.primary}
style={{ cursor: 'pointer' }}
onClick={() => {
mixpanelHandler(MIXPANEL_TYPE.KYBERAI_SWAP_INSIGHT_CLICK, {
input_token: token0?.symbol?.toUpperCase(),
output_token: token1?.symbol?.toUpperCase(),
})

//navigate(APP_PATHS.KYBERAI_EXPLORE + '/' + SUPPORTED_NETWORK_KYBERAI[chainId] + '/' + token?.address)
}}
/>
<ArrowRight size={14} stroke={theme.primary} style={{ cursor: 'pointer' }} />
</RowFit>
</Column>
<div style={{ width: '100px' }}></div>
Expand All @@ -193,14 +178,7 @@ const KyberAITokenBanner = ({
<MobileContainer
color={color}
onClick={() => {
mixpanelHandler(MIXPANEL_TYPE.KYBERAI_SWAP_INSIGHT_CLICK, {
input_token: token0?.symbol?.toUpperCase(),
output_token: token1?.symbol?.toUpperCase(),
})
// window.open(
// APP_PATHS.KYBERAI_EXPLORE + '/' + SUPPORTED_NETWORK_KYBERAI[chainId] + '/' + token?.address,
// '_blank',
// )
handleBannerClick
}}
>
<RowBetween>
Expand Down
179 changes: 0 additions & 179 deletions src/components/Select.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const SelectButton: React.FC<Props> = ({ selectedChainIds, chainIds, activeRende
paddingRight: '8px',
justifyContent: 'space-between',
alignItems: 'center',
background: theme.background,
userSelect: 'none',
cursor: 'pointer',
...activeStyle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styled, { CSSProperties } from 'styled-components'

import { ReactComponent as LogoKyber } from 'assets/svg/logo_kyber.svg'
import Checkbox from 'components/CheckBox'
import Select from 'components/SelectV2'
import Select from 'components/Select'
import { MouseoverTooltip } from 'components/Tooltip'
import { NETWORKS_INFO } from 'constants/networks'
import useChainsConfig from 'hooks/useChainsConfig'
Expand Down Expand Up @@ -67,6 +67,14 @@ const Label = styled.span`
user-select: none;
`

const StyledSelect = styled(Select)`
flex: 0 0 150px;
width: 150px;
position: relative;
border-radius: 18px;
background-color: ${({ theme }) => theme.buttonGray};
`

const MultipleChainSelect: React.FC<MultipleChainSelectProps> = ({ className, style, ...props }) => {
const { comingSoonList = [], selectedChainIds = [], handleChangeChains, chainIds = [], onTracking } = props
const options = chainIds.map(id => ({ value: id, label: id }))
Expand Down Expand Up @@ -107,10 +115,10 @@ const MultipleChainSelect: React.FC<MultipleChainSelectProps> = ({ className, st
}, [selectedChains])

return (
<Select
<StyledSelect
onHideMenu={onHideMenu}
className={className}
style={{ ...style, flex: '0 0 150px', width: '150px', position: 'relative', zIndex: '3' }}
style={style}
activeRender={_ => <SelectButton {...props} />}
options={options}
optionStyle={{ padding: 0 }}
Expand Down
Loading

0 comments on commit 7a6feb1

Please sign in to comment.