Skip to content

Commit

Permalink
Implement deposit limit when the TVL cap exceeds
Browse files Browse the repository at this point in the history
  • Loading branch information
kpyszkowski committed Nov 4, 2024
1 parent c40c4aa commit 329644f
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion dapp/src/pages/DashboardPage/PositionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
useAllActivitiesCount,
useBitcoinPosition,
useTransactionModal,
useTVL,
} from "#/hooks"
import { ACTION_FLOW_TYPES } from "#/types"
import {
Expand All @@ -18,6 +19,7 @@ import ArrivingSoonTooltip from "#/components/ArrivingSoonTooltip"
import UserDataSkeleton from "#/components/shared/UserDataSkeleton"
import { featureFlags } from "#/constants"
import { TextMd } from "#/components/shared/Typography"
import { BoltFilled } from "#/assets/icons"

const isWithdrawalFlowEnabled = featureFlags.WITHDRAWALS_ENABLED

Expand All @@ -39,6 +41,8 @@ export default function PositionDetails() {
const openWithdrawModal = useTransactionModal(ACTION_FLOW_TYPES.UNSTAKE)
const activitiesCount = useAllActivitiesCount()

const { isCapExceeded } = useTVL()

return (
<Flex w="100%" flexDirection="column" gap={5}>
<VStack alignItems="start" spacing={0}>
Expand Down Expand Up @@ -83,7 +87,11 @@ export default function PositionDetails() {

<HStack w="full" justify="start" flexWrap="wrap" spacing={2}>
<UserDataSkeleton>
<Button {...buttonStyles} onClick={openDepositModal}>
<Button
{...buttonStyles}
onClick={openDepositModal}
isDisabled={isCapExceeded}
>
{activitiesCount === 0 ? "Deposit" : "Deposit more"}
</Button>
</UserDataSkeleton>
Expand All @@ -99,6 +107,17 @@ export default function PositionDetails() {
</Button>
</ArrivingSoonTooltip>
</UserDataSkeleton>
{isCapExceeded && (
<HStack align="start" spacing={1} mt={3}>
<BoltFilled color="orange.400" my={1} />
<VStack align="start" spacing={0}>
<TextMd fontWeight="semibold">Deposit cap reached!</TextMd>
<TextMd color="grey.500">
Stay tuned for the next deposit cycle.
</TextMd>
</VStack>
</HStack>
)}
</HStack>
</Flex>
)
Expand Down

0 comments on commit 329644f

Please sign in to comment.