Skip to content

Commit 9ceb18e

Browse files
committed
fix: added better fallback
1 parent 74d5010 commit 9ceb18e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/components/Warnings/CooldownWarning.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Stake } from '@aave/contract-helpers';
12
import { Trans } from '@lingui/macro';
23
import { Typography } from '@mui/material';
34
import { useRootStore } from 'src/store/root';
@@ -7,10 +8,22 @@ import { Link } from '../primitives/Link';
78
import { Warning } from '../primitives/Warning';
89
import { SecondsToString } from '../SecondsToString';
910

10-
const TWENTY_DAYS = 7 * 24 * 60 * 60; // 7 days
11+
const SEVEN_DAYS = 7 * 24 * 60 * 60;
12+
const TWENTY_DAYS = 20 * 24 * 60 * 60;
1113

12-
export const CooldownWarning = ({ cooldownSeconds }: { cooldownSeconds?: number }) => {
13-
const cooldownTime = cooldownSeconds || TWENTY_DAYS;
14+
export const CooldownWarning = ({
15+
cooldownSeconds,
16+
stakeAssetName,
17+
}: {
18+
cooldownSeconds?: number;
19+
stakeAssetName?: Stake;
20+
}) => {
21+
const fallbackCooldown = stakeAssetName
22+
? stakeAssetName === Stake.aave
23+
? SEVEN_DAYS
24+
: TWENTY_DAYS
25+
: TWENTY_DAYS;
26+
const cooldownTime = cooldownSeconds || fallbackCooldown;
1427

1528
const trackEvent = useRootStore((store) => store.trackEvent);
1629
return (

0 commit comments

Comments
 (0)