diff --git a/dapp/src/pages/DashboardPage/AcrePointsCard/AcrePointsLabel.tsx b/dapp/src/pages/DashboardPage/AcrePointsCard/AcrePointsLabel.tsx
index b8eef9651..62797243c 100644
--- a/dapp/src/pages/DashboardPage/AcrePointsCard/AcrePointsLabel.tsx
+++ b/dapp/src/pages/DashboardPage/AcrePointsCard/AcrePointsLabel.tsx
@@ -1,27 +1,16 @@
import React from "react"
import { TextMd } from "#/components/shared/Typography"
-import { Button, HStack, VStack } from "@chakra-ui/react"
+import { HStack } from "@chakra-ui/react"
import Countdown from "#/components/shared/Countdown"
-import { logPromiseFailure, numberToLocaleString } from "#/utils"
-import {
- useAcrePointsData,
- useClaimPoints,
- useUserPointsData,
- useWallet,
-} from "#/hooks"
-import Spinner from "#/components/shared/Spinner"
-import TooltipIcon from "#/components/shared/TooltipIcon"
-import useDebounce from "#/hooks/useDebounce"
-import { ONE_SEC_IN_MILLISECONDS } from "#/constants"
+import { logPromiseFailure } from "#/utils"
+import { useAcrePointsData, useUserPointsData } from "#/hooks"
+import LabelWrapper from "./LabelWrapper"
// TODO: Define colors as theme value
const COLOR_TEXT_LIGHT_PRIMARY = "#1C1A16"
const COLOR_TEXT_LIGHT_TERTIARY = "#7D6A4B"
-// TODO: Update `Button` component theme
-const COLOR_BUTTON_LABEL = "#FBF7EC"
-const COLOR_BUTTON_BACKGROUND = "#33A321"
-function NextDropTimestampLabel() {
+export function NextDropTimestampLabel() {
const { data: acrePointsData, refetch: acrePointsDataRefetch } =
useAcrePointsData()
const { refetch: userPointsDataRefetch } = useUserPointsData()
@@ -49,73 +38,14 @@ function NextDropTimestampLabel() {
)
}
-function ClaimableBalanceLabel() {
- const { mutate: claimPoints } = useClaimPoints()
- const { data: userPointsData } = useUserPointsData()
- const debouncedClaimPoints = useDebounce(claimPoints, ONE_SEC_IN_MILLISECONDS)
-
- const claimableBalance = userPointsData?.claimableBalance || 0
- const formattedClaimablePointsAmount = numberToLocaleString(claimableBalance)
-
- if (claimableBalance <= 0) return null
-
- return (
-
- )
-}
-
-function CalculationInProgressLabel() {
- const { data } = useUserPointsData()
-
- return (
-
- {!data?.claimableBalance && (
- Please wait...
- )}
-
-
- Your drop is being prepared.
-
-
-
- )
-}
-
export default function AcrePointsLabel() {
const { data } = useAcrePointsData()
- const { isConnected } = useWallet()
-
- if (!isConnected) return
- if (data?.isCalculationInProgress)
- return (
- <>
-
-
- >
- )
+ if (!data) return null
return (
- <>
+
-
- >
+
)
}
diff --git a/dapp/src/pages/DashboardPage/AcrePointsCard/LabelWrapper.tsx b/dapp/src/pages/DashboardPage/AcrePointsCard/LabelWrapper.tsx
new file mode 100644
index 000000000..77ea4c33d
--- /dev/null
+++ b/dapp/src/pages/DashboardPage/AcrePointsCard/LabelWrapper.tsx
@@ -0,0 +1,10 @@
+import React, { ReactNode } from "react"
+import { VStack } from "@chakra-ui/react"
+
+export default function LabelWrapper({ children }: { children: ReactNode }) {
+ return (
+
+ {children}
+
+ )
+}
diff --git a/dapp/src/pages/DashboardPage/AcrePointsCard/UserPointsLabel.tsx b/dapp/src/pages/DashboardPage/AcrePointsCard/UserPointsLabel.tsx
new file mode 100644
index 000000000..edae95326
--- /dev/null
+++ b/dapp/src/pages/DashboardPage/AcrePointsCard/UserPointsLabel.tsx
@@ -0,0 +1,88 @@
+import React from "react"
+import { TextMd } from "#/components/shared/Typography"
+import { Button, HStack, VStack } from "@chakra-ui/react"
+import { numberToLocaleString } from "#/utils"
+import { useAcrePointsData, useClaimPoints, useUserPointsData } from "#/hooks"
+import Spinner from "#/components/shared/Spinner"
+import TooltipIcon from "#/components/shared/TooltipIcon"
+import useDebounce from "#/hooks/useDebounce"
+import { ONE_SEC_IN_MILLISECONDS } from "#/constants"
+import LabelWrapper from "./LabelWrapper"
+import { NextDropTimestampLabel } from "./AcrePointsLabel"
+
+// TODO: Update `Button` component theme
+const COLOR_BUTTON_LABEL = "#FBF7EC"
+const COLOR_BUTTON_BACKGROUND = "#33A321"
+
+function ClaimableBalanceLabel() {
+ const { mutate: claimPoints } = useClaimPoints()
+ const { data: userPointsData } = useUserPointsData()
+ const debouncedClaimPoints = useDebounce(claimPoints, ONE_SEC_IN_MILLISECONDS)
+
+ const claimableBalance = userPointsData?.claimableBalance || 0
+ const formattedClaimablePointsAmount = numberToLocaleString(claimableBalance)
+
+ if (claimableBalance <= 0) return null
+
+ return (
+
+ )
+}
+
+function CalculationInProgressLabel() {
+ const { data } = useUserPointsData()
+
+ return (
+
+ {!data?.claimableBalance && (
+ Please wait...
+ )}
+
+
+ Your drop is being prepared.
+
+
+
+ )
+}
+
+export default function UserPointsLabel() {
+ const { data: acrePointsData } = useAcrePointsData()
+ const { data: userPointsData } = useUserPointsData()
+
+ if (acrePointsData || userPointsData?.isEligible) {
+ if (acrePointsData?.isCalculationInProgress)
+ return (
+
+
+
+
+ )
+
+ return (
+
+
+
+
+ )
+ }
+
+ return null
+}
diff --git a/dapp/src/pages/DashboardPage/AcrePointsCard/index.tsx b/dapp/src/pages/DashboardPage/AcrePointsCard/index.tsx
index 59583ded2..4e41ed8b3 100644
--- a/dapp/src/pages/DashboardPage/AcrePointsCard/index.tsx
+++ b/dapp/src/pages/DashboardPage/AcrePointsCard/index.tsx
@@ -7,7 +7,6 @@ import {
CardProps,
HStack,
Image,
- VStack,
} from "@chakra-ui/react"
import { numberToLocaleString } from "#/utils"
import { useAcrePointsData, useUserPointsData, useWallet } from "#/hooks"
@@ -15,6 +14,7 @@ import UserDataSkeleton from "#/components/shared/UserDataSkeleton"
import TooltipIcon from "#/components/shared/TooltipIcon"
import acrePointsIllustrationSrc from "#/assets/images/acre-points-illustration.png"
import AcrePointsLabel from "./AcrePointsLabel"
+import UserPointsLabel from "./UserPointsLabel"
export default function AcrePointsCard(props: CardProps) {
const { data: acrePointsData } = useAcrePointsData()
@@ -57,9 +57,7 @@ export default function AcrePointsCard(props: CardProps) {
-
-
-
+ {isConnected ? : }