diff --git a/projects/dex-ui/src/components/Well/OtherSection.tsx b/projects/dex-ui/src/components/Well/OtherSection.tsx index 21e6e67655..86c3ab6b23 100644 --- a/projects/dex-ui/src/components/Well/OtherSection.tsx +++ b/projects/dex-ui/src/components/Well/OtherSection.tsx @@ -7,19 +7,20 @@ import { size } from "src/breakpoints"; import { displayTokenSymbol } from "src/utils/format"; import { Token } from "@beanstalk/sdk"; import { Skeleton } from "../Skeleton"; -import { useWellImplementations } from "src/wells/useWellImplementations"; import { useWhitelistedWellComponents } from "../Create/useWhitelistedWellComponents"; +import { useWellImplementations } from "src/wells/useWellImplementations"; type Props = { well: Well }; const OtherSectionContent: FC = ({ well }) => { const { data: implementations } = useWellImplementations(); - const [items, setItems] = useState<{ name: string; address: string }[]>([]); - const [wellFunctionName, setWellFunctionName] = useState(""); const { lookup: { pump: pumpLookup } } = useWhitelistedWellComponents(); + const [items, setItems] = useState<{ name: string; address: string }[]>([]); + const [wellFunctionName, setWellFunctionName] = useState(""); + const implementationAddress = implementations?.[well.address]; const wellTokenDetail = well.tokens @@ -38,10 +39,10 @@ const OtherSectionContent: FC = ({ well }) => { useEffect(() => { const data: typeof items = []; - well.pumps?.forEach((pump) => { - if (pump.address.toLowerCase() in pumpLookup) { - const pumpInfo = pumpLookup[pump.address.toLowerCase()].component; + const pumpAddress = pump.address.toLowerCase(); + if (pumpAddress in pumpLookup) { + const pumpInfo = pumpLookup[pumpAddress].component; data.push({ name: pumpInfo?.fullName || pumpInfo.name, address: pump.address @@ -53,24 +54,19 @@ const OtherSectionContent: FC = ({ well }) => { }); } }); - data.push({ name: wellFunctionName ?? "Well Function", address: well.wellFunction?.address || "--" }); - data.push({ name: "Well Implementation", address: implementationAddress || "--" }); - data.push({ name: "Aquifer", address: well.aquifer?.address || "--" }); - console.log("items: ", data); - setItems(data); }, [ implementationAddress, diff --git a/projects/dex-ui/src/components/Well/Table/WellDetailRow.tsx b/projects/dex-ui/src/components/Well/Table/WellDetailRow.tsx index 75df2cde10..eb2e73a7d2 100644 --- a/projects/dex-ui/src/components/Well/Table/WellDetailRow.tsx +++ b/projects/dex-ui/src/components/Well/Table/WellDetailRow.tsx @@ -66,7 +66,7 @@ export const WellDetailRow: FC<{ ${liquidity ? liquidity.toHuman("short") : "-.--"} - ${price ? price.toHuman("short") : "-.--"} + ${price && price.gt(0) ? price.toHuman("short") : "-.--"} ${volume ? volume.toHuman("short") : "-.--"} @@ -163,6 +163,13 @@ const DesktopContainer = styled(Td)` display: none; } } + + :nth-child(3) { + @media (max-width: ${size.tablet}) { + display: none; + } + } + @media (max-width: ${size.mobile}) { display: none; } @@ -215,7 +222,7 @@ const Amount = styled.div` const Reserves = styled.div` display: flex; flex-direction: row; - justify-content flex-end; + justify-content: flex-end; align-items: center; gap: 4px; flex: 1; diff --git a/projects/dex-ui/src/components/Well/WellYieldWithTooltip.tsx b/projects/dex-ui/src/components/Well/WellYieldWithTooltip.tsx index 762ef78f49..d57e24c9b3 100644 --- a/projects/dex-ui/src/components/Well/WellYieldWithTooltip.tsx +++ b/projects/dex-ui/src/components/Well/WellYieldWithTooltip.tsx @@ -17,9 +17,14 @@ type Props = { apy?: TokenValue; loading?: boolean; tooltipProps?: Partial>; + returnNullOnNoAPY?: boolean; }; -export const WellYieldWithTooltip: React.FC = ({ tooltipProps, well }) => { +export const WellYieldWithTooltip: React.FC = ({ + tooltipProps, + well, + returnNullOnNoAPY = false, +}) => { const sdk = useSdk(); const bean = sdk.tokens.BEAN; @@ -37,6 +42,7 @@ export const WellYieldWithTooltip: React.FC = ({ tooltipProps, well }) => const tooltipWidth = isMobile ? 250 : 360; if (!apy) { + if (returnNullOnNoAPY) return null; return <>{"-"}; } diff --git a/projects/dex-ui/src/pages/Well.tsx b/projects/dex-ui/src/pages/Well.tsx index 4f6e48d073..00adf42ed5 100644 --- a/projects/dex-ui/src/pages/Well.tsx +++ b/projects/dex-ui/src/pages/Well.tsx @@ -66,7 +66,7 @@ export const Well = () => { } if (well.wellFunction) { - const _wellName = await well.wellFunction.contract.name(); + const _wellName = await well.wellFunction.getName(); setWellFunctionName(_wellName); } }; @@ -75,7 +75,9 @@ export const Well = () => { }, [sdk, well]); const title = (well?.tokens ?? []).map((t) => t.symbol).join("/"); - const logos: ReactNode[] = (well?.tokens || []).map((token) => ); + const logos: ReactNode[] = (well?.tokens || []).map((token) => ( + + )); const reserves = (well?.reserves ?? []).map((amount, i) => { const token = well!.tokens![i]; @@ -88,10 +90,16 @@ export const Well = () => { percentage: TokenValue.ZERO }; }); - const totalUSD = reserves.reduce((total, r) => total.add(r.dollarAmount ?? TokenValue.ZERO), TokenValue.ZERO); + const totalUSD = reserves.reduce( + (total, r) => total.add(r.dollarAmount ?? TokenValue.ZERO), + TokenValue.ZERO + ); reserves.forEach((reserve) => { - reserve.percentage = reserve.dollarAmount && totalUSD.gt(TokenValue.ZERO) ? reserve.dollarAmount.div(totalUSD) : TokenValue.ZERO; + reserve.percentage = + reserve.dollarAmount && totalUSD.gt(TokenValue.ZERO) + ? reserve.dollarAmount.div(totalUSD) + : TokenValue.ZERO; }); const twaReserves = useMemo(() => getTWAReservesWithWell(well), [well, getTWAReservesWithWell]); @@ -99,7 +107,9 @@ export const Well = () => { const goLiquidity = () => navigate(`./liquidity`); const goSwap = () => - well && well.tokens ? navigate(`../swap?fromToken=${well.tokens[0].symbol}&toToken=${well.tokens[1].symbol}`) : null; + well && well.tokens + ? navigate(`../swap?fromToken=${well.tokens[0].symbol}&toToken=${well.tokens[1].symbol}`) + : null; // Code below detects if the component with the Add/Remove Liq + Swap buttons is sticky const [isSticky, setIsSticky] = useState(false); @@ -139,7 +149,12 @@ export const Well = () => { return ( - + {/* *Header @@ -160,6 +175,7 @@ export const Well = () => { offsetY: 0, side: "top" }} + returnNullOnNoAPY={true} /> @@ -193,12 +209,26 @@ export const Well = () => { }> - showTab(e, 0)} active={tab === 0} stretch justify bold hover> + showTab(e, 0)} + active={tab === 0} + stretch + justify + bold + hover + > Activity - showTab(e, 1)} active={tab === 1} stretch justify bold hover> + showTab(e, 1)} + active={tab === 1} + stretch + justify + bold + hover + > Contract Addresses @@ -209,7 +239,14 @@ export const Well = () => { * Well History & Contract Info Tables */} - {tab === 0 && } + {tab === 0 && ( + + )} {tab === 1 && } diff --git a/projects/dex-ui/src/pages/Wells.tsx b/projects/dex-ui/src/pages/Wells.tsx index cec6f87728..f3b0ebb8f9 100644 --- a/projects/dex-ui/src/pages/Wells.tsx +++ b/projects/dex-ui/src/pages/Wells.tsx @@ -206,7 +206,7 @@ const MobileHeader = styled(Th)` const DesktopHeader = styled(Th)` :nth-child(1) { - width: 12em + width: 10em } :nth-child(2) { width: 12em @@ -214,6 +214,7 @@ const DesktopHeader = styled(Th)` :nth-child(3) { width: 12em } + :nth-child(5) { @media (max-width: ${size.desktop}) { display: none; @@ -224,6 +225,12 @@ const DesktopHeader = styled(Th)` display: none; } } + + :nth-child(3) { + @media (max-width: ${size.tablet}) { + display: none; + } + } @media (max-width: ${size.mobile}) { display: none; }