Skip to content

Commit

Permalink
Bean UI - Misc fixes (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
hellofromguy authored Nov 22, 2023
2 parents fa4448d + 5e5ec86 commit f2434fb
Show file tree
Hide file tree
Showing 62 changed files with 382 additions and 162 deletions.
2 changes: 1 addition & 1 deletion projects/sdk/src/constants/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export enum ActionType {

/// FIELD
BUY_BEANS,
BURN_BEANS,
SOW_BEANS,
RECEIVE_PODS,
HARVEST,
RECEIVE_BEANS,
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Bean/Crosses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const getValue = (season: SnapshotData<SeasonalCrossesQuery>) => season.crosses;
const formatValue = (value: number) => `${value}`;
const statProps = {
title: 'Peg Crosses',
titleTooltip: 'The number of times Bean has crossed its peg. Does not include peg crosses due to ETH price movement.',
titleTooltip: 'The total number of times Bean has crossed its peg at the beginning of every Season.',
gap: 0.25,
sx: { ml: 0 },
};
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Bean/DeltaB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const formatValue = (value: number) =>
`${value.toLocaleString('en-us', { maximumFractionDigits: 2 })}`;
const statProps = {
title: 'deltaB',
titleTooltip: 'The liquidity and time weighted average shortage of Beans in liquidity pools on the Oracle Whitelist at the end of every Season.',
titleTooltip: 'The liquidity and time weighted average shortage of Beans in liquidity pools on the Oracle Whitelist at the beginning of every Season.',
gap: 0.25,
};

Expand Down
3 changes: 1 addition & 2 deletions projects/ui/src/components/Analytics/Bean/Liquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ const formatValue = (value: number) =>
`$${value.toLocaleString('en-US', { maximumFractionDigits: 0 })}`;
const statProps = {
title: 'Liquidity',
titleTooltip:
'The USD value of the tokens in the BEAN:3CRV and BEAN:ETH pools at the end of every Season.',
titleTooltip: 'The total USD value of tokens in liquidity pools on the Oracle Whitelist at the beginning of every Season.',
gap: 0.25,
};
const queryConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const getValue = (season: LiquiditySupplyRatioQuery['seasons'][number]) =>
const formatValue = (value: number) =>
`${value.toFixed(4)}%`;
const statProps = {
title: 'Liquidity:Supply Ratio',
title: 'Liquidity to Supply Ratio',
titleTooltip:
`The ratio of Beans in liquidity pools on the Oracle Whitelist per Bean, displayed as a percentage. The Liquidity:Supply Ratio is a useful indicator of Beanstalk's health.`,
`The ratio of Beans in liquidity pools on the Oracle Whitelist per Bean, displayed as a percentage, at the beginning of every Season. The Liquidity to Supply Ratio is a useful indicator of Beanstalk's health.`,
gap: 0.25,
};
const queryConfig = {
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Bean/MarketCap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const formatValue = (value: number) =>
const statProps = {
title: 'Market Cap',
titleTooltip:
'The USD value of the total Bean supply at the end of every Season.',
'The USD value of the Bean supply at the beginning of every Season.',
gap: 0.25,
};
const lineChartProps: Partial<LineChartProps> = {
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Bean/Price.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getValue = (season: Season) => parseFloat(season.price);
const formatValue = (value: number) => `$${value.toFixed(4)}`;
const statProps = {
title: 'Bean Price',
titleTooltip: 'The price at the end of every Season.',
titleTooltip: 'The USD price of 1 Bean at the beginning of every Season.',
gap: 0.25,
};
const lineChartProps: Partial<LineChartProps> = {
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Bean/Supply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const useStatProps = () => {
const isTiny = useMediaQuery(theme.breakpoints.down('md'));
return {
title: isTiny ? 'Supply' : 'Bean Supply',
titleTooltip: 'The total Bean supply at the end of every Season.',
titleTooltip: 'The total Bean supply at the beginning of every Season.',
gap: 0.25,
};
};
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Bean/Volume.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const formatValue = (value: number) =>
`$${value.toLocaleString('en-US', { maximumFractionDigits: 0 })}`;
const statProps = {
title: 'Volume',
titleTooltip: 'The total volume in the BEAN:3CRV and BEAN:ETH pools in every Season.',
titleTooltip: 'The total USD volume in liquidity pools on the Oracle Whitelist every Season.',
gap: 0.25,
};
const queryConfig = { context: { subgraph: 'bean' } };
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Bean/VolumeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const VolumeChart: FC<{ width?: number; height: number }> = ({
>
<ChartInfoOverlay
title="Volume"
titleTooltip="The total volume in the BEAN:3CRV and BEAN:ETH pools in every Season."
titleTooltip="The total USD volume in liquidity pools on the Oracle Whitelist every Season."
gap={0.25}
isLoading={queryData?.loading}
amount={formatValue(currentHoverBar?.count ?? 0)}
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Bean/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const BeanAnalytics: FC<{}> = () => {
<Tab label="Supply" />
<Tab label="Crosses" />
<Tab label="deltaB" />
<Tab label="Liquidity:Supply Ratio" />
<Tab label="L2SR" />
</Tabs>
{/*
TODO: The height prop currently *only* reflects in the chart height. However, the full component
Expand Down
4 changes: 2 additions & 2 deletions projects/ui/src/components/Analytics/Field/HarvestedPods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const getValue = (season: SnapshotData<SeasonalHarvestedPodsQuery>) =>
const formatValue = (value: number) =>
`${value.toLocaleString('en-US', { maximumFractionDigits: 0 })}`;
const StatProps = {
title: 'Harvested Pods',
titleTooltip: 'The total number of Pods Harvested at the end of each Season.',
title: 'Pods Harvested',
titleTooltip: 'The total number of Pods Harvested at the beginning of every Season.',
gap: 0.5,
};
const lineChartProps: Partial<LineChartProps> = {
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Field/PodRate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const formatValue = (value: number) => `${value.toFixed(2)}%`;
const statProps = {
title: 'Pod Rate',
titleTooltip:
'The ratio of outstanding Pods per Bean, displayed as a percentage. The Pod Rate is used by Beanstalk as a proxy for its health.',
'The ratio of Unharvestable Pods per Bean, displayed as a percentage, at the beginning of every Season. The Pod Rate is used by Beanstalk as a proxy for its health.',
gap: 0.25,
sx: { ml: 0 },
};
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Field/Pods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const formatValue = (value: number) =>
`${value.toLocaleString('en-US', { maximumFractionDigits: 0 })}`;
const statProps = {
title: 'Pods',
titleTooltip: 'The total number of Pods at the end of each Season.',
titleTooltip: 'The total number of Unharvestable Pods at the beginning of every Season.',
gap: 0.5,
};
const lineChartProps: Partial<LineChartProps> = {
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Field/RRoR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const formatValue = (value: number) => `${value.toFixed(2)}%`;
const statProps = {
title: 'Real Rate of Return',
titleTooltip:
'The return for Sowing Beans at the beginning of each Season, accounting for the Bean price. RRoR = (1 + Temperature) / TWAP.',
'The return for Sowing Beans at the beginning of every Season, accounting for the Bean price. RRoR = (1 + Temperature) / TWAP.',
gap: 0.5,
};
const lineChartProps: Partial<LineChartProps> = {
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Field/Sown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const formatValue = (value: number) =>
`${value.toLocaleString('en-US', { maximumFractionDigits: 0 })}`;
const statProps = {
title: 'Beans Sown',
titleTooltip: 'The total number of Beans Sown at the end of each Season.',
titleTooltip: 'The total number of Beans Sown at the beginning of every Season.',
gap: 0.25,
sx: { ml: 0 },
};
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Field/Temperature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getValue = (snapshot: SnapshotData<SeasonalTemperatureQuery>) =>
const formatValue = (value: number) => `${value.toFixed(0)}%`;
const statProps = {
title: 'Max Temperature',
titleTooltip: 'The maximum interest rate for Sowing Beans each Season.',
titleTooltip: 'The maximum interest rate for Sowing Beans every Season.',
gap: 0.5,
};
const lineChartProps: Partial<LineChartProps> = {
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Field/TotalSowers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const getValue = (season: SnapshotData<SeasonalTotalSowersQuery>) =>
const formatValue = (value: number) => `${value}`;
const statProps = {
title: 'Total Sowers',
titleTooltip: 'The total number of unique Sowers at the end of each Season.',
titleTooltip: 'The total number of unique Sowers at the beginning of every Season.',
gap: 0.25,
sx: { ml: 0 },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const DepositedAsset: FC<{
: asset.symbol === 'urBEAN'
? 'Unripe Beans'
: asset.name
} at the end of each Season.`,
} at the beginning of every Season.`,
gap: 0.5,
}),
[asset]
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Silo/Seeds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const formatValue = (value: number) =>
`${value.toLocaleString('en-US', { maximumFractionDigits: 0 })}`;
const statProps = {
title: 'Seeds',
titleTooltip: 'The total number of Seeds at the end of each Season.',
titleTooltip: 'The total number of Seeds at the beginning of every Season.',
gap: 0.5,
};
const queryConfig = {
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Analytics/Silo/Stalk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const formatValue = (value: number) =>
`${value.toLocaleString('en-US', { maximumFractionDigits: 0 })}`;
const statProps = {
title: 'Stalk',
titleTooltip: 'The total number of Stalk at the end of each Season.',
titleTooltip: 'The total number of Stalk at the beginning of every Season.',
gap: 0.5,
};
const queryConfig = {
Expand Down
4 changes: 3 additions & 1 deletion projects/ui/src/components/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export default function App() {
<Route path="/404" element={<PageNotFound />} />
<Route path="*" element={<PageNotFound />} />
</Routes>
{/*
<Box
sx={{
position: 'fixed',
Expand All @@ -220,7 +221,8 @@ export default function App() {
&middot; {sgEnvKey}
</Typography>
</Box>
</Box>
*/}
</Box>
</Box>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Balances/SiloBalances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ const SiloBalances: React.FC<{}> = () => {
<Typography color="text.primary" component="span">
{displayFullBN(
token.getSeeds(deposits?.bdv ?? ZERO_BN),
0
2
)}
</Typography>
</Row>
Expand Down
12 changes: 10 additions & 2 deletions projects/ui/src/components/Balances/SiloBalancesHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,21 @@ const SiloBalancesHistory: React.FC<{}> = () => {
};

return (
<Box sx={{ width: '100%', height: '380px', position: 'relative' }}>
<Box sx={{ width: '100%', height: '390px', position: 'relative' }}>
{account !== undefined ? (
<BaseSeasonPlot
queryData={queryData}
height={300}
StatProps={{
title: 'Total Deposited Value',
title: 'Value Deposited',
titleTooltip:
<>
The historical USD value of your Silo Deposits at the beginning of every Season. <br />
<Typography variant="bodySmall">
Note: Unripe assets are valued based on the current Chop Rate. Earned Beans are shown upon Plant.
</Typography>
</>
,
gap: 0.25,
}}
timeTabParams={timeTabParams}
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/components/Balances/TokenBalanceTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const TokenBalanceTable: React.FC<{
) : (
<Stack height="100%" alignItems="center" justifyContent="center" pb={2}>
<Typography color="text.tertiary">
{`You don't have any tokens in your ${pageName} Balance`}
{`You don't have any tokens in your ${pageName} Balance.`}
</Typography>
</Stack>
)}
Expand Down
36 changes: 30 additions & 6 deletions projects/ui/src/components/Barn/Actions/Buy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import useFarmerBalances from '~/hooks/farmer/useFarmerBalances';
import usePreferredToken, {
PreferredToken,
} from '~/hooks/farmer/usePreferredToken';
import { getTokenIndex, normaliseTV, tokenValueToBN } from '~/util';
import { displayTokenAmount, getTokenIndex, normaliseTV, tokenValueToBN } from '~/util';
import { useFetchFarmerAllowances } from '~/state/farmer/allowances/updater';
import { FarmerBalances } from '~/state/farmer/balances';
import FertilizerItem from '../FertilizerItem';
Expand Down Expand Up @@ -206,7 +206,7 @@ const BuyForm: FC<
balanceFrom={values.balanceFrom}
params={quoteProviderParams}
/>
<ClaimBeanDrawerToggle />
<ClaimBeanDrawerToggle actionText='Buy Fert with'/>
{/* Outputs */}
{fert?.gt(0) ? (
<>
Expand All @@ -229,10 +229,34 @@ const BuyForm: FC<
</Box>
<WarningAlert>
The amount of Fertilizer received is: <br />
{values.tokens[0].amount?.toFixed(2)}{' '}
{values.tokens[0].token.symbol}
{values.tokens[0].amount?.gt(0) && (
<>
{displayTokenAmount(
values.tokens[0].amount || BigNumber(0),
values.tokens[0].token,
{ showName: false, showSymbol: true }
)}
</>
)}{' '}
{values.claimableBeans.amount?.gt(0) && (
<>
{values.tokens[0].amount?.gt(0) && (<>+ </>)}
{displayTokenAmount(
values.claimableBeans.amount,
sdk.tokens.BEAN,
{ showName: false, showSymbol: true }
)}
</>
)}{' '}
{values.tokens[0].token.symbol !== 'WETH' && (
<>{values.tokens[0].amountOut?.toFixed(2)} WETH </>
<>
{' '}
{displayTokenAmount(
values.tokens[0].amountOut?.plus(values.claimableBeans.amountOut || BigNumber(0)) || BigNumber(0),
sdk.tokens.WETH,
{ showName: false, showSymbol: true }
)}
</>
)}{' '}
* ${ethPrice.toHuman('short')} = {fert.toFixed(0)} Fertilizer
</WarningAlert>
Expand Down Expand Up @@ -287,7 +311,7 @@ const BuyForm: FC<
Buy
</SmartSubmitButton>
</Stack>
<FormWithDrawer.Drawer title="Use Claimable Beans">
<FormWithDrawer.Drawer title="Buy Fert with Claimable Beans">
<ClaimBeanDrawerContent<BuyQuoteHandlerParams>
quoteProviderProps={{
tokenOut: token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ const BeanstalkBalances: FC<{
WHITELIST[address],
breakdown.tokens[address].amount
)}
amountTooltipLocation="right"
/>
))}
</Stack>
Expand Down
5 changes: 4 additions & 1 deletion projects/ui/src/components/Common/Balances/TokenRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const TokenRow: FC<{
amount?: string | JSX.Element;
/* Display a tooltip when hovering over the amount */
amountTooltip?: string | JSX.Element;
/* Override the default tooltip location */
amountTooltipLocation?: any;
/* The USD value of the amount of Token */
value?: string | JSX.Element;
/* Fade this row out when others are selected */
Expand All @@ -42,6 +44,7 @@ const TokenRow: FC<{
token,
amount,
amountTooltip,
amountTooltipLocation,
value,
isFaded = false,
isSelected = false,
Expand Down Expand Up @@ -90,7 +93,7 @@ const TokenRow: FC<{
</Tooltip>
)}
</Row>
<Tooltip title={amountTooltip || ''} placement="top-end">
<Tooltip title={amountTooltip || ''} placement={amountTooltipLocation || "top-end"}>
<div>
<Row gap={0.5}>
{token && <TokenIcon token={token} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ const defaultChartStyles: ChartMultiStyles = {
fillPrimary: chartColors.yellowLight,
strokeWidth: 2,
},
4: {
stroke: chartColors.blue,
fillPrimary: chartColors.blueLight,
strokeWidth: 2,
},
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ const sx = {
*/
const AddPlantTxnToggle: React.FC<{
plantAndDoX: PlantAndDoX | undefined;
}> = ({ plantAndDoX }) => {
actionText?: string;
}> = ({ plantAndDoX, actionText }) => {
/// Local State
const [open, show, hide] = useToggle();

Expand Down Expand Up @@ -123,10 +124,10 @@ const AddPlantTxnToggle: React.FC<{
/>
<Stack>
<Typography variant="h4" color="primary.main">
Use Earned Beans
{`${actionText || 'Use'} Earned Beans`}
</Typography>
<Typography variant="body1" color="text.tertiary">
Toggle to claim Earned Beans in your transaction
{`Toggle to ${actionText || 'Claim'} Earned Beans in this transaction.`}
</Typography>
</Stack>
</Row>
Expand All @@ -149,7 +150,7 @@ const AddPlantTxnToggle: React.FC<{
>
<Stack gap={1} p={1}>
<Typography variant="body1" color="text.tertiary">
You will Plant to claim these Silo rewards
You will claim these Silo rewards:
</Typography>
<Grid container spacing={1} direction="row">
{items.map((item, i) => (
Expand Down
Loading

0 comments on commit f2434fb

Please sign in to comment.