Skip to content

Commit

Permalink
fix: reward pool id could be 0 (#100)
Browse files Browse the repository at this point in the history
* fix: reward pool id could be 0

* chore: lingui extract

---------

Co-authored-by: swkatmask <[email protected]>
  • Loading branch information
swkatmask and swkatmask authored May 25, 2024
1 parent 4562eaf commit f0dc6aa
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 90 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ module.exports = {
'eslint-plugin-unicorn',
'eslint-plugin-import',
],
settings: {
react: {
version: 'detect',
},
},
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'@typescript-eslint/no-unused-vars': 'warn',
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const ConnectButton: ComponentType<ConnectButtonProps> = memo(({ connectT
>
<ConnectedWalletIcon rounded="100%" bg="white" />
<Box as="span" ml={1} w="110px" lineHeight="20px">
{account.ensName ? account.ensName : formatEthereumAddress(account.address, 4)}
{account.ensName || formatEthereumAddress(account.address, 4)}
</Box>
</Flex>
<Flex
Expand Down
1 change: 0 additions & 1 deletion src/components/StakeMaskStatusCard/ActivityStatusTag.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react-hooks/exhaustive-deps */
import { Box, type BoxProps, Skeleton } from '@chakra-ui/react'
import { t } from '@lingui/macro'
import { ComponentType } from 'react'
Expand Down
1 change: 1 addition & 0 deletions src/components/StakeMaskStatusCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const StakeMaskStatusCard: ComponentType<StakeMaskStatusCardProps> = ({ .
if (!stake) return
const abort = new AbortController()
stakeModal.show(undefined, abort.signal)
history.replaceState(history.state, '', '/')
return () => {
abort.abort()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface BoundaryProps extends PropsWithChildren {
export const BlackListBoundary = memo(function BlackListBoundary({ children }: BoundaryProps) {
const account = useAccount()

const enabled = !!account.address && !!account.chainId
const enabled = !!account.address && account.chainId !== undefined
const { data: inBlackList } = useQuery({
queryKey: ['address-security', account.address, account.chainId],
enabled,
Expand Down
2 changes: 1 addition & 1 deletion src/components/StakingRanking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const StakingRankingList: ComponentType = () => {
return (
<Flex w="100%" wrap="wrap" justify="center" gap="64px">
<RankingItem boxSize="80px" isCrown item={topScorer} highlight mx="auto" />
{secondScorer && thirdTopScorer ? (
{secondScorer || thirdTopScorer ? (
<Flex justify="center" w="100%" gap="64px" h="64px">
{secondScorer ? <RankingItem item={secondScorer} highlight /> : null}
{thirdTopScorer ? <RankingItem item={thirdTopScorer} highlight /> : null}
Expand Down
4 changes: 2 additions & 2 deletions src/components/UserStatus/RewardCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const RewardCard = memo(function RewardCard({
unlocked,
...props
}: Props) {
reward?.reward_pool_id
const account = useAccount()
const { chainId, rewardAddress } = usePoolStore()
const { data: token } = useToken({ chainId, address: reward?.address })
Expand All @@ -43,7 +42,8 @@ export const RewardCard = memo(function RewardCard({
abi: rewardABI,
address: rewardAddress,
functionName: 'userRewards',
args: reward?.reward_pool_id && account.address ? [reward.reward_pool_id, account.address] : undefined,
args:
reward?.reward_pool_id !== undefined && account.address ? [reward.reward_pool_id, account.address] : undefined,
})

const [{ switchingChain, claiming, loadingUserInfo, waiting }, claimReward] = useClaimReward(reward, {
Expand Down
5 changes: 2 additions & 3 deletions src/components/UserStatus/useHasUnstaked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ export function useHasUnstaked() {
const client = usePublicClient({ chainId })
const { data: toBlock } = useBlockNumber({ chainId })
const { data: poolInfo } = usePoolInfo()
const enabled = !!toBlock && !!client && !!poolInfo?.point_acc_end_block
return useQuery({
enabled,
queryKey: ['has-unstaked', account.address, poolId],
enabled: !!client,
queryKey: ['has-unstaked', account.address, poolId, toBlock?.toString()],
queryFn: async () => {
if (!client || !toBlock) return
const fromBlock = poolInfo?.point_acc_end_block ? BigInt(poolInfo.point_acc_end_block) : toBlock - BigInt(20000)
Expand Down
84 changes: 3 additions & 81 deletions src/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,16 @@ msgstr ""
msgid "Connect Wallet"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "Contact Us"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "Cookie Policy"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "Cookies are small text files that are stored on your computer or mobile device when you visit a website. They are used to store information about you and your internet usage habits to improve your online experience. Cookies enable websites to recognize your device and remember some information about your preferences."
msgstr ""
Expand Down Expand Up @@ -148,17 +147,14 @@ msgstr ""
msgid "FAQs"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "How to Control Cookies"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "If you have any questions or concerns about this Cookie Policy, please contact us at:"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "[email protected]"
msgstr ""
Expand All @@ -167,41 +163,6 @@ msgstr ""
msgid "Insufficient balance"
msgstr ""

#: src/components/Footer/Terms/index.tsx
msgid ""
"Introduction\n"
"Mask Network is committed to protecting the privacy of its users. This Privacy Policy outlines how we collect, use, disclose, and safeguard your information when you stake Mask to receive other token rewards through our website. By using our service, you consent to the data practices described in this policy.\n"
"Information Collection and Use\n"
"Information You Provide to Us\n"
"We collect information you provide directly to us when you use our services. This may include:\n"
"Contact information, such as your name, email address, and phone number.\n"
"Blockchain-related information, such as your wallet addresses.\n"
"Social media account information, including but not limited to accounts on platforms like x.com.\n"
"When you choose to link your social media accounts or provide your wallet addresses, we may display this information on our website to enhance the user experience and foster a community environment. We encourage you to review the privacy settings and policies of any social media platforms you interact with to understand how your information may be shared and used.\n"
"Information We Collect Automatically\n"
"When you access our website, we may automatically collect information about your device and usage, including:\n"
"IP address, browser type, and operating system.\n"
"Information about your interactions with our website, such as the pages you visit.\n"
"Use of Your Information\n"
"We use the information we collect about you to:\n"
"Provide, maintain, and improve our services.\n"
"Display your social media profiles and wallet addresses on our website, subject to your preferences and permissions.\n"
"Respond to your inquiries and provide customer support.\n"
"Monitor and analyze trends, usage, and activities in connection with our services.\n"
"Sharing of Your Information\n"
"We may share your information with third parties in the following situations:\n"
"With your consent or at your direction.\n"
"With service providers who assist us in our operations, under confidentiality agreements.\n"
"If required by law or to protect the rights, property, or safety of [Your Website Name], our users, or others.\n"
"Security\n"
"We take reasonable measures to protect your information from unauthorized access, use, alteration, and destruction. However, no internet or email transmission is ever fully secure or error-free.\n"
"Changes to This Privacy Policy\n"
"We may update this Privacy Policy from time to time. We will notify you of any changes by posting the new policy on this page and updating the \"Last Updated\" date.\n"
"Contact Us\n"
"If you have any questions about this Privacy Policy, please contact us at [email protected]."
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "Last Updated: 03.10 2024"
msgstr ""
Expand Down Expand Up @@ -258,7 +219,6 @@ msgstr ""
msgid "Ongoing"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "Persistent Cookies: These cookies are stored on your device until they reach their expiration date or are manually deleted. They are used to remember your preferences and provide a personalized experience when you revisit the website."
msgstr ""
Expand All @@ -271,6 +231,7 @@ msgstr ""
msgid "Pool Liquidity"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/components/Footer/Terms/index.tsx
msgid "Privacy Policy"
msgstr ""
Expand All @@ -291,7 +252,6 @@ msgstr ""
msgid "Ranking updates every 10 min"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "Session Cookies: These cookies exist only during your visit to the website and are automatically deleted when you close your browser. They are used to maintain session state, such as storing the contents of your shopping cart."
msgstr ""
Expand Down Expand Up @@ -378,46 +338,14 @@ msgid "Support"
msgstr ""

#: src/components/Footer/Terms/index.tsx
msgid "Terms of Use"
msgstr ""

#: src/components/Footer/Terms/index.tsx
msgid ""
"Terms of Use for Mask.io\n"
"Acceptance of Terms\n"
"By accessing and using Mask.io , you agree to be bound by these Terms of Use (\"Terms\"). If you do not agree to these Terms, you may not use our services.\n"
"Changes to Terms\n"
"We reserve the right to modify these Terms at any time. We will notify you of any changes by posting the new Terms on this page. Your continued use of our services after any changes indicates your acceptance of the new Terms.\n"
"Use of Our Services\n"
"[Your Website Name] allows you to stake Mask to receive other token rewards. You agree to use our services only for lawful purposes and in accordance with these Terms.\n"
"Account Responsibilities\n"
"You are responsible for maintaining the confidentiality of your account information and for all activities that occur under your account.\n"
"You agree to notify us immediately of any unauthorized use of your account.\n"
"Prohibited Activities\n"
"You agree not to engage in any of the following prohibited activities:\n"
"Using our services for any illegal purpose or in violation of any local, state, national, or international law.\n"
"Infringing on the intellectual property rights of others or the intellectual property rights of Mask.io.\n"
"Attempting to gain unauthorized access to our services or another user's account.\n"
"Interfering with the security-related features of our services.\n"
"Intellectual Property\n"
"All content, trademarks, logos, and service marks displayed on Mask.io are our property or the property of other third parties. You are not permitted to use these Marks without our prior written consent or the consent of such third party which may own the Marks.\n"
"Disclaimer of Warranties\n"
"Our services are provided on an \"as is\" and \"as available\" basis. Mask.io expressly disclaims all warranties of any kind, whether express or implied, including, but not limited to, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement.\n"
"Limitation of Liability\n"
"[Your Website Name] shall not be liable for any indirect, incidental, special, consequential, or punitive damages, including but not limited to, damages for loss of profits, goodwill, use, data, or other intangible losses, resulting from the use or the inability to use our services.\n"
"Indemnification\n"
"You agree to indemnify and hold harmless Mask.io and its officers, directors, employees, and agents from any and all claims, damages, expenses, and liabilities arising out of your use of our services, your violation of these Terms, or your violation of the rights of a third party.\n"
"Governing Law\n"
"These Terms shall be governed and construed in accordance with the laws of the People's Republic of China, without regard to its conflict of law provisions.\n"
"Contact Us\n"
"If you have any questions about these Terms, please contact us at [email protected]."
msgid "Terms of Use"
msgstr ""

#: src/modals/StakeModal.tsx
msgid "The staking addresses need to pass Go+ security check. Note that staking is not available in some restricted regions. <0>More</0>"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "Third-Party Cookies: The Site may use cookies from third-party service providers for traffic analysis and user behavior tracking, as well as to display ads relevant to your interests."
msgstr ""
Expand All @@ -426,7 +354,6 @@ msgstr ""
msgid "This is the first phase of the MASK staking event. You will be able to retrieve your staked MASK tokens and reward tokens only after the event concludes."
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "This website (hereinafter referred to as \"the Site\") uses cookies. By using the Site, you consent to the use of cookies as described in this Cookie Policy."
msgstr ""
Expand Down Expand Up @@ -468,7 +395,6 @@ msgstr ""
msgid "Transaction submitted!"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "Types of Cookies We Use"
msgstr ""
Expand Down Expand Up @@ -499,7 +425,6 @@ msgstr ""
msgid "Unstake Successfully"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "Updates to the Cookie Policy"
msgstr ""
Expand All @@ -513,7 +438,6 @@ msgstr ""
msgid "Waiting for transaction confirmation"
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "We reserve the right to update this Cookie Policy at any time. The updated Cookie Policy will be posted on this page and will become effective immediately. We recommend checking back regularly for updates."
msgstr ""
Expand All @@ -522,7 +446,6 @@ msgstr ""
msgid "We use our own cookies."
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "What Are Cookies?"
msgstr ""
Expand All @@ -535,7 +458,6 @@ msgstr ""
msgid "You can claim after the event ends."
msgstr ""

#: src/components/Footer/Terms/index.tsx
#: src/modals/CookiePolicyModal.tsx
msgid "You can manage and delete cookies through your browser settings. Please note that disabling cookies may affect your access to and experience on the Site."
msgstr ""
Expand Down

0 comments on commit f0dc6aa

Please sign in to comment.