Skip to content

Commit

Permalink
feat: update connect wallets (#2249)
Browse files Browse the repository at this point in the history
  • Loading branch information
namgold authored Oct 13, 2023
1 parent 4cb133c commit 0e82e56
Show file tree
Hide file tree
Showing 28 changed files with 45 additions and 62 deletions.
2 changes: 1 addition & 1 deletion src/components/Header/web3/SelectWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function Web3StatusInner() {
id={TutorialIds.BUTTON_CONNECT_WALLET}
data-testid="button-connect-wallet"
>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)
}
Expand Down
46 changes: 13 additions & 33 deletions src/components/Header/web3/WalletModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
useWalletModalToggle,
} from 'state/application/hooks'
import { useIsConnectingWallet } from 'state/authen/hooks'
import { useIsAcceptedTerm } from 'state/user/hooks'
import { ExternalLink } from 'theme'
import { isEVMWallet, isOverriddenWallet, isSolanaWallet } from 'utils'

Expand Down Expand Up @@ -62,7 +61,7 @@ const ContentWrapper = styled.div`
`

const TermAndCondition = styled.div`
padding: 8px;
padding: 8px 16px;
font-size: 12px;
font-weight: 500;
line-height: 16px;
Expand Down Expand Up @@ -158,8 +157,6 @@ export default function WalletModal() {

const previousAccount = usePrevious(account)

const [isAcceptedTerm, setIsAcceptedTerm] = useIsAcceptedTerm()

const location = useLocation()
const { mixpanelHandler } = useMixpanel()

Expand Down Expand Up @@ -316,36 +313,19 @@ export default function WalletModal() {
</CloseIcon>
</RowBetween>
{(walletView === WALLET_VIEWS.ACCOUNT || walletView === WALLET_VIEWS.CHANGE_WALLET) && (
<TermAndCondition
onClick={() => {
if (!isAcceptedTerm) {
mixpanelHandler(MIXPANEL_TYPE.WALLET_CONNECT_ACCEPT_TERM_CLICK)
}
setIsAcceptedTerm(!isAcceptedTerm)
}}
>
<input
onChange={() => {
//
}}
type="checkbox"
checked={isAcceptedTerm}
data-testid="accept-term"
style={{ marginRight: '12px', height: '14px', width: '14px', minWidth: '14px', cursor: 'pointer' }}
/>
<TermAndCondition>
<Text color={theme.subText}>
<Trans>Accept </Trans>{' '}
<ExternalLink href={TERM_FILES_PATH.KYBERSWAP_TERMS} onClick={e => e.stopPropagation()}>
<Trans>KyberSwap&lsquo;s Terms of Use</Trans>
</ExternalLink>{' '}
<Trans>and</Trans>{' '}
<ExternalLink href={TERM_FILES_PATH.PRIVACY_POLICY} onClick={e => e.stopPropagation()}>
<Trans>Privacy Policy</Trans>
</ExternalLink>
{'. '}
<Text fontSize={10} as="span">
<Trans>Last updated: {dayjs(TERM_FILES_PATH.VERSION).format('DD MMM YYYY')}</Trans>
</Text>
<Trans>
By connecting a wallet, you accept{' '}
<ExternalLink href={TERM_FILES_PATH.KYBERSWAP_TERMS} onClick={e => e.stopPropagation()}>
KyberSwap&lsquo;s Terms of Use
</ExternalLink>{' '}
and consent to its{' '}
<ExternalLink href={TERM_FILES_PATH.PRIVACY_POLICY} onClick={e => e.stopPropagation()}>
Privacy Policy
</ExternalLink>
. Last updated: {dayjs(TERM_FILES_PATH.VERSION).format('DD MMM YYYY')}
</Trans>
</Text>
</TermAndCondition>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu/FaucetModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function FaucetModal() {
}}
style={{ borderRadius: '24px', height: '44px' }}
>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonPrimary>
)}
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SwapForm/SwapActionButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const SwapActionButton: React.FC<Props> = ({
if (!account) {
return (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/YieldPools/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ const ListItem = ({ farm }: ListItemProps) => {
<Flex marginTop="20px">
{!account ? (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : (
approvalState === ApprovalState.UNKNOWN && <Dots></Dots>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function ActionButtonLimitOrder({
if (!account)
return (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)

Expand Down
2 changes: 1 addition & 1 deletion src/pages/AddLiquidity/TokenPair.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ const TokenPair = ({

{!account ? (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : (
<AutoColumn gap={'md'}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AddLiquidity/ZapIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ const ZapIn = ({

{!account ? (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : (
<AutoColumn gap={'md'}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AddLiquidityV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ export default function AddLiquidity() {
const Buttons = () =>
!account ? (
<ButtonLight onClick={toggleWalletModal} width={upToMedium ? '100%' : 'fit-content'} minWidth="164px !important">
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : (
<Flex
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Bridge/SwapForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export default function SwapForm() {
)}
{!account ? (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : (
showApproveFlow && (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BuyCrypto/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ function BuyCrypto() {

{!account ? (
<ButtonLight margin={'16px 0 0'} width={upToSmall ? '100%' : '50%'} onClick={toggleWalletModal}>
Connect your wallet
Connect
</ButtonLight>
) : (
<Address>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Campaign/CampaignContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ export default function Campaign({ refreshListCampaign, ...props }: CampaignProp
style={{ gridColumn: '1 / -1', padding: '8px', margin: '0', borderRadius: '18px' }}
onClick={toggleWalletModal}
>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/CreatePool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ export default function CreatePool() {

{!account ? (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : (
<AutoColumn gap={'md'}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/CrossChain/SwapForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ export default function SwapForm() {
/>
) : (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/IncreaseLiquidity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export default function IncreaseLiquidity() {
</ButtonPrimary>
) : !account ? (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/KyberDAO/KNCUtility/GasRefundBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default function GasRefundBox() {
)
) : (
<ButtonLight onClick={toggleWalletModal} padding="10px 12px">
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)
) : selectedTab === KNCUtilityTabs.Pending && nextCycleStartTime ? (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/KyberDAO/StakeKNC/MigrateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default function MigrateModal({
</>
) : (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)}
</Row>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ export default function StakeKNCComponent() {
style={{ marginRight: '5px' }}
placement="top"
/>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)}
</>
Expand Down Expand Up @@ -603,7 +603,7 @@ export default function StakeKNCComponent() {
style={{ marginRight: '5px' }}
placement="top"
/>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)}
</>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/KyberDAO/Vote/ProposalItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const VoteButton = ({
</ButtonPrimary>
) : (
<ButtonLight width={isMobile ? '100%' : '200px'} onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/KyberDAO/Vote/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ export default function Vote() {
)
) : (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Your Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
)}
</AutoColumn>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/MyEarnings/Placeholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const Placeholder = () => {
}}
onClick={toggleWalletModal}
>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonPrimary>
</Flex>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/RemoveLiquidity/TokenPair.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ export default function TokenPair({
<div style={{ position: 'relative' }}>
{!account ? (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : (
<RowBetween>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/RemoveLiquidity/ZapOut.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ export default function ZapOut({
<div style={{ position: 'relative' }}>
{!account ? (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : (
<RowBetween>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SwapV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export default function Swap() {
<BottomGrouping>
{!account ? (
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonLight>
) : showWrap ? (
<ButtonPrimary disabled={Boolean(wrapInputError)} onClick={onWrap}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TrueSightV2/components/RequireConnectWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function RequireConnectWalletWrapper({
height="36px"
style={{ boxShadow: '0 2px 4px 2px #00000030' }}
>
<Trans>Connect Wallet</Trans>
<Trans>Connect</Trans>
</ButtonPrimary>
</StyledRequireConnectWalletWrapper>
)
Expand Down
2 changes: 1 addition & 1 deletion src/state/burn/proamm/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function useDerivedProAmmBurnInfo(
pool && position ? pool.tickCurrent < position.tickLower || pool.tickCurrent >= position.tickUpper : false
let error: ReactNode | undefined
if (!account) {
error = <Trans>Connect Wallet</Trans>
error = <Trans>Connect</Trans>
}
// if (percent === 0) {
// error = error ?? <Trans>Enter a percent</Trans>
Expand Down
4 changes: 2 additions & 2 deletions src/state/mint/proamm/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ export function useProAmmDerivedMintInfo(
const currencyBalanceB = currencyBalances?.[Field.CURRENCY_B]
const errorMessage: ReactNode | undefined = useMemo(() => {
if (!account) {
return <Trans>Connect Wallet</Trans>
return <Trans>Connect</Trans>
}

if (poolState === PoolState.INVALID) {
Expand Down Expand Up @@ -1068,7 +1068,7 @@ export function useProAmmDerivedAllMintInfo(

const errorMessage: ReactNode | undefined = useMemo(() => {
if (!account) {
return <Trans>Connect Wallet</Trans>
return <Trans>Connect</Trans>
}

if (poolState === PoolState.INVALID) {
Expand Down
5 changes: 4 additions & 1 deletion src/state/user/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ export function useUserLocaleManager(): [SupportedLocale | null, (newLocale: Sup
return [locale, setLocale]
}

// unused for now, but may be added again in the future. So we should keep it here.
export function useIsAcceptedTerm(): [boolean, (isAcceptedTerm: boolean) => void] {
const dispatch = useAppDispatch()
const acceptedTermVersion = useSelector<AppState, AppState['user']['acceptedTermVersion']>(
state => state.user.acceptedTermVersion,
)

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const isAcceptedTerm = !!acceptedTermVersion && acceptedTermVersion === TERM_FILES_PATH.VERSION

const setIsAcceptedTerm = useCallback(
Expand All @@ -116,7 +118,8 @@ export function useIsAcceptedTerm(): [boolean, (isAcceptedTerm: boolean) => void
[dispatch],
)

return [isAcceptedTerm, setIsAcceptedTerm]
// return [isAcceptedTerm, setIsAcceptedTerm]
return [true, setIsAcceptedTerm]
}

export function useDegenModeManager(): [boolean, () => void] {
Expand Down

0 comments on commit 0e82e56

Please sign in to comment.