forked from the-standard/decentralised-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from the-standard/202501-redemption-alert
202501 redemption alert
- Loading branch information
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { useState, useEffect } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { | ||
ArrowTrendingUpIcon | ||
} from '@heroicons/react/24/outline'; | ||
import axios from "axios"; | ||
|
||
import Card from "../ui/Card"; | ||
import Typography from "../ui/Typography"; | ||
|
||
const VaultRedemptionAlert = ({ | ||
vaultId, | ||
}) => { | ||
const [redemption, setRedemption] = useState(); | ||
|
||
useEffect(() => { | ||
getUpcomingRedemption(); | ||
}, []); | ||
|
||
const getUpcomingRedemption = async () => { | ||
try { | ||
const response = await axios.get( | ||
`https://smart-vault-api.thestandard.io/redemption` | ||
); | ||
const data = response.data; | ||
setRedemption(data); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
}; | ||
|
||
if (redemption) { | ||
if (vaultId === redemption?.tokenID) { | ||
return ( | ||
<> | ||
<Card className="card-compact mb-4 warn-card"> | ||
<div className="card-body"> | ||
<Typography variant="h2" className="card-title flex gap-0"> | ||
<ArrowTrendingUpIcon | ||
className="mr-2 h-6 w-6 inline-block" | ||
/> | ||
Upcoming Auto Redemption | ||
</Typography> | ||
<Typography variant="p"> | ||
Your vault is currently the most borrowed against, and may automatically use a portion of your collateral to pay off your debt at a discount if USDs trades below $1. | ||
<br/> | ||
If you want to avoid the auto redemption you should repay some of your debt now. | ||
</Typography> | ||
</div> | ||
</Card> | ||
</> | ||
) | ||
} | ||
} | ||
|
||
return (<></>) | ||
}; | ||
|
||
export default VaultRedemptionAlert; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters