From 23c7d201eecddf107efe36c81496fca66e3e7263 Mon Sep 17 00:00:00 2001 From: Slava Date: Thu, 14 Nov 2024 11:10:48 +0300 Subject: [PATCH 01/17] chore: add top user modal --- apps/evm/package.json | 3 +- .../evm/src/app/[lang]/apps/hooks/useVote.tsx | 5 +- apps/evm/src/app/[lang]/fusion/Fusion.tsx | 14 ++-- .../components/TopUserModal/TopUserModal.tsx | 61 +++++++++++++++++ .../fusion/components/TopUserModal/index.ts | 1 + apps/evm/src/app/[lang]/fusion/hooks/index.ts | 1 + .../fusion/hooks/useDismissTopUserModal.tsx | 30 +++++++++ apps/evm/src/lib/react-query/keys.ts | 7 +- apps/evm/src/locales/en.po | 67 ++++++++++++------- apps/evm/src/locales/zh.po | 67 ++++++++++++------- apps/evm/src/utils/api-client.ts | 12 ++++ pnpm-lock.yaml | 14 ++++ 12 files changed, 224 insertions(+), 58 deletions(-) create mode 100644 apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx create mode 100644 apps/evm/src/app/[lang]/fusion/components/TopUserModal/index.ts create mode 100644 apps/evm/src/app/[lang]/fusion/hooks/useDismissTopUserModal.tsx diff --git a/apps/evm/package.json b/apps/evm/package.json index 5e87ea1ba..5c19f42a1 100644 --- a/apps/evm/package.json +++ b/apps/evm/package.json @@ -36,9 +36,9 @@ "@react-aria/interactions": "^3.21.3", "@react-aria/label": "^3.7.6", "@react-aria/utils": "^3.23.2", - "@vercel/kv": "^3.0.0", "@sentry/nextjs": "^8.30.0", "@tanstack/react-store": "^0.5.6", + "@vercel/kv": "^3.0.0", "big.js": "^6.2.1", "date-fns": "^3.2.0", "graphql-request": "^6.1.0", @@ -46,6 +46,7 @@ "negotiator": "^0.6.3", "next": "^14.2.15", "react": "^18", + "react-calendly": "^4.3.1", "react-dom": "^18", "react-jazzicon": "^1.0.4", "react-multi-carousel": "^2.8.5", diff --git a/apps/evm/src/app/[lang]/apps/hooks/useVote.tsx b/apps/evm/src/app/[lang]/apps/hooks/useVote.tsx index bc2b7ea92..ee26873ea 100644 --- a/apps/evm/src/app/[lang]/apps/hooks/useVote.tsx +++ b/apps/evm/src/app/[lang]/apps/hooks/useVote.tsx @@ -1,5 +1,4 @@ import { useMutation, useQueryClient } from '@gobob/react-query'; -import { useAccount } from '@gobob/wagmi'; import { appsKeys, fusionKeys } from '@/lib/react-query'; import { apiClient } from '@/utils'; @@ -9,10 +8,8 @@ const useVote = () => { const queryClient = useQueryClient(); const { data: user } = useGetUser(); - const { address } = useAccount(); - return useMutation({ - mutationKey: appsKeys.vote(address), + mutationKey: appsKeys.vote(user?.username), mutationFn: async ({ isRetract, refCode }: { refCode: string; isRetract: boolean }) => { if (isRetract) { return apiClient.retractVote(refCode); diff --git a/apps/evm/src/app/[lang]/fusion/Fusion.tsx b/apps/evm/src/app/[lang]/fusion/Fusion.tsx index d08783e4d..4e660f845 100644 --- a/apps/evm/src/app/[lang]/fusion/Fusion.tsx +++ b/apps/evm/src/app/[lang]/fusion/Fusion.tsx @@ -3,7 +3,7 @@ import { Card, Flex, H1, H2, Link, P } from '@gobob/ui'; import { useAccount } from '@gobob/wagmi'; import { useCallback, useEffect, useId, useState } from 'react'; -import { useLocalStorage, useSessionStorage } from 'usehooks-ts'; +import { useIsClient, useLocalStorage, useSessionStorage } from 'usehooks-ts'; import { Trans, t } from '@lingui/macro'; import { useLingui } from '@lingui/react'; import x from '@public/assets/x.png'; @@ -29,12 +29,13 @@ import { StyledMain, StyledStrategiesWrapper } from './Fusion.style'; -import { useGetQuests } from './hooks'; +import { useDismissTopUserModal, useGetQuests } from './hooks'; import { LotterySection } from './components/LotterySections'; +import { TopUserModal } from './components/TopUserModal'; import { useGetUser } from '@/hooks'; import { Geoblock } from '@/components'; -import { isClient, LocalStorageKey } from '@/constants'; +import { LocalStorageKey } from '@/constants'; import { SessionStorageKey } from '@/types'; const Fusion = () => { @@ -43,6 +44,8 @@ const Fusion = () => { const { data: user } = useGetUser(); const { data: apps } = useGetApps(); const { data: quests } = useGetQuests(); + const { mutate: dismissTopUserModal } = useDismissTopUserModal(); + const isClient = useIsClient(); const questsSectionId = useId(); @@ -79,6 +82,7 @@ const Fusion = () => { const isAuthenticated = Boolean(user && address); const hasPastHarvest = user?.leaderboardRank && user.leaderboardRank.total_points > 0; + const isFusionTopUser = user?.notices.showIsFusionTopUser; return ( @@ -138,7 +142,9 @@ const Fusion = () => { {user ? ( - hasPastHarvest ? ( + isFusionTopUser ? ( + + ) : hasPastHarvest ? ( void; +}; + +type InheritAttrs = Omit; + +type TopUserModalProps = Props & InheritAttrs; + +const TopUserModal = ({ onClose, isOpen, ...props }: TopUserModalProps): JSX.Element => { + const [isCalendlyOpen, setIsCalendlyOpen] = useState(false); + + useCalendlyEventListener({ + onEventScheduled: onClose + }); + + return ( + <> + + +

+ You are one of the top 100 Spice holders in BOB Fusion +

+

+ + As one of our most important community members, we would love the opportunity to gain your input on the + BOB ecosystem and our future plans. + +

+

+ + BOB co-founder, Alexei Zamyatin, would like to invite you + to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please + click the button below to book a call at a time that suits you. + +

+
+ + + + +
+ setIsCalendlyOpen(false)} + /> + + ); +}; + +export { TopUserModal }; diff --git a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/index.ts b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/index.ts new file mode 100644 index 000000000..0500ddb6d --- /dev/null +++ b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/index.ts @@ -0,0 +1 @@ +export { TopUserModal } from './TopUserModal'; diff --git a/apps/evm/src/app/[lang]/fusion/hooks/index.ts b/apps/evm/src/app/[lang]/fusion/hooks/index.ts index 66bc75777..6b31d0fe5 100644 --- a/apps/evm/src/app/[lang]/fusion/hooks/index.ts +++ b/apps/evm/src/app/[lang]/fusion/hooks/index.ts @@ -1,2 +1,3 @@ export * from './useGetTokensInfo'; export * from './useGetQuests'; +export * from './useDismissTopUserModal'; diff --git a/apps/evm/src/app/[lang]/fusion/hooks/useDismissTopUserModal.tsx b/apps/evm/src/app/[lang]/fusion/hooks/useDismissTopUserModal.tsx new file mode 100644 index 000000000..9f187d581 --- /dev/null +++ b/apps/evm/src/app/[lang]/fusion/hooks/useDismissTopUserModal.tsx @@ -0,0 +1,30 @@ +import { useMutation } from '@gobob/react-query'; + +import { useGetUser } from '@/hooks'; +import { fusionKeys, queryClient } from '@/lib/react-query'; +import { apiClient, UserResponse } from '@/utils'; + +const useDismissTopUserModal = () => { + const { data: user } = useGetUser(); + + return useMutation({ + mutationKey: fusionKeys.topUserModal(user?.username), + mutationFn: () => apiClient.dismissTopUserModal(), + onSuccess() { + queryClient.setQueryData( + ['user'], + (oldData: UserResponse): UserResponse => ({ + ...oldData, + notices: { + showIsFusionTopUser: false + } + }) + ); + }, + onSettled() { + queryClient.refetchQueries({ queryKey: ['user'] }); + } + }); +}; + +export { useDismissTopUserModal }; diff --git a/apps/evm/src/lib/react-query/keys.ts b/apps/evm/src/lib/react-query/keys.ts index 675d7a497..ed68c0845 100644 --- a/apps/evm/src/lib/react-query/keys.ts +++ b/apps/evm/src/lib/react-query/keys.ts @@ -75,7 +75,7 @@ export const appsKeys = { apps: () => ['apps'], appsVotes: (username: string | undefined) => [...appsKeys.apps(), 'votes', username], appsResultVotes: () => [...appsKeys.apps(), 'result-votes'], - vote: (address: Address | undefined) => [appsKeys.apps(), 'vote', address] + vote: (username: string | undefined) => [appsKeys.apps(), 'vote', username] }; export const fusionKeys = { @@ -85,6 +85,7 @@ export const fusionKeys = { tokenInfo: () => [...fusionKeys.fusion(), 'token-info'], quests: () => [...fusionKeys.fusion(), 'quests'], tvlLevel: () => [...fusionKeys.fusion(), 'tvl-level'], - lotteryStats: (username: string | undefined) => [...fusionKeys.fusion(), 'lottery-stats', username] as string[], - lotteryRoll: (username: string | undefined) => [...fusionKeys.fusion(), 'lottery-roll', username] as string[] + lotteryStats: (username: string | undefined) => [...fusionKeys.fusion(), 'lottery-stats', username], + lotteryRoll: (username: string | undefined) => [...fusionKeys.fusion(), 'lottery-roll', username], + topUserModal: (username: string | undefined) => [...fusionKeys.fusion(), 'top-user-modal', username] }; diff --git a/apps/evm/src/locales/en.po b/apps/evm/src/locales/en.po index adf650fb5..6aadd7d61 100644 --- a/apps/evm/src/locales/en.po +++ b/apps/evm/src/locales/en.po @@ -120,7 +120,7 @@ msgstr "An Exclusive Bitcoin Staking and DeFi Campaign" #~ msgid "An exclusive quest campaign." #~ msgstr "An exclusive quest campaign." -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:266 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:259 msgid "and that you have read and understood our" msgstr "and that you have read and understood our" @@ -142,6 +142,10 @@ msgstr "Apps" msgid "Apps Used" msgstr "Apps Used" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:29 +msgid "As one of our most important community members, we would love the opportunity to gain your input on the BOB ecosystem and our future plans." +msgstr "As one of our most important community members, we would love the opportunity to gain your input on the BOB ecosystem and our future plans." + #: src/app/[lang]/fusion/components/UserInfo/MultipliersModal.tsx:62 #: src/app/[lang]/wallet/components/TokenTable/TokenTable.tsx:110 msgid "Asset" @@ -194,12 +198,16 @@ msgstr "BOB" msgid "BOB Bridge" msgstr "BOB Bridge" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:35 +msgid "BOB co-founder, <0>Alexei Zamyatin, would like to invite you to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please click the button below to book a call at a time that suits you." +msgstr "BOB co-founder, <0>Alexei Zamyatin, would like to invite you to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please click the button below to book a call at a time that suits you." + #: src/app/[lang]/(bridge)/components/BannerCarousel/OKXCryptopediaBanner.tsx:22 msgid "BOB Ecosystem on OKX Cryptopedia" msgstr "BOB Ecosystem on OKX Cryptopedia" #: src/app/[lang]/(bridge)/components/BannerCarousel/FusionBanner.tsx:22 -#: src/app/[lang]/fusion/Fusion.tsx:92 +#: src/app/[lang]/fusion/Fusion.tsx:96 msgid "BOB Fusion: The Final Season" msgstr "BOB Fusion: The Final Season" @@ -228,6 +236,10 @@ msgstr "BOB TVL Progress" msgid "BOB Wallet" msgstr "BOB Wallet" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:44 +msgid "Book Meeting" +msgstr "Book Meeting" + #: src/app/[lang]/(bridge)/bridge/page.tsx:14 #: src/app/[lang]/page.tsx:15 #: src/app/[lang]/wallet/components/TokenTable/ButtonGroup.tsx:75 @@ -279,7 +291,7 @@ msgstr "BTC bridge is currently unavailable. This may be due to: {0}. Please try msgid "BTC LST Lending" msgstr "BTC LST Lending" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:258 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:251 msgid "By clicking ‘Connect’ you acknowledge and agree to the" msgstr "By clicking ‘Connect’ you acknowledge and agree to the" @@ -304,7 +316,8 @@ msgstr "Category" msgid "Checking Allowance" msgstr "Checking Allowance" -#: src/connect-ui/component/ConnectModal/WalletList.tsx:116 +#: src/connect-ui/component/ConnectModal/BtcWalletList.tsx:39 +#: src/connect-ui/component/ConnectModal/EvmWalletList.tsx:76 msgid "choose available wallets" msgstr "choose available wallets" @@ -370,22 +383,22 @@ msgstr "Connect BTC Wallet" msgid "Connect BTC wallet to access fee rate settings." msgstr "Connect BTC wallet to access fee rate settings." -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:141 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:134 msgid "Connect request is already pending" msgstr "Connect request is already pending" #: src/app/[lang]/wallet/Wallet.tsx:77 #: src/connect-ui/component/AuthButton/AuthButton.tsx:63 -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:220 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:213 #: src/connect-ui/component/ConnectWallet/ConnectWallet.tsx:35 msgid "Connect Wallet" msgstr "Connect Wallet" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:302 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:295 msgid "Connect your Bitcoin Wallet (Optional)" msgstr "Connect your Bitcoin Wallet (Optional)" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:287 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:280 msgid "Connect your EVM Wallet (Mandatory)" msgstr "Connect your EVM Wallet (Mandatory)" @@ -537,8 +550,8 @@ msgstr "Estimated within 30 minutes" msgid "Estimated within the next block" msgstr "Estimated within the next block" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:144 -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:180 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:137 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:173 msgid "Failed to connect to {0}" msgstr "Failed to connect to {0}" @@ -600,7 +613,7 @@ msgid "Follow the steps of <0>this guide to provide liquity into a DEX pool msgstr "Follow the steps of <0>this guide to provide liquity into a DEX pool on Oku." #: src/app/[lang]/(bridge)/components/BannerCarousel/XBanner.tsx:18 -#: src/app/[lang]/fusion/Fusion.tsx:120 +#: src/app/[lang]/fusion/Fusion.tsx:124 msgid "Follow us on X" msgstr "Follow us on X" @@ -651,8 +664,8 @@ msgstr "Get ETH for transaction fees on BOB" msgid "Get tickets" msgstr "Get tickets" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:195 -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:209 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:188 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:202 msgid "go back" msgstr "go back" @@ -688,7 +701,7 @@ msgstr "Harvest {pointsMissing} more Spice to play" #~ msgid "Harvest {pointsMissing} more SPICE to your account to play" #~ msgstr "Harvest {pointsMissing} more SPICE to your account to play" -#: src/app/[lang]/fusion/Fusion.tsx:95 +#: src/app/[lang]/fusion/Fusion.tsx:99 msgid "Harvest Spice by depositing into BOB apps, voting, and solving quests. Keep an eye out for special events." msgstr "Harvest Spice by depositing into BOB apps, voting, and solving quests. Keep an eye out for special events." @@ -696,7 +709,7 @@ msgstr "Harvest Spice by depositing into BOB apps, voting, and solving quests. K msgid "Here are your active referrals and the Spice they're currently earning for you. The more they earn, the more you benefit!" msgstr "Here are your active referrals and the Spice they're currently earning for you. The more they earn, the more you benefit!" -#: src/app/[lang]/fusion/Fusion.tsx:88 +#: src/app/[lang]/fusion/Fusion.tsx:92 msgid "Hero dots" msgstr "Hero dots" @@ -753,7 +766,7 @@ msgid "Leaderboard" msgstr "Leaderboard" #: src/app/[lang]/fusion/components/WelcomeBackModal/WelcomeBackModal.tsx:81 -#: src/app/[lang]/fusion/Fusion.tsx:105 +#: src/app/[lang]/fusion/Fusion.tsx:109 msgid "Learn More" msgstr "Learn More" @@ -946,6 +959,10 @@ msgstr "No bridging operations found" msgid "No new goal at the moment. Stay tuned for updates!" msgstr "No new goal at the moment. Stay tuned for updates!" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:47 +msgid "No Thanks" +msgstr "No Thanks" + #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:50 #~ msgid "Not enough spice" #~ msgstr "Not enough spice" @@ -970,7 +987,7 @@ msgstr "Not your lucky day... yet!" msgid "OKX Cryptopedia" msgstr "OKX Cryptopedia" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:252 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:245 msgid "On BOB, you have the option to link both your EVM and BTC wallets. For optimal functionality, it's advised to connect wallets from both networks." msgstr "On BOB, you have the option to link both your EVM and BTC wallets. For optimal functionality, it's advised to connect wallets from both networks." @@ -1033,7 +1050,7 @@ msgstr "POWERED BY BTC & ETH" msgid "Preparing..." msgstr "Preparing..." -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:272 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:265 msgid "Privacy policy" msgstr "Privacy policy" @@ -1162,11 +1179,11 @@ msgstr "Season 3 Harvested Spice" msgid "Season Three" msgstr "Season Three" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:217 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:210 msgid "Select Bitcoin Wallet" msgstr "Select Bitcoin Wallet" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:203 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:196 msgid "Select EVM Wallet" msgstr "Select EVM Wallet" @@ -1409,7 +1426,7 @@ msgstr "T&Cs" msgid "Take em home" msgstr "Take em home" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:264 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:257 msgid "Terms of Service" msgstr "Terms of Service" @@ -1532,7 +1549,7 @@ msgid "To cast your vote, please log in" msgstr "To cast your vote, please log in" #: src/app/[lang]/(bridge)/components/BannerCarousel/XBanner.tsx:22 -#: src/app/[lang]/fusion/Fusion.tsx:123 +#: src/app/[lang]/fusion/Fusion.tsx:127 msgid "To stay up-to date with the BOB ecosystem follow @build_on_bob." msgstr "To stay up-to date with the BOB ecosystem follow @build_on_bob." @@ -1648,7 +1665,7 @@ msgstr "Use your Spice total to support your favourite BOB builders. Winners wil #: src/app/[lang]/(bridge)/bridge/components/BridgeForm/BobBridgeForm.tsx:110 #: src/components/LoginButton/LoginButton.tsx:27 -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:137 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:130 msgid "User rejected the request" msgstr "User rejected the request" @@ -1770,6 +1787,10 @@ msgstr "Yield Assets" msgid "You" msgstr "You" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:26 +msgid "You are one of the top 100 Spice holders in BOB Fusion" +msgstr "You are one of the top 100 Spice holders in BOB Fusion" + #: src/app/[lang]/(bridge)/components/GatewayTransactionDetails/GatewayTransactionDetails.tsx:76 msgid "You are using a BTC address type (Taproot/P2TR) which we don't support yet. Change the BTC address type to Native SegWit in your wallet to continue." msgstr "You are using a BTC address type (Taproot/P2TR) which we don't support yet. Change the BTC address type to Native SegWit in your wallet to continue." diff --git a/apps/evm/src/locales/zh.po b/apps/evm/src/locales/zh.po index 53d08f4d6..eb4b61db4 100644 --- a/apps/evm/src/locales/zh.po +++ b/apps/evm/src/locales/zh.po @@ -120,7 +120,7 @@ msgstr "" #~ msgid "An exclusive quest campaign." #~ msgstr "" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:266 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:259 msgid "and that you have read and understood our" msgstr "" @@ -142,6 +142,10 @@ msgstr "" msgid "Apps Used" msgstr "已体验的应用" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:29 +msgid "As one of our most important community members, we would love the opportunity to gain your input on the BOB ecosystem and our future plans." +msgstr "" + #: src/app/[lang]/fusion/components/UserInfo/MultipliersModal.tsx:62 #: src/app/[lang]/wallet/components/TokenTable/TokenTable.tsx:110 msgid "Asset" @@ -194,12 +198,16 @@ msgstr "" msgid "BOB Bridge" msgstr "" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:35 +msgid "BOB co-founder, <0>Alexei Zamyatin, would like to invite you to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please click the button below to book a call at a time that suits you." +msgstr "" + #: src/app/[lang]/(bridge)/components/BannerCarousel/OKXCryptopediaBanner.tsx:22 msgid "BOB Ecosystem on OKX Cryptopedia" msgstr "" #: src/app/[lang]/(bridge)/components/BannerCarousel/FusionBanner.tsx:22 -#: src/app/[lang]/fusion/Fusion.tsx:92 +#: src/app/[lang]/fusion/Fusion.tsx:96 msgid "BOB Fusion: The Final Season" msgstr "BOB Fusion:最终季" @@ -228,6 +236,10 @@ msgstr "BOB TVL进度" msgid "BOB Wallet" msgstr "BOB 钱包" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:44 +msgid "Book Meeting" +msgstr "" + #: src/app/[lang]/(bridge)/bridge/page.tsx:14 #: src/app/[lang]/page.tsx:15 #: src/app/[lang]/wallet/components/TokenTable/ButtonGroup.tsx:75 @@ -279,7 +291,7 @@ msgstr "" msgid "BTC LST Lending" msgstr "BTC LST借贷" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:258 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:251 msgid "By clicking ‘Connect’ you acknowledge and agree to the" msgstr "" @@ -304,7 +316,8 @@ msgstr "" msgid "Checking Allowance" msgstr "" -#: src/connect-ui/component/ConnectModal/WalletList.tsx:116 +#: src/connect-ui/component/ConnectModal/BtcWalletList.tsx:39 +#: src/connect-ui/component/ConnectModal/EvmWalletList.tsx:76 msgid "choose available wallets" msgstr "" @@ -370,22 +383,22 @@ msgstr "连接比特币钱包" msgid "Connect BTC wallet to access fee rate settings." msgstr "" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:141 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:134 msgid "Connect request is already pending" msgstr "" #: src/app/[lang]/wallet/Wallet.tsx:77 #: src/connect-ui/component/AuthButton/AuthButton.tsx:63 -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:220 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:213 #: src/connect-ui/component/ConnectWallet/ConnectWallet.tsx:35 msgid "Connect Wallet" msgstr "连接钱包" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:302 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:295 msgid "Connect your Bitcoin Wallet (Optional)" msgstr "" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:287 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:280 msgid "Connect your EVM Wallet (Mandatory)" msgstr "" @@ -537,8 +550,8 @@ msgstr "" msgid "Estimated within the next block" msgstr "" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:144 -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:180 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:137 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:173 msgid "Failed to connect to {0}" msgstr "" @@ -600,7 +613,7 @@ msgid "Follow the steps of <0>this guide to provide liquity into a DEX pool msgstr "按照 <0>本指南 的步骤为Oku上的DEX池提供流动性。" #: src/app/[lang]/(bridge)/components/BannerCarousel/XBanner.tsx:18 -#: src/app/[lang]/fusion/Fusion.tsx:120 +#: src/app/[lang]/fusion/Fusion.tsx:124 msgid "Follow us on X" msgstr "" @@ -651,8 +664,8 @@ msgstr "" msgid "Get tickets" msgstr "" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:195 -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:209 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:188 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:202 msgid "go back" msgstr "" @@ -688,7 +701,7 @@ msgstr "" #~ msgid "Harvest {pointsMissing} more SPICE to your account to play" #~ msgstr "" -#: src/app/[lang]/fusion/Fusion.tsx:95 +#: src/app/[lang]/fusion/Fusion.tsx:99 msgid "Harvest Spice by depositing into BOB apps, voting, and solving quests. Keep an eye out for special events." msgstr "通过存入BOB应用、投票和完成任务来收获Spice。密切关注特别活动" @@ -696,7 +709,7 @@ msgstr "通过存入BOB应用、投票和完成任务来收获Spice。密切关 msgid "Here are your active referrals and the Spice they're currently earning for you. The more they earn, the more you benefit!" msgstr "这里展示了你推荐的活跃用户及他们为你赚取的Spice。他们赚得越多,你获益越多!" -#: src/app/[lang]/fusion/Fusion.tsx:88 +#: src/app/[lang]/fusion/Fusion.tsx:92 msgid "Hero dots" msgstr "" @@ -753,7 +766,7 @@ msgid "Leaderboard" msgstr "排行榜" #: src/app/[lang]/fusion/components/WelcomeBackModal/WelcomeBackModal.tsx:81 -#: src/app/[lang]/fusion/Fusion.tsx:105 +#: src/app/[lang]/fusion/Fusion.tsx:109 msgid "Learn More" msgstr "了解更多" @@ -946,6 +959,10 @@ msgstr "" msgid "No new goal at the moment. Stay tuned for updates!" msgstr "目前暂无新目标。请保持关注更新!" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:47 +msgid "No Thanks" +msgstr "" + #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:50 #~ msgid "Not enough spice" #~ msgstr "" @@ -970,7 +987,7 @@ msgstr "" msgid "OKX Cryptopedia" msgstr "" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:252 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:245 msgid "On BOB, you have the option to link both your EVM and BTC wallets. For optimal functionality, it's advised to connect wallets from both networks." msgstr "" @@ -1033,7 +1050,7 @@ msgstr "比特币 + 以太坊共同驱动" msgid "Preparing..." msgstr "" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:272 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:265 msgid "Privacy policy" msgstr "" @@ -1162,11 +1179,11 @@ msgstr "第3季收获的Spice" msgid "Season Three" msgstr "第三季" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:217 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:210 msgid "Select Bitcoin Wallet" msgstr "" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:203 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:196 msgid "Select EVM Wallet" msgstr "" @@ -1409,7 +1426,7 @@ msgstr "条款与条件" msgid "Take em home" msgstr "回到主页" -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:264 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:257 msgid "Terms of Service" msgstr "" @@ -1528,7 +1545,7 @@ msgid "To cast your vote, please log in" msgstr "" #: src/app/[lang]/(bridge)/components/BannerCarousel/XBanner.tsx:22 -#: src/app/[lang]/fusion/Fusion.tsx:123 +#: src/app/[lang]/fusion/Fusion.tsx:127 msgid "To stay up-to date with the BOB ecosystem follow @build_on_bob." msgstr "" @@ -1644,7 +1661,7 @@ msgstr "用你的Spice总数来支持你最喜爱的BOB构建者。获胜者将 #: src/app/[lang]/(bridge)/bridge/components/BridgeForm/BobBridgeForm.tsx:110 #: src/components/LoginButton/LoginButton.tsx:27 -#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:137 +#: src/connect-ui/component/ConnectModal/ConnectModal.tsx:130 msgid "User rejected the request" msgstr "" @@ -1766,6 +1783,10 @@ msgstr "收益资产" msgid "You" msgstr "" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:26 +msgid "You are one of the top 100 Spice holders in BOB Fusion" +msgstr "" + #: src/app/[lang]/(bridge)/components/GatewayTransactionDetails/GatewayTransactionDetails.tsx:76 msgid "You are using a BTC address type (Taproot/P2TR) which we don't support yet. Change the BTC address type to Native SegWit in your wallet to continue." msgstr "" diff --git a/apps/evm/src/utils/api-client.ts b/apps/evm/src/utils/api-client.ts index 099838df7..ef87c8f5a 100644 --- a/apps/evm/src/utils/api-client.ts +++ b/apps/evm/src/utils/api-client.ts @@ -128,6 +128,9 @@ export type UserResponse = { quests_breakdown: Record; total_quest_points: string; season3Data: Season3Data; + notices: { + showIsFusionTopUser: boolean; + }; }; type LeaderboardResponse = { @@ -560,6 +563,15 @@ class ApiClient { return response.json(); } + async dismissTopUserModal(): Promise { + const response = await fetch(`${this.baseUrl}/me/dismiss-fusion-top-user-notice`, { + method: 'POST', + credentials: 'include' + }); + + return response.json(); + } + async getLastVotingResults(): Promise { const response = await fetch(`${this.baseUrl}/finalized-voting-round/latest/results`); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4fb06f9bd..7031978af 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -427,6 +427,9 @@ importers: react: specifier: ^18.2.0 version: 18.3.1 + react-calendly: + specifier: ^4.3.1 + version: 4.3.1(react-dom@18.3.1)(react@18.3.1) react-dom: specifier: ^18.2.0 version: 18.3.1(react@18.3.1) @@ -22111,6 +22114,17 @@ packages: unpipe: 1.0.0 dev: true + /react-calendly@4.3.1(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-poyUH3NOUOlsotr8ho5WzbsbPuRAppaY+Jvu+C/PkwTP6WT807pNFI8+HrbbuRknXZbd75zpzysOJQvcu3P8Pg==} + engines: {node: '>=8', npm: '>=5'} + peerDependencies: + react: ^18.2.0 + react-dom: ^18.2.0 + dependencies: + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + dev: false + /react-clientside-effect@1.2.6(react@18.3.1): resolution: {integrity: sha512-XGGGRQAKY+q25Lz9a/4EPqom7WRjz3z9R2k4jhVKA/puQFH/5Nt27vFZYql4m4NVNdUvX8PS3O7r/Zzm7cjUlg==} peerDependencies: From 6d64514a3a3519e2120898c566938ccd9bce3337 Mon Sep 17 00:00:00 2001 From: Slava Date: Thu, 14 Nov 2024 11:23:25 +0300 Subject: [PATCH 02/17] chore: cast to string[] --- apps/evm/src/lib/react-query/keys.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/evm/src/lib/react-query/keys.ts b/apps/evm/src/lib/react-query/keys.ts index ed68c0845..47892a9eb 100644 --- a/apps/evm/src/lib/react-query/keys.ts +++ b/apps/evm/src/lib/react-query/keys.ts @@ -75,7 +75,7 @@ export const appsKeys = { apps: () => ['apps'], appsVotes: (username: string | undefined) => [...appsKeys.apps(), 'votes', username], appsResultVotes: () => [...appsKeys.apps(), 'result-votes'], - vote: (username: string | undefined) => [appsKeys.apps(), 'vote', username] + vote: (username: string | undefined) => [appsKeys.apps(), 'vote', username] as string[] }; export const fusionKeys = { @@ -85,7 +85,7 @@ export const fusionKeys = { tokenInfo: () => [...fusionKeys.fusion(), 'token-info'], quests: () => [...fusionKeys.fusion(), 'quests'], tvlLevel: () => [...fusionKeys.fusion(), 'tvl-level'], - lotteryStats: (username: string | undefined) => [...fusionKeys.fusion(), 'lottery-stats', username], - lotteryRoll: (username: string | undefined) => [...fusionKeys.fusion(), 'lottery-roll', username], - topUserModal: (username: string | undefined) => [...fusionKeys.fusion(), 'top-user-modal', username] + lotteryStats: (username: string | undefined) => [...fusionKeys.fusion(), 'lottery-stats', username] as string[], + lotteryRoll: (username: string | undefined) => [...fusionKeys.fusion(), 'lottery-roll', username] as string[], + topUserModal: (username: string | undefined) => [...fusionKeys.fusion(), 'top-user-modal', username] as string[] }; From fc41a85beae82d26ecd1075cfc036011b764456c Mon Sep 17 00:00:00 2001 From: Slava Date: Thu, 14 Nov 2024 13:06:51 +0300 Subject: [PATCH 03/17] chore: refetch lottery draw time every hour --- .../LotteryModal/LotteryModal.tsx | 8 ++++---- .../LotterySections/LotterySections.tsx | 10 +++------- .../components/LotterySections/constants.ts | 5 ----- .../components/LotterySections/hooks/index.ts | 1 + .../LotterySections/hooks/useTimeToNextDraw.ts | 18 ++++++++++++++++++ 5 files changed, 26 insertions(+), 16 deletions(-) delete mode 100644 apps/evm/src/app/[lang]/fusion/components/LotterySections/constants.ts create mode 100644 apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/index.ts create mode 100644 apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts diff --git a/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx b/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx index 6e845e7d9..56114ac20 100644 --- a/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx @@ -17,12 +17,11 @@ import { useLocale } from '@gobob/ui'; import { Plural, Trans } from '@lingui/macro'; -import { formatDistanceToNow } from 'date-fns'; import { useParams } from 'next/navigation'; -import { ROUND_END_TIME } from '../constants'; import { Ticket } from '../icons'; import confettiAnimationData from '../lotties/confettie.json'; +import { useTimeToNextDraw } from '../hooks'; import { StyledButton, StyledLottie, StyledPoints } from './LotteryModal.style'; @@ -50,6 +49,7 @@ const LotteryModal = ({ const { lang } = useParams(); const { locale } = useLocale(); const { data: user } = useGetUser(); + const { data: timeToNextDraw } = useTimeToNextDraw(); const { data: lotteryRollData, isIdle, @@ -67,7 +67,7 @@ const LotteryModal = ({ }> - new tickets drop in {formatDistanceToNow(ROUND_END_TIME)} + new tickets drop in {timeToNextDraw}

@@ -160,7 +160,7 @@ const LotteryModal = ({ }> - new tickets drop in {formatDistanceToNow(ROUND_END_TIME)} + new tickets drop in {timeToNextDraw}

{getHeaderText()} diff --git a/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx b/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx index f563af07b..4b71f90cc 100644 --- a/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx @@ -1,7 +1,6 @@ import { Chip, Flex, H2, P, SolidClock, Span, Skeleton } from '@gobob/ui'; import { useAccount } from '@gobob/wagmi'; import { Plural, t, Trans } from '@lingui/macro'; -import { formatDistanceToNow } from 'date-fns'; import { useState } from 'react'; import Image from 'next/image'; import { useIsClient } from 'usehooks-ts'; @@ -10,7 +9,7 @@ import lottery from '@public/assets/lottery.png'; import { LotteryModal } from './LotteryModal'; import { StyledButton, StyledCard } from './LotterySections.style'; -import { ROUND_END_TIME } from './constants'; +import { useTimeToNextDraw } from './hooks'; import { useGetUser, useLotteryStats } from '@/hooks'; @@ -21,6 +20,7 @@ const LotterySection = () => { const { data: user } = useGetUser(); const { data: lotteryStatsData, isError, isLoading } = useLotteryStats(); const { i18n } = useLingui(); + const { data: timeToNextDraw } = useTimeToNextDraw(); return ( <> @@ -46,11 +46,7 @@ const LotterySection = () => { }> - {isClient ? ( - {formatDistanceToNow(ROUND_END_TIME)} until next draw - ) : ( - - )} + {isClient ? {timeToNextDraw} until next draw : }

{!isClient || (!address && isClient) || !user || isError || isLoading ? ( diff --git a/apps/evm/src/app/[lang]/fusion/components/LotterySections/constants.ts b/apps/evm/src/app/[lang]/fusion/components/LotterySections/constants.ts deleted file mode 100644 index 614df1859..000000000 --- a/apps/evm/src/app/[lang]/fusion/components/LotterySections/constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -const date = new Date(); - -date.setUTCHours(24, 0, 0, 0); - -export const ROUND_END_TIME = date; diff --git a/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/index.ts b/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/index.ts new file mode 100644 index 000000000..7b3fa89d1 --- /dev/null +++ b/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/index.ts @@ -0,0 +1 @@ +export { useTimeToNextDraw } from './useTimeToNextDraw'; diff --git a/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts b/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts new file mode 100644 index 000000000..3643f5172 --- /dev/null +++ b/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts @@ -0,0 +1,18 @@ +import { INTERVAL, useQuery } from '@gobob/react-query'; +import { formatDistanceToNow } from 'date-fns'; + +const useTimeToNextDraw = () => { + return useQuery({ + queryKey: ['lottery-time-to-next-draw'], + queryFn: () => { + const date = new Date(); + + date.setUTCHours(24, 0, 0, 0); + + return formatDistanceToNow(date); + }, + refetchInterval: INTERVAL.HOUR + }); +}; + +export { useTimeToNextDraw }; From 474d67f7c5bdcedd018478216cddd46245a6cb37 Mon Sep 17 00:00:00 2001 From: Slava Date: Mon, 18 Nov 2024 14:39:21 +0300 Subject: [PATCH 04/17] chore: improve color scheme for modal --- .../[lang]/fusion/components/TopUserModal/TopUserModal.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx index 01ed022a7..b9eaddda6 100644 --- a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx @@ -1,4 +1,5 @@ import { Button, H3, Link, Modal, ModalBody, ModalFooter, ModalProps, P } from '@gobob/ui'; +import { colors } from '@gobob/ui/src/theme/themes/bob/colors'; import { Trans } from '@lingui/macro'; import { useState } from 'react'; import { PopupModal, useCalendlyEventListener } from 'react-calendly'; @@ -50,6 +51,11 @@ const TopUserModal = ({ onClose, isOpen, ...props }: TopUserModalProps): JSX.Ele setIsCalendlyOpen(false)} From 2b08c55462db00fca18bec86b3b0eb3ae0ac26db Mon Sep 17 00:00:00 2001 From: Slava Date: Mon, 18 Nov 2024 22:47:21 +0300 Subject: [PATCH 05/17] chore: off color scheme --- apps/evm/src/app/[lang]/index.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/evm/src/app/[lang]/index.css b/apps/evm/src/app/[lang]/index.css index efc40e805..0a23e7a5f 100644 --- a/apps/evm/src/app/[lang]/index.css +++ b/apps/evm/src/app/[lang]/index.css @@ -9,7 +9,7 @@ font-weight: 400; color: #ffffff; - color-scheme: light dark; + /* color-scheme: light dark; */ font-synthesis: none; text-rendering: optimizeLegibility; From f34245746897b24de91ac59a4dad706891112f01 Mon Sep 17 00:00:00 2001 From: Slava Date: Wed, 20 Nov 2024 16:32:19 +0300 Subject: [PATCH 06/17] chore: set update time to minute --- .../components/LotterySections/hooks/useTimeToNextDraw.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts b/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts index 3643f5172..9cf4a99ac 100644 --- a/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts +++ b/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts @@ -11,7 +11,7 @@ const useTimeToNextDraw = () => { return formatDistanceToNow(date); }, - refetchInterval: INTERVAL.HOUR + refetchInterval: INTERVAL.MINUTE }); }; From 93f894be1903c4c3ea288cdd68d219a6ef765dd7 Mon Sep 17 00:00:00 2001 From: Slava Date: Wed, 20 Nov 2024 17:21:09 +0300 Subject: [PATCH 07/17] chore: send gtm event on iframe events --- .../[lang]/fusion/components/TopUserModal/TopUserModal.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx index b9eaddda6..7fff3a8fe 100644 --- a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx @@ -3,6 +3,7 @@ import { colors } from '@gobob/ui/src/theme/themes/bob/colors'; import { Trans } from '@lingui/macro'; import { useState } from 'react'; import { PopupModal, useCalendlyEventListener } from 'react-calendly'; +// import { sendGTMEvent } from '@next/third-parties/google'; type Props = { onClose: () => void; @@ -16,7 +17,10 @@ const TopUserModal = ({ onClose, isOpen, ...props }: TopUserModalProps): JSX.Ele const [isCalendlyOpen, setIsCalendlyOpen] = useState(false); useCalendlyEventListener({ - onEventScheduled: onClose + onEventScheduled: () => { + // sendGTMEvent(e.data); // send `.event` and `.payload` + onClose(); + } }); return ( From 79c9b783a8edbdb26308c404f964db877255db6f Mon Sep 17 00:00:00 2001 From: Slava Date: Wed, 20 Nov 2024 17:54:01 +0300 Subject: [PATCH 08/17] chore: extract messages --- apps/evm/src/locales/en.po | 37 +++++++++++++++++++++++-------------- apps/evm/src/locales/zh.po | 35 ++++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/apps/evm/src/locales/en.po b/apps/evm/src/locales/en.po index 6aadd7d61..f804fb211 100644 --- a/apps/evm/src/locales/en.po +++ b/apps/evm/src/locales/en.po @@ -31,8 +31,8 @@ msgid "{0} remaining" msgstr "{0} remaining" #: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:50 -msgid "{0} until next draw" -msgstr "{0} until next draw" +#~ msgid "{0} until next draw" +#~ msgstr "{0} until next draw" #: src/app/[lang]/fusion/components/Quest/Quest.tsx:40 msgid "{0} until quest ends" @@ -42,6 +42,10 @@ msgstr "{0} until quest ends" msgid "{0} until voting round ends" msgstr "{0} until voting round ends" +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:49 +msgid "{timeToNextDraw} until next draw" +msgstr "{timeToNextDraw} until next draw" + #: src/app/[lang]/fusion/components/UserInfo/MultipliersModal.tsx:226 msgid "* The multipliers displayed are subject to change based on the payout structure of the respective projects." msgstr "* The multipliers displayed are subject to change based on the payout structure of the respective projects." @@ -50,7 +54,7 @@ msgstr "* The multipliers displayed are subject to change based on the payout st msgid "< 1 minute" msgstr "< 1 minute" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:59 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:55 msgid "<0>{0} {1, plural, one {Ticket} other {Tickets}} Remaining" msgstr "<0>{0} {1, plural, one {Ticket} other {Tickets}} Remaining" @@ -142,7 +146,7 @@ msgstr "Apps" msgid "Apps Used" msgstr "Apps Used" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:29 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:34 msgid "As one of our most important community members, we would love the opportunity to gain your input on the BOB ecosystem and our future plans." msgstr "As one of our most important community members, we would love the opportunity to gain your input on the BOB ecosystem and our future plans." @@ -198,7 +202,7 @@ msgstr "BOB" msgid "BOB Bridge" msgstr "BOB Bridge" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:35 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:40 msgid "BOB co-founder, <0>Alexei Zamyatin, would like to invite you to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please click the button below to book a call at a time that suits you." msgstr "BOB co-founder, <0>Alexei Zamyatin, would like to invite you to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please click the button below to book a call at a time that suits you." @@ -236,7 +240,7 @@ msgstr "BOB TVL Progress" msgid "BOB Wallet" msgstr "BOB Wallet" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:44 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:49 msgid "Book Meeting" msgstr "Book Meeting" @@ -588,7 +592,7 @@ msgstr "Featured Assets" msgid "Fee" msgstr "Fee" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:69 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:65 msgid "Feeling lucky? Try your luck with the daily lottery!<0/>Participate in Fusion voting to receive 3 lottery tickets each day." msgstr "Feeling lucky? Try your luck with the daily lottery!<0/>Participate in Fusion voting to receive 3 lottery tickets each day." @@ -825,7 +829,7 @@ msgstr "Log in" msgid "Log in to View Dashboard" msgstr "Log in to View Dashboard" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:81 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:77 msgid "Login to play" msgstr "Login to play" @@ -834,7 +838,7 @@ msgid "Login with wallet" msgstr "Login with wallet" #: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:36 -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:57 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:53 msgid "Lottery" msgstr "Lottery" @@ -944,8 +948,13 @@ msgstr "New Quests Coming Soon" #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:70 #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:163 -msgid "new tickets drop in {0}" -msgstr "new tickets drop in {0}" +#~ msgid "new tickets drop in {0}" +#~ msgstr "new tickets drop in {0}" + +#: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:70 +#: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:163 +msgid "new tickets drop in {timeToNextDraw}" +msgstr "new tickets drop in {timeToNextDraw}" #: src/app/[lang]/wallet/Wallet.tsx:70 msgid "No assets shown" @@ -959,7 +968,7 @@ msgstr "No bridging operations found" msgid "No new goal at the moment. Stay tuned for updates!" msgstr "No new goal at the moment. Stay tuned for updates!" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:47 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:52 msgid "No Thanks" msgstr "No Thanks" @@ -1017,7 +1026,7 @@ msgid "Pending" msgstr "Pending" #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:208 -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:81 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:77 msgid "Play" msgstr "Play" @@ -1787,7 +1796,7 @@ msgstr "Yield Assets" msgid "You" msgstr "You" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:26 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:31 msgid "You are one of the top 100 Spice holders in BOB Fusion" msgstr "You are one of the top 100 Spice holders in BOB Fusion" diff --git a/apps/evm/src/locales/zh.po b/apps/evm/src/locales/zh.po index eb4b61db4..fa41c172b 100644 --- a/apps/evm/src/locales/zh.po +++ b/apps/evm/src/locales/zh.po @@ -31,8 +31,8 @@ msgid "{0} remaining" msgstr "" #: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:50 -msgid "{0} until next draw" -msgstr "" +#~ msgid "{0} until next draw" +#~ msgstr "" #: src/app/[lang]/fusion/components/Quest/Quest.tsx:40 msgid "{0} until quest ends" @@ -42,6 +42,10 @@ msgstr "距离任务结束还有{0}" msgid "{0} until voting round ends" msgstr "距离投票轮结束还有{0}" +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:49 +msgid "{timeToNextDraw} until next draw" +msgstr "" + #: src/app/[lang]/fusion/components/UserInfo/MultipliersModal.tsx:226 msgid "* The multipliers displayed are subject to change based on the payout structure of the respective projects." msgstr "* 显示的倍数可能会根据相应项目的支付结构而变化。" @@ -50,7 +54,7 @@ msgstr "* 显示的倍数可能会根据相应项目的支付结构而变化。" msgid "< 1 minute" msgstr "" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:59 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:55 msgid "<0>{0} {1, plural, one {Ticket} other {Tickets}} Remaining" msgstr "" @@ -142,7 +146,7 @@ msgstr "" msgid "Apps Used" msgstr "已体验的应用" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:29 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:34 msgid "As one of our most important community members, we would love the opportunity to gain your input on the BOB ecosystem and our future plans." msgstr "" @@ -198,7 +202,7 @@ msgstr "" msgid "BOB Bridge" msgstr "" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:35 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:40 msgid "BOB co-founder, <0>Alexei Zamyatin, would like to invite you to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please click the button below to book a call at a time that suits you." msgstr "" @@ -236,7 +240,7 @@ msgstr "BOB TVL进度" msgid "BOB Wallet" msgstr "BOB 钱包" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:44 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:49 msgid "Book Meeting" msgstr "" @@ -588,7 +592,7 @@ msgstr "特色资产" msgid "Fee" msgstr "" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:69 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:65 msgid "Feeling lucky? Try your luck with the daily lottery!<0/>Participate in Fusion voting to receive 3 lottery tickets each day." msgstr "" @@ -825,7 +829,7 @@ msgstr "登录" msgid "Log in to View Dashboard" msgstr "登录查看仪表板" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:81 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:77 msgid "Login to play" msgstr "" @@ -834,7 +838,7 @@ msgid "Login with wallet" msgstr "使用钱包登录" #: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:36 -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:57 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:53 msgid "Lottery" msgstr "" @@ -944,7 +948,12 @@ msgstr "" #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:70 #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:163 -msgid "new tickets drop in {0}" +#~ msgid "new tickets drop in {0}" +#~ msgstr "" + +#: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:70 +#: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:163 +msgid "new tickets drop in {timeToNextDraw}" msgstr "" #: src/app/[lang]/wallet/Wallet.tsx:70 @@ -959,7 +968,7 @@ msgstr "" msgid "No new goal at the moment. Stay tuned for updates!" msgstr "目前暂无新目标。请保持关注更新!" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:47 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:52 msgid "No Thanks" msgstr "" @@ -1017,7 +1026,7 @@ msgid "Pending" msgstr "" #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:208 -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:81 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:77 msgid "Play" msgstr "" @@ -1783,7 +1792,7 @@ msgstr "收益资产" msgid "You" msgstr "" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:26 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:31 msgid "You are one of the top 100 Spice holders in BOB Fusion" msgstr "" From 5d299be322ad38fe8bc99fd7d2363178c9a682ac Mon Sep 17 00:00:00 2001 From: Slava Date: Wed, 20 Nov 2024 20:36:09 +0300 Subject: [PATCH 09/17] chore: localize format distance to now --- .../lingui.config.ts} | 11 ++- .../lingui.config.js => evm/lingui.config.ts} | 9 +- .../components/BridgeStatus/TimeStep.tsx | 2 +- .../TransactionList/TransactionDetails.tsx | 5 +- .../VotingDashboard/UserVotingInfo.tsx | 88 +++++++++++-------- .../CommunityVoting/CommunityVoting.tsx | 10 ++- .../LotteryModal/LotteryModal.tsx | 2 +- .../LotterySections/LotterySections.tsx | 4 +- .../hooks/useTimeToNextDraw.ts | 6 +- .../[lang]/fusion/components/Quest/Quest.tsx | 11 ++- apps/evm/src/utils/index.ts | 1 + apps/evm/src/utils/locale.ts | 12 +++ 12 files changed, 108 insertions(+), 53 deletions(-) rename apps/{evm/lingui.config.js => bob-pay/lingui.config.ts} (50%) rename apps/{bob-pay/lingui.config.js => evm/lingui.config.ts} (59%) create mode 100644 apps/evm/src/utils/locale.ts diff --git a/apps/evm/lingui.config.js b/apps/bob-pay/lingui.config.ts similarity index 50% rename from apps/evm/lingui.config.js rename to apps/bob-pay/lingui.config.ts index 82f1610ab..5124ecf01 100644 --- a/apps/evm/lingui.config.js +++ b/apps/bob-pay/lingui.config.ts @@ -1,6 +1,7 @@ -/** @type {import('@lingui/conf').LinguiConfig} */ -module.exports = { - locales: ['en', 'zh'], +import { LinguiConfig } from '@lingui/conf'; + +const config = { + locales: ['en', 'zh'] as const, sourceLocale: 'en', fallbackLocales: { default: 'en' @@ -11,4 +12,6 @@ module.exports = { include: ['src/'] } ] -}; +} as const satisfies LinguiConfig; + +export default config; diff --git a/apps/bob-pay/lingui.config.js b/apps/evm/lingui.config.ts similarity index 59% rename from apps/bob-pay/lingui.config.js rename to apps/evm/lingui.config.ts index 82f1610ab..7685ec857 100644 --- a/apps/bob-pay/lingui.config.js +++ b/apps/evm/lingui.config.ts @@ -1,5 +1,6 @@ -/** @type {import('@lingui/conf').LinguiConfig} */ -module.exports = { +import { LinguiConfig } from '@lingui/conf'; + +const config = { locales: ['en', 'zh'], sourceLocale: 'en', fallbackLocales: { @@ -11,4 +12,6 @@ module.exports = { include: ['src/'] } ] -}; +} as const satisfies LinguiConfig; + +export default config; diff --git a/apps/evm/src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx b/apps/evm/src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx index 358c5a714..520232519 100644 --- a/apps/evm/src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx +++ b/apps/evm/src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx @@ -44,7 +44,7 @@ const TimeStep = ({ step, data, currentStep }: TimeStepProps): JSX.Element => { return step === 'challenge-period' ? 7 days : 2 hours; } - return {formatDistanceToNow(data.statusEndDate)} remaining; + return {formatDistanceToNow(data.statusEndDate, {})} remaining; }, [step, currentStep, data.statusEndDate]); return ( diff --git a/apps/evm/src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx b/apps/evm/src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx index 2f09c9c61..776e56f39 100644 --- a/apps/evm/src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx +++ b/apps/evm/src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx @@ -3,11 +3,13 @@ import { Currency, CurrencyAmount } from '@gobob/currency'; import { ArrowLongRight, Flex, FlexProps, P, UnstyledButton } from '@gobob/ui'; import { Trans } from '@lingui/macro'; import { formatDistanceToNow } from 'date-fns'; +import { useParams } from 'next/navigation'; import { StyledDetailsButton, StyledExpandIcon } from './TransactionList.style'; import { Chain } from '@/components'; import { TransactionDirection } from '@/types'; +import { getLocale } from '@/utils'; type Props = { direction: TransactionDirection; @@ -35,6 +37,7 @@ const TransactionDetails = ({ onExpand, ...props }: TransactionDetailsProps): JSX.Element => { + const { lang } = useParams(); const directionLabel = direction === TransactionDirection.L1_TO_L2 ? Deposit : Withdraw; const isExpandable = !!onExpand; @@ -46,7 +49,7 @@ const TransactionDetails = ({ {directionLabel}

- {formatDistanceToNow(date)} ago + {formatDistanceToNow(date, { locale: getLocale(lang as Parameters[0]) })} ago

diff --git a/apps/evm/src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx b/apps/evm/src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx index a9f81777f..dcfd4d474 100644 --- a/apps/evm/src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx +++ b/apps/evm/src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx @@ -1,51 +1,65 @@ import { Card, Dd, Divider, Dl, DlGroup, Dt, Flex, P, Skeleton, SolidClock, Span, Tooltip } from '@gobob/ui'; import { formatDistanceToNow } from 'date-fns'; import { Trans } from '@lingui/macro'; +import { useParams } from 'next/navigation'; import { SpiceChip } from '../SpiceChip'; import { LoginButton, SignUpButton } from '@/components'; +import { getLocale } from '@/utils'; type Props = { isAuthenticated?: boolean; roundEndsAt?: string; votesRemaining?: number }; type UserVotingInfoProps = Props; -const UserVotingInfo = ({ isAuthenticated, roundEndsAt, votesRemaining }: UserVotingInfoProps): JSX.Element => ( - - <> - {isAuthenticated ? ( -
- -
- Votes Left: -
-
- -
-
-
- ) : ( - - - Log in - - - or - - - Create Account - - - )} - - Time left until voting round ends}> - - - {roundEndsAt ?

{formatDistanceToNow(roundEndsAt)}

: } -
-
- -
-); +const UserVotingInfo = ({ isAuthenticated, roundEndsAt, votesRemaining }: UserVotingInfoProps): JSX.Element => { + const { lang } = useParams(); + + return ( + + <> + {isAuthenticated ? ( +
+ +
+ Votes Left: +
+
+ +
+
+
+ ) : ( + + + Log in + + + or + + + Create Account + + + )} + + Time left until voting round ends}> + + + {roundEndsAt ? ( +

+ {formatDistanceToNow(roundEndsAt, { + locale: getLocale(lang as Parameters[0]) + })} +

+ ) : ( + + )} +
+
+ +
+ ); +}; export { UserVotingInfo }; diff --git a/apps/evm/src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx b/apps/evm/src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx index ee9b58656..b8ecd1a40 100644 --- a/apps/evm/src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx @@ -3,11 +3,13 @@ import { formatDistanceToNow } from 'date-fns'; import { useTheme } from 'styled-components'; import { Trans } from '@lingui/macro'; import { useIsClient } from 'usehooks-ts'; +import { useParams } from 'next/navigation'; import { StyledCard, StyledOpacityOverlay, StyledSpice } from './CommunityVoting.style'; import { useGetVotingApps } from '@/app/[lang]/apps/hooks'; import { RoutesPath } from '@/constants'; +import { getLocale } from '@/utils'; type CommunityVotingProps = object; @@ -15,6 +17,7 @@ const CommunityVoting = ({}: CommunityVotingProps) => { const theme = useTheme(); const isClient = useIsClient(); const isMobile = useMediaQuery(theme.breakpoints.down('s')); + const { lang } = useParams(); const { data: votingAppsData } = useGetVotingApps(); return ( @@ -34,7 +37,12 @@ const CommunityVoting = ({}: CommunityVotingProps) => { > {votingAppsData?.roundEndsAt ? ( }> - {formatDistanceToNow(votingAppsData.roundEndsAt)} until voting round ends + + {formatDistanceToNow(votingAppsData.roundEndsAt, { + locale: getLocale(lang as Parameters[0]) + })}{' '} + until voting round ends + ) : ( diff --git a/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx b/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx index 56114ac20..cd16ca9cd 100644 --- a/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx @@ -49,7 +49,7 @@ const LotteryModal = ({ const { lang } = useParams(); const { locale } = useLocale(); const { data: user } = useGetUser(); - const { data: timeToNextDraw } = useTimeToNextDraw(); + const { data: timeToNextDraw } = useTimeToNextDraw(lang as Parameters[0]); const { data: lotteryRollData, isIdle, diff --git a/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx b/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx index 4b71f90cc..c00e6be16 100644 --- a/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx @@ -5,6 +5,7 @@ import { useState } from 'react'; import Image from 'next/image'; import { useIsClient } from 'usehooks-ts'; import { useLingui } from '@lingui/react'; +import { useParams } from 'next/navigation'; import lottery from '@public/assets/lottery.png'; import { LotteryModal } from './LotteryModal'; @@ -20,7 +21,8 @@ const LotterySection = () => { const { data: user } = useGetUser(); const { data: lotteryStatsData, isError, isLoading } = useLotteryStats(); const { i18n } = useLingui(); - const { data: timeToNextDraw } = useTimeToNextDraw(); + const { lang } = useParams(); + const { data: timeToNextDraw } = useTimeToNextDraw(lang as Parameters[0]); return ( <> diff --git a/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts b/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts index 9cf4a99ac..90216adb8 100644 --- a/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts +++ b/apps/evm/src/app/[lang]/fusion/components/LotterySections/hooks/useTimeToNextDraw.ts @@ -1,7 +1,9 @@ import { INTERVAL, useQuery } from '@gobob/react-query'; import { formatDistanceToNow } from 'date-fns'; -const useTimeToNextDraw = () => { +import { getLocale } from '@/utils'; + +const useTimeToNextDraw = (lang: 'en' | 'zh' = 'en') => { return useQuery({ queryKey: ['lottery-time-to-next-draw'], queryFn: () => { @@ -9,7 +11,7 @@ const useTimeToNextDraw = () => { date.setUTCHours(24, 0, 0, 0); - return formatDistanceToNow(date); + return formatDistanceToNow(date, { locale: getLocale(lang as Parameters[0]) }); }, refetchInterval: INTERVAL.MINUTE }); diff --git a/apps/evm/src/app/[lang]/fusion/components/Quest/Quest.tsx b/apps/evm/src/app/[lang]/fusion/components/Quest/Quest.tsx index d9c79fa07..18b2963dd 100644 --- a/apps/evm/src/app/[lang]/fusion/components/Quest/Quest.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/Quest/Quest.tsx @@ -3,15 +3,17 @@ import { formatDistanceToNow } from 'date-fns'; import { useTheme } from 'styled-components'; import { Trans } from '@lingui/macro'; import { useIsClient } from 'usehooks-ts'; +import { useParams } from 'next/navigation'; import { StyledCard, StyledDescription, StyledIntract, StyledOpacityOverlay } from './Quest.style'; -import { QuestS3Response } from '@/utils'; +import { getLocale, QuestS3Response } from '@/utils'; type QuestProps = { quests: QuestS3Response | undefined; id: string }; const Quest = ({ id, quests }: QuestProps) => { const theme = useTheme(); + const { lang } = useParams(); const isClient = useIsClient(); const isMobile = useMediaQuery(theme.breakpoints.down('s')); @@ -37,7 +39,12 @@ const Quest = ({ id, quests }: QuestProps) => { {intractQuest ? ( }> {isActive ? ( - {formatDistanceToNow(intractQuest.end_date)} until quest ends + + {formatDistanceToNow(intractQuest.end_date, { + locale: getLocale(lang as Parameters[0]) + })}{' '} + until quest ends + ) : ( Coming Soon )} diff --git a/apps/evm/src/utils/index.ts b/apps/evm/src/utils/index.ts index 8bdb7d4f3..d64a5c705 100644 --- a/apps/evm/src/utils/index.ts +++ b/apps/evm/src/utils/index.ts @@ -1,3 +1,4 @@ export * from './api-client'; export * from './esplora-client'; export * from './math'; +export * from './locale'; diff --git a/apps/evm/src/utils/locale.ts b/apps/evm/src/utils/locale.ts new file mode 100644 index 000000000..5d8e15805 --- /dev/null +++ b/apps/evm/src/utils/locale.ts @@ -0,0 +1,12 @@ +import { enUS, zhCN } from 'date-fns/locale'; + +import linguiConfig from '../../lingui.config'; + +const localeMapping = { + en: enUS, + zh: zhCN +}; + +export const getLocale = (lang: (typeof linguiConfig)['locales'][number] = 'en') => { + return localeMapping[lang]; +}; From aa3df81e2c86b1a9a1d4f6a28bb6d94b24e958cd Mon Sep 17 00:00:00 2001 From: Slava Date: Tue, 26 Nov 2024 19:14:26 +0300 Subject: [PATCH 10/17] chore: add missing locale --- .../(bridge)/components/BridgeStatus/TimeStep.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/evm/src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx b/apps/evm/src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx index 520232519..7410a2aa9 100644 --- a/apps/evm/src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx +++ b/apps/evm/src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx @@ -2,6 +2,7 @@ import { Clock, Flex, FlexProps } from '@gobob/ui'; import { Trans } from '@lingui/macro'; import { formatDistanceToNow, isFuture } from 'date-fns'; import { ReactNode, useMemo } from 'react'; +import { useParams } from 'next/navigation'; import { BridgeTransaction } from '../../hooks'; @@ -9,6 +10,7 @@ import { StyledTimePill } from './BridgeStatus.style'; import { BridgeStep } from './BridgeStep'; import { BridgeSteps } from '@/types'; +import { getLocale } from '@/utils'; const TimeLabel = ({ label }: { label: ReactNode }) => ( @@ -28,6 +30,8 @@ type InheritAttrs = Omit; type TimeStepProps = Props & InheritAttrs; const TimeStep = ({ step, data, currentStep }: TimeStepProps): JSX.Element => { + const { lang } = useParams(); + const timeLabel = useMemo(() => { // should only show step if it is not a complete step const showTime = @@ -44,7 +48,12 @@ const TimeStep = ({ step, data, currentStep }: TimeStepProps): JSX.Element => { return step === 'challenge-period' ? 7 days : 2 hours; } - return {formatDistanceToNow(data.statusEndDate, {})} remaining; + return ( + + {formatDistanceToNow(data.statusEndDate, { locale: getLocale(lang as Parameters[0]) })}{' '} + remaining + + ); }, [step, currentStep, data.statusEndDate]); return ( From 5d7a5c823a5f6475d1531c59882fa37529861e9d Mon Sep 17 00:00:00 2001 From: Slava Date: Thu, 28 Nov 2024 17:03:22 +0300 Subject: [PATCH 11/17] chore: add switch to hide modal forever --- apps/evm/src/app/[lang]/fusion/Fusion.tsx | 16 +++++++++--- .../components/TopUserModal/TopUserModal.tsx | 26 ++++++++++++------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/apps/evm/src/app/[lang]/fusion/Fusion.tsx b/apps/evm/src/app/[lang]/fusion/Fusion.tsx index 4e660f845..0bbc3549a 100644 --- a/apps/evm/src/app/[lang]/fusion/Fusion.tsx +++ b/apps/evm/src/app/[lang]/fusion/Fusion.tsx @@ -49,6 +49,17 @@ const Fusion = () => { const questsSectionId = useId(); + const [shouldDisplayTopUserModal, setShouldDisplayTopUserModal] = useState(false); + + useEffect(() => { + if (user?.notices.showIsFusionTopUser) setShouldDisplayTopUserModal(true); + }, [user]); + + const onCloseModal = (shouldDismissTopUserModal: boolean) => { + setShouldDisplayTopUserModal(false); + if (shouldDismissTopUserModal) dismissTopUserModal(); + }; + const [scrollQuests, setScrollQuests] = useSessionStorage(SessionStorageKey.SCROLL_QUESTS, false, { initializeWithValue: isClient }); @@ -82,7 +93,6 @@ const Fusion = () => { const isAuthenticated = Boolean(user && address); const hasPastHarvest = user?.leaderboardRank && user.leaderboardRank.total_points > 0; - const isFusionTopUser = user?.notices.showIsFusionTopUser; return ( @@ -142,8 +152,8 @@ const Fusion = () => { {user ? ( - isFusionTopUser ? ( - + shouldDisplayTopUserModal ? ( + ) : hasPastHarvest ? ( void; + onClose: (shouldDismissTopUserModal: boolean) => void; }; type InheritAttrs = Omit; @@ -15,11 +15,12 @@ type TopUserModalProps = Props & InheritAttrs; const TopUserModal = ({ onClose, isOpen, ...props }: TopUserModalProps): JSX.Element => { const [isCalendlyOpen, setIsCalendlyOpen] = useState(false); + const [dontShow, setDontShow] = useState(false); useCalendlyEventListener({ onEventScheduled: () => { // sendGTMEvent(e.data); // send `.event` and `.payload` - onClose(); + onClose(true); } }); @@ -44,13 +45,18 @@ const TopUserModal = ({ onClose, isOpen, ...props }: TopUserModalProps): JSX.Ele

- - - + + setDontShow(e.target.checked)}> + Don't show this message again + + + + + Date: Thu, 28 Nov 2024 17:15:22 +0300 Subject: [PATCH 12/17] chore: extract messages --- apps/evm/src/locales/en.po | 99 +++++++++++++++++++++----------------- apps/evm/src/locales/zh.po | 99 +++++++++++++++++++++----------------- 2 files changed, 108 insertions(+), 90 deletions(-) diff --git a/apps/evm/src/locales/en.po b/apps/evm/src/locales/en.po index f804fb211..876deb866 100644 --- a/apps/evm/src/locales/en.po +++ b/apps/evm/src/locales/en.po @@ -22,11 +22,11 @@ msgstr ", due to the challenge period" #~ msgid "{0}" #~ msgstr "{0}" -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:49 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:52 msgid "{0} ago" msgstr "{0} ago" -#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:47 +#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:52 msgid "{0} remaining" msgstr "{0} remaining" @@ -34,15 +34,15 @@ msgstr "{0} remaining" #~ msgid "{0} until next draw" #~ msgstr "{0} until next draw" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:40 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:42 msgid "{0} until quest ends" msgstr "{0} until quest ends" -#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:37 +#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:40 msgid "{0} until voting round ends" msgstr "{0} until voting round ends" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:49 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:51 msgid "{timeToNextDraw} until next draw" msgstr "{timeToNextDraw} until next draw" @@ -54,7 +54,7 @@ msgstr "* The multipliers displayed are subject to change based on the payout st msgid "< 1 minute" msgstr "< 1 minute" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:55 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:57 msgid "<0>{0} {1, plural, one {Ticket} other {Tickets}} Remaining" msgstr "<0>{0} {1, plural, one {Ticket} other {Tickets}} Remaining" @@ -71,7 +71,7 @@ msgstr "<0>{rollsRemaining}/3 {0, plural, one {Ticket} other {Tickets}} Rema msgid "<0>Stake your BTC with 1-click and receive BTC LSTs on BOB." msgstr "<0>Stake your BTC with 1-click and receive BTC LSTs on BOB." -#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:44 +#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:48 msgid "2 hours" msgstr "2 hours" @@ -84,7 +84,7 @@ msgstr "3rd Party" msgid "404 Error" msgstr "404 Error" -#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:44 +#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:48 msgid "7 days" msgstr "7 days" @@ -146,7 +146,7 @@ msgstr "Apps" msgid "Apps Used" msgstr "Apps Used" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:34 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:35 msgid "As one of our most important community members, we would love the opportunity to gain your input on the BOB ecosystem and our future plans." msgstr "As one of our most important community members, we would love the opportunity to gain your input on the BOB ecosystem and our future plans." @@ -202,7 +202,7 @@ msgstr "BOB" msgid "BOB Bridge" msgstr "BOB Bridge" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:40 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:41 msgid "BOB co-founder, <0>Alexei Zamyatin, would like to invite you to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please click the button below to book a call at a time that suits you." msgstr "BOB co-founder, <0>Alexei Zamyatin, would like to invite you to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please click the button below to book a call at a time that suits you." @@ -211,7 +211,7 @@ msgid "BOB Ecosystem on OKX Cryptopedia" msgstr "BOB Ecosystem on OKX Cryptopedia" #: src/app/[lang]/(bridge)/components/BannerCarousel/FusionBanner.tsx:22 -#: src/app/[lang]/fusion/Fusion.tsx:96 +#: src/app/[lang]/fusion/Fusion.tsx:106 msgid "BOB Fusion: The Final Season" msgstr "BOB Fusion: The Final Season" @@ -240,9 +240,13 @@ msgstr "BOB TVL Progress" msgid "BOB Wallet" msgstr "BOB Wallet" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:54 +msgid "Book a call" +msgstr "Book a call" + #: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:49 -msgid "Book Meeting" -msgstr "Book Meeting" +#~ msgid "Book Meeting" +#~ msgstr "Book Meeting" #: src/app/[lang]/(bridge)/bridge/page.tsx:14 #: src/app/[lang]/page.tsx:15 @@ -347,7 +351,7 @@ msgstr "Combining liquidity and security from Bitcoin and Ethereum. Mainnet live #: src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeCard.tsx:87 #: src/app/[lang]/(bridge)/stake/components/Unstake/ExternalStakeCard.tsx:83 -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:42 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:49 #: src/app/[lang]/fusion/components/Strategies/Strategies.tsx:210 msgid "Coming Soon" msgstr "Coming Soon" @@ -361,7 +365,7 @@ msgid "Common Prefix auditor" msgstr "Common Prefix auditor" #: src/app/[lang]/apps/components/HeroBanner/HeroBanner.tsx:29 -#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:43 +#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:51 msgid "Community Voting" msgstr "Community Voting" @@ -369,7 +373,7 @@ msgstr "Community Voting" msgid "Community Voting Information" msgstr "Community Voting Information" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:56 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:63 msgid "Complete a variety of on- and off-chain quests using Intract and the BOB Stake Portal to harvest an additional 62,500 Spice." msgstr "Complete a variety of on- and off-chain quests using Intract and the BOB Stake Portal to harvest an additional 62,500 Spice." @@ -418,7 +422,7 @@ msgstr "Copy Address" msgid "Copy referral URL" msgstr "Copy referral URL" -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:36 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:41 msgid "Create Account" msgstr "Create Account" @@ -447,7 +451,7 @@ msgid "Deploy high priority assets into high priority DeFi protocols to maximize msgstr "Deploy high priority assets into high priority DeFi protocols to maximize your Spice harvest." #: src/app/[lang]/(bridge)/bridge/Bridge.tsx:132 -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:38 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:41 msgid "Deposit" msgstr "Deposit" @@ -496,6 +500,7 @@ msgstr "Docs" msgid "Don't believe in the Bitcoin Renaissance? You can withdraw your funds from the contract to your wallet on Ethereum. You will no longer earn Spice if you withdraw your assets. <0>You will keep the Spice harvested so far." msgstr "Don't believe in the Bitcoin Renaissance? You can withdraw your funds from the contract to your wallet on Ethereum. You will no longer earn Spice if you withdraw your assets. <0>You will keep the Spice harvested so far." +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:50 #: src/app/[lang]/fusion/components/WelcomeModal/WelcomeModal.tsx:58 msgid "Don't show this message again" msgstr "Don't show this message again" @@ -592,7 +597,7 @@ msgstr "Featured Assets" msgid "Fee" msgstr "Fee" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:65 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:67 msgid "Feeling lucky? Try your luck with the daily lottery!<0/>Participate in Fusion voting to receive 3 lottery tickets each day." msgstr "Feeling lucky? Try your luck with the daily lottery!<0/>Participate in Fusion voting to receive 3 lottery tickets each day." @@ -617,7 +622,7 @@ msgid "Follow the steps of <0>this guide to provide liquity into a DEX pool msgstr "Follow the steps of <0>this guide to provide liquity into a DEX pool on Oku." #: src/app/[lang]/(bridge)/components/BannerCarousel/XBanner.tsx:18 -#: src/app/[lang]/fusion/Fusion.tsx:124 +#: src/app/[lang]/fusion/Fusion.tsx:134 msgid "Follow us on X" msgstr "Follow us on X" @@ -705,7 +710,7 @@ msgstr "Harvest {pointsMissing} more Spice to play" #~ msgid "Harvest {pointsMissing} more SPICE to your account to play" #~ msgstr "Harvest {pointsMissing} more SPICE to your account to play" -#: src/app/[lang]/fusion/Fusion.tsx:99 +#: src/app/[lang]/fusion/Fusion.tsx:109 msgid "Harvest Spice by depositing into BOB apps, voting, and solving quests. Keep an eye out for special events." msgstr "Harvest Spice by depositing into BOB apps, voting, and solving quests. Keep an eye out for special events." @@ -713,10 +718,14 @@ msgstr "Harvest Spice by depositing into BOB apps, voting, and solving quests. K msgid "Here are your active referrals and the Spice they're currently earning for you. The more they earn, the more you benefit!" msgstr "Here are your active referrals and the Spice they're currently earning for you. The more they earn, the more you benefit!" -#: src/app/[lang]/fusion/Fusion.tsx:92 +#: src/app/[lang]/fusion/Fusion.tsx:102 msgid "Hero dots" msgstr "Hero dots" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:57 +msgid "Hide" +msgstr "Hide" + #: src/app/[lang]/fusion/components/UserInfo/MultipliersModal.tsx:63 msgid "Holding" msgstr "Holding" @@ -770,7 +779,7 @@ msgid "Leaderboard" msgstr "Leaderboard" #: src/app/[lang]/fusion/components/WelcomeBackModal/WelcomeBackModal.tsx:81 -#: src/app/[lang]/fusion/Fusion.tsx:109 +#: src/app/[lang]/fusion/Fusion.tsx:119 msgid "Learn More" msgstr "Learn More" @@ -821,7 +830,7 @@ msgstr "Locked Amount" msgid "Locked Capital Breakdown" msgstr "Locked Capital Breakdown" -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:30 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:35 msgid "Log in" msgstr "Log in" @@ -829,7 +838,7 @@ msgstr "Log in" msgid "Log in to View Dashboard" msgstr "Log in to View Dashboard" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:77 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:79 msgid "Login to play" msgstr "Login to play" @@ -837,8 +846,8 @@ msgstr "Login to play" msgid "Login with wallet" msgstr "Login with wallet" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:36 -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:53 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:38 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:55 msgid "Lottery" msgstr "Lottery" @@ -942,7 +951,7 @@ msgstr "Network Fee" msgid "Network Fee Rate" msgstr "Network Fee Rate" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:49 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:56 msgid "New Quests Coming Soon" msgstr "New Quests Coming Soon" @@ -969,8 +978,8 @@ msgid "No new goal at the moment. Stay tuned for updates!" msgstr "No new goal at the moment. Stay tuned for updates!" #: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:52 -msgid "No Thanks" -msgstr "No Thanks" +#~ msgid "No Thanks" +#~ msgstr "No Thanks" #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:50 #~ msgid "Not enough spice" @@ -1013,7 +1022,7 @@ msgstr "open drawer" msgid "Optional: It's possible to repeat steps 2-4 multiple times." msgstr "Optional: It's possible to repeat steps 2-4 multiple times." -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:33 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:38 msgid "or" msgstr "or" @@ -1021,12 +1030,12 @@ msgstr "or" msgid "OtterSec auditor" msgstr "OtterSec auditor" -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:62 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:65 msgid "Pending" msgstr "Pending" #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:208 -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:77 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:79 msgid "Play" msgstr "Play" @@ -1080,7 +1089,7 @@ msgid "Provide liquidity into Oku DEX" msgstr "Provide liquidity into Oku DEX" #: src/app/[lang]/fusion/components/Leaderboard/Leaderboard.tsx:80 -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:49 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:56 msgid "Quests" msgstr "Quests" @@ -1480,7 +1489,7 @@ msgstr "The number of Intract and Galxe quests that you have completed" #~ msgid "The previous quest has ended. Stay tuned for more exciting quests with Intract and BOB Stake Portal. More rewards are on the way!" #~ msgstr "The previous quest has ended. Stay tuned for more exciting quests with Intract and BOB Stake Portal. More rewards are on the way!" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:61 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:68 msgid "The previous quest has ended. Stay tuned for more exciting quests with Intract and BOB Stake. More rewards are on the way!" msgstr "The previous quest has ended. Stay tuned for more exciting quests with Intract and BOB Stake. More rewards are on the way!" @@ -1549,7 +1558,7 @@ msgstr "This is the final amount you will receive after deducting the Protocol f msgid "This website is not available in your location due to geoblocking. Geoblocking is a practice used by content providers to restrict access to their content based on the geographical location of the user." msgstr "This website is not available in your location due to geoblocking. Geoblocking is a practice used by content providers to restrict access to their content based on the geographical location of the user." -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:41 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:46 msgid "Time left until voting round ends" msgstr "Time left until voting round ends" @@ -1558,7 +1567,7 @@ msgid "To cast your vote, please log in" msgstr "To cast your vote, please log in" #: src/app/[lang]/(bridge)/components/BannerCarousel/XBanner.tsx:22 -#: src/app/[lang]/fusion/Fusion.tsx:127 +#: src/app/[lang]/fusion/Fusion.tsx:137 msgid "To stay up-to date with the BOB ecosystem follow @build_on_bob." msgstr "To stay up-to date with the BOB ecosystem follow @build_on_bob." @@ -1619,7 +1628,7 @@ msgid "uniBTC represents the staked wBTC plus all future staking rewards and acc msgstr "uniBTC represents the staked wBTC plus all future staking rewards and accrual of Babylon staking rewards and Bedrock diamonds." #: src/app/[lang]/(bridge)/components/BridgeStatus/BridgeStep.tsx:230 -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:71 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:74 msgid "Unknown" msgstr "Unknown" @@ -1668,7 +1677,7 @@ msgid "Use your bridged assets in apps to maximise your Spice harvest.<0/>TIP: S msgstr "Use your bridged assets in apps to maximise your Spice harvest.<0/>TIP: Some types of apps offer greater multipliers than others. Explore the “Hot Strategies” section to learn more." #: src/app/[lang]/apps/components/HeroBanner/HeroBanner.tsx:32 -#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:46 +#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:54 msgid "Use your Spice total to support your favourite BOB builders. Winners will be announced each week." msgstr "Use your Spice total to support your favourite BOB builders. Winners will be announced each week." @@ -1694,7 +1703,7 @@ msgstr "View a summary of your wallet on the BOB network. DeFi positions may not msgid "View All Transactions" msgstr "View All Transactions" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:78 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:85 msgid "View Intract" msgstr "View Intract" @@ -1702,13 +1711,13 @@ msgstr "View Intract" msgid "View Multipliers" msgstr "View Multipliers" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:78 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:85 #: src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx:218 msgid "View Quests" msgstr "View Quests" #: src/app/[lang]/apps/components/SpiceChip/SpiceChip.tsx:99 -#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:51 +#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:59 msgid "Vote" msgstr "Vote" @@ -1720,7 +1729,7 @@ msgstr "Vote for maximum three projects per week" msgid "Vote for maximum three projects per week by clicking on the flame icon." msgstr "Vote for maximum three projects per week by clicking on the flame icon." -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:20 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:25 msgid "Votes Left:" msgstr "Votes Left:" @@ -1770,7 +1779,7 @@ msgid "When you vote, you do not give away any of your harvest. Your Spice total msgstr "When you vote, you do not give away any of your harvest. Your Spice total is simply used to calculate the weight of your vote." #: src/app/[lang]/(bridge)/bridge/Bridge.tsx:135 -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:38 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:41 msgid "Withdraw" msgstr "Withdraw" @@ -1796,7 +1805,7 @@ msgstr "Yield Assets" msgid "You" msgstr "You" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:31 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:32 msgid "You are one of the top 100 Spice holders in BOB Fusion" msgstr "You are one of the top 100 Spice holders in BOB Fusion" diff --git a/apps/evm/src/locales/zh.po b/apps/evm/src/locales/zh.po index fa41c172b..c1c691acd 100644 --- a/apps/evm/src/locales/zh.po +++ b/apps/evm/src/locales/zh.po @@ -22,11 +22,11 @@ msgstr "" #~ msgid "{0}" #~ msgstr "" -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:49 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:52 msgid "{0} ago" msgstr "" -#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:47 +#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:52 msgid "{0} remaining" msgstr "" @@ -34,15 +34,15 @@ msgstr "" #~ msgid "{0} until next draw" #~ msgstr "" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:40 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:42 msgid "{0} until quest ends" msgstr "距离任务结束还有{0}" -#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:37 +#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:40 msgid "{0} until voting round ends" msgstr "距离投票轮结束还有{0}" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:49 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:51 msgid "{timeToNextDraw} until next draw" msgstr "" @@ -54,7 +54,7 @@ msgstr "* 显示的倍数可能会根据相应项目的支付结构而变化。" msgid "< 1 minute" msgstr "" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:55 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:57 msgid "<0>{0} {1, plural, one {Ticket} other {Tickets}} Remaining" msgstr "" @@ -71,7 +71,7 @@ msgstr "" msgid "<0>Stake your BTC with 1-click and receive BTC LSTs on BOB." msgstr "<0>一键质押你的BTC 并在BOB上接收BTC LSTs。" -#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:44 +#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:48 msgid "2 hours" msgstr "" @@ -84,7 +84,7 @@ msgstr "" msgid "404 Error" msgstr "404 错误" -#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:44 +#: src/app/[lang]/(bridge)/components/BridgeStatus/TimeStep.tsx:48 msgid "7 days" msgstr "" @@ -146,7 +146,7 @@ msgstr "" msgid "Apps Used" msgstr "已体验的应用" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:34 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:35 msgid "As one of our most important community members, we would love the opportunity to gain your input on the BOB ecosystem and our future plans." msgstr "" @@ -202,7 +202,7 @@ msgstr "" msgid "BOB Bridge" msgstr "" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:40 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:41 msgid "BOB co-founder, <0>Alexei Zamyatin, would like to invite you to a private 1-to-1 call to hear your thoughts on BOB and Bitcoin DeFi. If you are interested, please click the button below to book a call at a time that suits you." msgstr "" @@ -211,7 +211,7 @@ msgid "BOB Ecosystem on OKX Cryptopedia" msgstr "" #: src/app/[lang]/(bridge)/components/BannerCarousel/FusionBanner.tsx:22 -#: src/app/[lang]/fusion/Fusion.tsx:96 +#: src/app/[lang]/fusion/Fusion.tsx:106 msgid "BOB Fusion: The Final Season" msgstr "BOB Fusion:最终季" @@ -240,10 +240,14 @@ msgstr "BOB TVL进度" msgid "BOB Wallet" msgstr "BOB 钱包" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:49 -msgid "Book Meeting" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:54 +msgid "Book a call" msgstr "" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:49 +#~ msgid "Book Meeting" +#~ msgstr "" + #: src/app/[lang]/(bridge)/bridge/page.tsx:14 #: src/app/[lang]/page.tsx:15 #: src/app/[lang]/wallet/components/TokenTable/ButtonGroup.tsx:75 @@ -347,7 +351,7 @@ msgstr "结合比特币和以太坊的流动性和安全性。= 主网已上线 #: src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeCard.tsx:87 #: src/app/[lang]/(bridge)/stake/components/Unstake/ExternalStakeCard.tsx:83 -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:42 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:49 #: src/app/[lang]/fusion/components/Strategies/Strategies.tsx:210 msgid "Coming Soon" msgstr "即将推出" @@ -361,7 +365,7 @@ msgid "Common Prefix auditor" msgstr "" #: src/app/[lang]/apps/components/HeroBanner/HeroBanner.tsx:29 -#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:43 +#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:51 msgid "Community Voting" msgstr "社区投票" @@ -369,7 +373,7 @@ msgstr "社区投票" msgid "Community Voting Information" msgstr "社区投票信息" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:56 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:63 msgid "Complete a variety of on- and off-chain quests using Intract and the BOB Stake Portal to harvest an additional 62,500 Spice." msgstr "完成各种链上和链下任务,使用Intract和BOB Stake来额外收获62,500 Spice。" @@ -418,7 +422,7 @@ msgstr "" msgid "Copy referral URL" msgstr "复制推荐URL" -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:36 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:41 msgid "Create Account" msgstr "创建账户" @@ -447,7 +451,7 @@ msgid "Deploy high priority assets into high priority DeFi protocols to maximize msgstr "将高优先级资产部署到高优先级DeFi协议中,以最大化你的Spice收获。" #: src/app/[lang]/(bridge)/bridge/Bridge.tsx:132 -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:38 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:41 msgid "Deposit" msgstr "" @@ -496,6 +500,7 @@ msgstr "" msgid "Don't believe in the Bitcoin Renaissance? You can withdraw your funds from the contract to your wallet on Ethereum. You will no longer earn Spice if you withdraw your assets. <0>You will keep the Spice harvested so far." msgstr "想要退出?你可以将资金从合约中提取到以太坊钱包。请注意,提取资产后你将不再赚取Spice。<0>不过,你已收获的Spice都会保留。" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:50 #: src/app/[lang]/fusion/components/WelcomeModal/WelcomeModal.tsx:58 msgid "Don't show this message again" msgstr "不再显示此消息" @@ -592,7 +597,7 @@ msgstr "特色资产" msgid "Fee" msgstr "" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:65 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:67 msgid "Feeling lucky? Try your luck with the daily lottery!<0/>Participate in Fusion voting to receive 3 lottery tickets each day." msgstr "" @@ -617,7 +622,7 @@ msgid "Follow the steps of <0>this guide to provide liquity into a DEX pool msgstr "按照 <0>本指南 的步骤为Oku上的DEX池提供流动性。" #: src/app/[lang]/(bridge)/components/BannerCarousel/XBanner.tsx:18 -#: src/app/[lang]/fusion/Fusion.tsx:124 +#: src/app/[lang]/fusion/Fusion.tsx:134 msgid "Follow us on X" msgstr "" @@ -705,7 +710,7 @@ msgstr "" #~ msgid "Harvest {pointsMissing} more SPICE to your account to play" #~ msgstr "" -#: src/app/[lang]/fusion/Fusion.tsx:99 +#: src/app/[lang]/fusion/Fusion.tsx:109 msgid "Harvest Spice by depositing into BOB apps, voting, and solving quests. Keep an eye out for special events." msgstr "通过存入BOB应用、投票和完成任务来收获Spice。密切关注特别活动" @@ -713,10 +718,14 @@ msgstr "通过存入BOB应用、投票和完成任务来收获Spice。密切关 msgid "Here are your active referrals and the Spice they're currently earning for you. The more they earn, the more you benefit!" msgstr "这里展示了你推荐的活跃用户及他们为你赚取的Spice。他们赚得越多,你获益越多!" -#: src/app/[lang]/fusion/Fusion.tsx:92 +#: src/app/[lang]/fusion/Fusion.tsx:102 msgid "Hero dots" msgstr "" +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:57 +msgid "Hide" +msgstr "" + #: src/app/[lang]/fusion/components/UserInfo/MultipliersModal.tsx:63 msgid "Holding" msgstr "持有" @@ -770,7 +779,7 @@ msgid "Leaderboard" msgstr "排行榜" #: src/app/[lang]/fusion/components/WelcomeBackModal/WelcomeBackModal.tsx:81 -#: src/app/[lang]/fusion/Fusion.tsx:109 +#: src/app/[lang]/fusion/Fusion.tsx:119 msgid "Learn More" msgstr "了解更多" @@ -821,7 +830,7 @@ msgstr "锁定金额" msgid "Locked Capital Breakdown" msgstr "锁定资本明细" -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:30 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:35 msgid "Log in" msgstr "登录" @@ -829,7 +838,7 @@ msgstr "登录" msgid "Log in to View Dashboard" msgstr "登录查看仪表板" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:77 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:79 msgid "Login to play" msgstr "" @@ -837,8 +846,8 @@ msgstr "" msgid "Login with wallet" msgstr "使用钱包登录" -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:36 -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:53 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:38 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:55 msgid "Lottery" msgstr "" @@ -942,7 +951,7 @@ msgstr "" msgid "Network Fee Rate" msgstr "" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:49 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:56 msgid "New Quests Coming Soon" msgstr "" @@ -969,8 +978,8 @@ msgid "No new goal at the moment. Stay tuned for updates!" msgstr "目前暂无新目标。请保持关注更新!" #: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:52 -msgid "No Thanks" -msgstr "" +#~ msgid "No Thanks" +#~ msgstr "" #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:50 #~ msgid "Not enough spice" @@ -1013,7 +1022,7 @@ msgstr "" msgid "Optional: It's possible to repeat steps 2-4 multiple times." msgstr "可选:可以多次重复步骤2-4。" -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:33 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:38 msgid "or" msgstr "或" @@ -1021,12 +1030,12 @@ msgstr "或" msgid "OtterSec auditor" msgstr "" -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:62 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:65 msgid "Pending" msgstr "" #: src/app/[lang]/fusion/components/LotterySections/LotteryModal/LotteryModal.tsx:208 -#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:77 +#: src/app/[lang]/fusion/components/LotterySections/LotterySections.tsx:79 msgid "Play" msgstr "" @@ -1080,7 +1089,7 @@ msgid "Provide liquidity into Oku DEX" msgstr "为Oku DEX提供流动性" #: src/app/[lang]/fusion/components/Leaderboard/Leaderboard.tsx:80 -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:49 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:56 msgid "Quests" msgstr "任务" @@ -1480,7 +1489,7 @@ msgstr "在Intract和Galxe上完成的任务" #~ msgid "The previous quest has ended. Stay tuned for more exciting quests with Intract and BOB Stake Portal. More rewards are on the way!" #~ msgstr "" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:61 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:68 msgid "The previous quest has ended. Stay tuned for more exciting quests with Intract and BOB Stake. More rewards are on the way!" msgstr "" @@ -1545,7 +1554,7 @@ msgstr "" msgid "This website is not available in your location due to geoblocking. Geoblocking is a practice used by content providers to restrict access to their content based on the geographical location of the user." msgstr "" -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:41 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:46 msgid "Time left until voting round ends" msgstr "" @@ -1554,7 +1563,7 @@ msgid "To cast your vote, please log in" msgstr "" #: src/app/[lang]/(bridge)/components/BannerCarousel/XBanner.tsx:22 -#: src/app/[lang]/fusion/Fusion.tsx:127 +#: src/app/[lang]/fusion/Fusion.tsx:137 msgid "To stay up-to date with the BOB ecosystem follow @build_on_bob." msgstr "" @@ -1615,7 +1624,7 @@ msgid "uniBTC represents the staked wBTC plus all future staking rewards and acc msgstr "" #: src/app/[lang]/(bridge)/components/BridgeStatus/BridgeStep.tsx:230 -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:71 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:74 msgid "Unknown" msgstr "" @@ -1664,7 +1673,7 @@ msgid "Use your bridged assets in apps to maximise your Spice harvest.<0/>TIP: S msgstr "在应用中使用你跨链的资产以最大化你的Spice收获。<0/>提示:某些类型的应用提供更高的倍数。浏览\"热门策略\"部分以了解更多。" #: src/app/[lang]/apps/components/HeroBanner/HeroBanner.tsx:32 -#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:46 +#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:54 msgid "Use your Spice total to support your favourite BOB builders. Winners will be announced each week." msgstr "用你的Spice总数来支持你最喜爱的BOB构建者。获胜者将每周公布。" @@ -1690,7 +1699,7 @@ msgstr "查看您在 BOB 网络上的钱包概况。" msgid "View All Transactions" msgstr "" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:78 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:85 msgid "View Intract" msgstr "" @@ -1698,13 +1707,13 @@ msgstr "" msgid "View Multipliers" msgstr "查看倍数" -#: src/app/[lang]/fusion/components/Quest/Quest.tsx:78 +#: src/app/[lang]/fusion/components/Quest/Quest.tsx:85 #: src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx:218 msgid "View Quests" msgstr "查看任务" #: src/app/[lang]/apps/components/SpiceChip/SpiceChip.tsx:99 -#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:51 +#: src/app/[lang]/fusion/components/CommunityVoting/CommunityVoting.tsx:59 msgid "Vote" msgstr "投票" @@ -1716,7 +1725,7 @@ msgstr "每周最多可以为三个项目投票" msgid "Vote for maximum three projects per week by clicking on the flame icon." msgstr "通过点击火焰图标,每周最多可为三个项目投票" -#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:20 +#: src/app/[lang]/apps/components/VotingDashboard/UserVotingInfo.tsx:25 msgid "Votes Left:" msgstr "剩余投票次数:" @@ -1766,7 +1775,7 @@ msgid "When you vote, you do not give away any of your harvest. Your Spice total msgstr "投票时,你不会失去任何收获。你的Spice总数仅用于计算你的投票权重。" #: src/app/[lang]/(bridge)/bridge/Bridge.tsx:135 -#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:38 +#: src/app/[lang]/(bridge)/components/TransactionList/TransactionDetails.tsx:41 msgid "Withdraw" msgstr "" @@ -1792,7 +1801,7 @@ msgstr "收益资产" msgid "You" msgstr "" -#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:31 +#: src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx:32 msgid "You are one of the top 100 Spice holders in BOB Fusion" msgstr "" From 50e0d9cc3f743f7f2ee29bf99289c1fefd6322a2 Mon Sep 17 00:00:00 2001 From: Slava Date: Thu, 28 Nov 2024 17:25:12 +0300 Subject: [PATCH 13/17] chore: capitalize `book a call` --- .../fusion/components/TopUserModal/TopUserModal.tsx | 2 +- apps/evm/src/locales/en.po | 8 ++++++-- apps/evm/src/locales/zh.po | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx index 364067504..3417fa3f9 100644 --- a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx @@ -51,7 +51,7 @@ const TopUserModal = ({ onClose, isOpen, ...props }: TopUserModalProps): JSX.Ele + setDontShow(e.target.checked)} + > + Don't show this message again + Date: Thu, 28 Nov 2024 20:51:38 +0300 Subject: [PATCH 15/17] chore: add book a meeting button --- apps/evm/src/app/[lang]/fusion/Fusion.tsx | 11 +++++------ .../components/TopUserModal/TopUserModal.tsx | 12 ++++-------- .../fusion/components/UserInfo/UserInfo.tsx | 16 +++++++++++++--- apps/evm/src/constants/local-storage.ts | 3 ++- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/apps/evm/src/app/[lang]/fusion/Fusion.tsx b/apps/evm/src/app/[lang]/fusion/Fusion.tsx index 0bbc3549a..4941afd3f 100644 --- a/apps/evm/src/app/[lang]/fusion/Fusion.tsx +++ b/apps/evm/src/app/[lang]/fusion/Fusion.tsx @@ -49,14 +49,12 @@ const Fusion = () => { const questsSectionId = useId(); - const [shouldDisplayTopUserModal, setShouldDisplayTopUserModal] = useState(false); - - useEffect(() => { - if (user?.notices.showIsFusionTopUser) setShouldDisplayTopUserModal(true); - }, [user]); + const [showTopUserModal, setShowTopUserModal] = useLocalStorage(LocalStorageKey.SHOW_TOP_USER_MODAL, true, { + initializeWithValue: isClient + }); const onCloseModal = (shouldDismissTopUserModal: boolean) => { - setShouldDisplayTopUserModal(false); + setShowTopUserModal(false); if (shouldDismissTopUserModal) dismissTopUserModal(); }; @@ -93,6 +91,7 @@ const Fusion = () => { const isAuthenticated = Boolean(user && address); const hasPastHarvest = user?.leaderboardRank && user.leaderboardRank.total_points > 0; + const shouldDisplayTopUserModal = user?.notices.showIsFusionTopUser && showTopUserModal; return ( diff --git a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx index c83b36ac7..078d1654d 100644 --- a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx @@ -47,18 +47,14 @@ const TopUserModal = ({ onClose, isOpen, ...props }: TopUserModalProps): JSX.Ele - + - setDontShow(e.target.checked)} - > + setDontShow(e.target.checked)}> Don't show this message again diff --git a/apps/evm/src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx b/apps/evm/src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx index c3cf86d01..69d1b97d2 100644 --- a/apps/evm/src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx @@ -23,7 +23,7 @@ import { t, Trans } from '@lingui/macro'; import { useLingui } from '@lingui/react'; import { useParams, useRouter } from 'next/navigation'; import { useState } from 'react'; -import { useCopyToClipboard, useSessionStorage } from 'usehooks-ts'; +import { useCopyToClipboard, useLocalStorage, useSessionStorage } from 'usehooks-ts'; import { Barometer } from './Barometer'; import { MultipliersModal } from './MultipliersModal'; @@ -44,7 +44,7 @@ import { UserReferralModal } from './UserReferralModal'; import { AppData } from '@/app/[lang]/apps/hooks'; import { LoginSection, SignUpButton, SpiceAmount } from '@/components'; -import { isClient, RoutesPath } from '@/constants'; +import { isClient, LocalStorageKey, RoutesPath } from '@/constants'; import { fusionKeys } from '@/lib/react-query'; import { SessionStorageKey } from '@/types'; import { apiClient, QuestS3Response, UserResponse } from '@/utils'; @@ -65,6 +65,9 @@ const UserInfo = ({ apps, user, quests, isAuthenticated }: UserInfoProps) => { const [, setScrollQuests] = useSessionStorage(SessionStorageKey.SCROLL_QUESTS, false, { initializeWithValue: isClient }); + const [, setShowTopUserModal] = useLocalStorage(LocalStorageKey.SHOW_TOP_USER_MODAL, true, { + initializeWithValue: isClient + }); const [, copy] = useCopyToClipboard(); const { data: tvlLevel, isLoading: isLoadingTvlLevel } = useQuery({ @@ -106,7 +109,14 @@ const UserInfo = ({ apps, user, quests, isAuthenticated }: UserInfoProps) => { return ( - + + {user?.notices.showIsFusionTopUser && ( + + + + )}
diff --git a/apps/evm/src/constants/local-storage.ts b/apps/evm/src/constants/local-storage.ts index 217a4f961..397d451d8 100644 --- a/apps/evm/src/constants/local-storage.ts +++ b/apps/evm/src/constants/local-storage.ts @@ -4,6 +4,7 @@ enum LocalStorageKey { HIDE_FAULT_PROOFS_NOTICE = 'hideFaultsProofsNotice', HIDE_FUSION_WELCOME_MODAL = 'hideFusionWelcomeModal', HIDE_FUSION_WELCOME_BACK_MODAL = 'hideFusionWelcomeBackModal', - PROMPT_SWITCH_CHAIN = 'promptSwitchChain' + PROMPT_SWITCH_CHAIN = 'promptSwitchChain', + SHOW_TOP_USER_MODAL = 'showTopUserModal' } export { LocalStorageKey }; From 2895bfdfc3086819839c4db5ac4a6caefeffd8d6 Mon Sep 17 00:00:00 2001 From: Slava Date: Fri, 29 Nov 2024 12:07:08 +0300 Subject: [PATCH 16/17] chore: add copy line for button --- .../fusion/components/TopUserModal/TopUserModal.tsx | 6 +++--- .../app/[lang]/fusion/components/UserInfo/UserInfo.tsx | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx index 078d1654d..257d8a8f9 100644 --- a/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/TopUserModal/TopUserModal.tsx @@ -47,12 +47,12 @@ const TopUserModal = ({ onClose, isOpen, ...props }: TopUserModalProps): JSX.Ele - + setDontShow(e.target.checked)}> Don't show this message again diff --git a/apps/evm/src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx b/apps/evm/src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx index ba3c69e73..2a4610444 100644 --- a/apps/evm/src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx +++ b/apps/evm/src/app/[lang]/fusion/components/UserInfo/UserInfo.tsx @@ -109,6 +109,14 @@ const UserInfo = ({ apps, user, quests, isAuthenticated }: UserInfoProps) => { return ( + {user?.notices.showIsFusionTopUser && ( +

+ + You are one of the top 100 Spice holders in BOB Fusion. We would love to hear your thoughts on the BOB + ecosystem and Bitcoin DeFi. + +

+ )} {user?.notices.showIsFusionTopUser && ( From 8e94b307bece2d9632dfc329084f1fbbdb0df9c3 Mon Sep 17 00:00:00 2001 From: Slava Date: Fri, 29 Nov 2024 12:24:11 +0300 Subject: [PATCH 17/17] fix: keys for user query --- .../src/app/[lang]/fusion/hooks/useDismissTopUserModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/evm/src/app/[lang]/fusion/hooks/useDismissTopUserModal.tsx b/apps/evm/src/app/[lang]/fusion/hooks/useDismissTopUserModal.tsx index 086f8f4ea..02b8d6738 100644 --- a/apps/evm/src/app/[lang]/fusion/hooks/useDismissTopUserModal.tsx +++ b/apps/evm/src/app/[lang]/fusion/hooks/useDismissTopUserModal.tsx @@ -13,7 +13,7 @@ const useDismissTopUserModal = () => { mutationFn: () => apiClient.dismissTopUserModal(), onSuccess() { queryClient.setQueryData( - ['user'], + fusionKeys.user(), (oldData: UserResponse): UserResponse => ({ ...oldData, notices: { @@ -23,7 +23,7 @@ const useDismissTopUserModal = () => { ); }, onSettled() { - queryClient.refetchQueries({ queryKey: ['user'] }); + queryClient.refetchQueries({ queryKey: fusionKeys.user() }); } }); };