Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bean UI - Show how much Grown Stalk will be Mown in Migration UI #652

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion projects/ui/src/components/Silo/Actions/Migrate.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useCallback, useState } from 'react';
import {
Accordion,
Alert,
AccordionDetails,
AccordionSummary,
Box,
Expand All @@ -13,7 +14,6 @@ import { LoadingButton } from '@mui/lab';
import { FC } from '~/types';
import Row from '~/components/Common/Row';
import Deposits from '~/components/Silo/Actions/Deposits';

import useAccount from '~/hooks/ledger/useAccount';
import useFarmerSiloBalances from '~/hooks/farmer/useFarmerSiloBalances';
import useSdk, { getNewToOldToken } from '~/hooks/sdk';
Expand All @@ -22,6 +22,7 @@ import { BeanstalkPalette, IconSize } from '~/components/App/muiTheme';
import { displayFullBN } from '~/util';
import { fetchMigrationData } from '~/state/farmer/silo/updater';
import TransactionToast from '~/components/Common/TxnToast';
import useFarmerSilo from '~/hooks/farmer/useFarmerSilo';

const getMigrationParams = async (account: string) => {
const data = await fetchMigrationData(account);
Expand Down Expand Up @@ -53,6 +54,7 @@ const getMigrationParams = async (account: string) => {
export const Migrate: FC<{}> = () => {
const account = useAccount();
const siloBalance = useFarmerSiloBalances();
const farmerSilo = useFarmerSilo();
const sdk = useSdk();

const [migrating, setMigrating] = useState(false);
Expand Down Expand Up @@ -198,6 +200,16 @@ export const Migrate: FC<{}> = () => {
All of your Grown Stalk will be Mown and added to your
Stalk balance during the Migration.
</Typography>
{farmerSilo.stalk.grown.gt(0) &&
<Alert
variant="outlined"
severity="success"
icon={<></>}
sx={{ textAlign: 'left', background: 'white' }}
>
{`${displayFullBN(farmerSilo.stalk.grown)} Grown Stalk will be Mown.`}
</Alert>
}
</Stack>
<Stack spacing={1}>
<Typography variant="h4">
Expand Down