diff --git a/src/components/StakeMaskStatusCard/index.tsx b/src/components/StakeMaskStatusCard/index.tsx index 4817c33..5c873d8 100644 --- a/src/components/StakeMaskStatusCard/index.tsx +++ b/src/components/StakeMaskStatusCard/index.tsx @@ -170,7 +170,7 @@ export const StakeMaskStatusCard: FC = ({ ...props }) spacing={6} > {pool?.apr ? ( - + { + const [overflow, ref] = useDetectOverflow() + + return ( + + {cloneElement(children, { ...children.props, ref })} + + ) +}) + +TextOverflowTooltip.displayName = 'TextOverflowTooltip' diff --git a/src/components/UserStatus/UserTotalPoint.tsx b/src/components/UserStatus/UserTotalPoint.tsx index de55711..3d96309 100644 --- a/src/components/UserStatus/UserTotalPoint.tsx +++ b/src/components/UserStatus/UserTotalPoint.tsx @@ -1,6 +1,7 @@ import { Image, VStack, Text, Box, StackProps } from '@chakra-ui/react' import { t } from '@lingui/macro' import { UserInfo } from '../../types/api' +import { TextOverflowTooltip } from '../TextOverflowTooltip' interface Props extends StackProps { user: UserInfo @@ -8,26 +9,40 @@ interface Props extends StackProps { export function UserTotalPoints({ user, ...props }: Props) { return ( - - + + user name - - {user.twitter_display_name || 'N/A'} - + + + {user.twitter_display_name || 'N/A'} + + - - - - + + + + ) } diff --git a/src/hooks/useDetectOverflow.ts b/src/hooks/useDetectOverflow.ts new file mode 100644 index 0000000..e9319c9 --- /dev/null +++ b/src/hooks/useDetectOverflow.ts @@ -0,0 +1,10 @@ +import { useState, useCallback } from 'react' + +export function useDetectOverflow(): [overflow: boolean, ref: (node: T | null) => void] { + const [overflow, setOverflow] = useState(false) + const ref = useCallback((node: T | null) => { + if (node) setOverflow(node.offsetWidth !== node.scrollWidth) + }, []) + + return [overflow, ref] +} diff --git a/src/hooks/useUserInfo.ts b/src/hooks/useUserInfo.ts index 31e609a..6565ac6 100644 --- a/src/hooks/useUserInfo.ts +++ b/src/hooks/useUserInfo.ts @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query' import { fetchJSON } from '../helpers/fetchJSON' import { FIREFLY_API_ROOT } from '../constants/api' -import { UserInfoResponse } from '../types/api' +import { UserInfo, UserInfoResponse } from '../types/api' import urlcat from 'urlcat' export function useUserInfo(address: string | undefined, pool_id: number | null) { @@ -15,5 +15,12 @@ export function useUserInfo(address: string | undefined, pool_id: number | null) }) return fetchJSON(url) }, + select(res) { + if (!res.data) return res.data + return { + ...res.data, + twitter_image: res.data.twitter_image.replace(/_normal.(jpe?g|png|gif|bmp)/, '_400x400.$1'), + } as UserInfo + }, }) } diff --git a/src/modals/BaseModal.tsx b/src/modals/BaseModal.tsx index 66ee20d..cea5929 100644 --- a/src/modals/BaseModal.tsx +++ b/src/modals/BaseModal.tsx @@ -27,7 +27,6 @@ interface Props extends ModalProps { } export function BaseModal({ title, width, height, ...rest }: Props) { const isMobile = useBreakpointValue({ base: true, md: false }) - console.log({ isMobile }) const header = ( <> {title} diff --git a/src/modals/CookiePolicyModal.tsx b/src/modals/CookiePolicyModal.tsx index 65a3b98..a7721b1 100644 --- a/src/modals/CookiePolicyModal.tsx +++ b/src/modals/CookiePolicyModal.tsx @@ -10,14 +10,14 @@ const CookiePolicyContent = () => (
{t`Cookies are small text files that are stored on your computer or mobile device when you visit a website. They are used to store information about you and your internet usage habits to improve your online experience. Cookies enable websites to recognize your device and remember some information about your preferences.`}

-

+

{t`Types of Cookies We Use`}
  • {t`Session Cookies: These cookies exist only during your visit to the website and are automatically deleted when you close your browser. They are used to maintain session state, such as storing the contents of your shopping cart.`}
  • {t`Persistent Cookies: These cookies are stored on your device until they reach their expiration date or are manually deleted. They are used to remember your preferences and provide a personalized experience when you revisit the website.`}
  • {t`Third-Party Cookies: The Site may use cookies from third-party service providers for traffic analysis and user behavior tracking, as well as to display ads relevant to your interests.`}
-

+

{t`How to Control Cookies`}
diff --git a/src/modals/StakeModal.tsx b/src/modals/StakeModal.tsx index 4db9b4b..8efe022 100644 --- a/src/modals/StakeModal.tsx +++ b/src/modals/StakeModal.tsx @@ -17,22 +17,24 @@ import { VStack, } from '@chakra-ui/react' import { Trans, t } from '@lingui/macro' +import { useConnectModal } from '@rainbow-me/rainbowkit' import dayjs from 'dayjs' import { useState } from 'react' import { useAccount, useBalance } from 'wagmi' import { StepIcon } from '../components/StepIcon' import { TokenIcon } from '../components/TokenIcon' +import { Tooltip } from '../components/Tooltip.tsx' import { formatNumber } from '../helpers/formatNumber' import { useLinkTwitter } from '../hooks/useLinkTwitter' import { usePoolInfo } from '../hooks/usePoolInfo' import { usePoolStore } from '../store/poolStore' -import { Tooltip } from '../components/Tooltip.tsx' import { BaseModal } from './BaseModal' interface Props extends ModalProps {} export function StakeModal(props: Props) { const account = useAccount() + const { openConnectModal } = useConnectModal() const { data: pool } = usePoolInfo() const { maskTokenAddress } = usePoolStore() const [amount, setAmount] = useState('') @@ -55,6 +57,9 @@ export function StakeModal(props: Props) { ml="auto" fontSize={14} rounded={24} + onClick={() => { + openConnectModal?.() + }} >{t`Connect Wallet`} )}