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

Alex ui1 #208

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
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
21 changes: 11 additions & 10 deletions src/components/AdvancedFarmComponents/Deposit/DepositStart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ const DepositStart = ({
const { fetchUserPoolStats, userStats } = usePools()
const { getPortalsApproval, portalsApprove, getPortals } = usePortals()

const chainId = token.chain || token.data.chain
let pickedDefaultToken
if (pickedToken.symbol !== 'Select Token' && defaultToken) {
pickedDefaultToken = pickedToken.address.toLowerCase() === defaultToken.address.toLowerCase()
}

const chainId = token.chain || token.data.chain
const amount = toWei(inputAmount, pickedToken.decimals)

const toToken = token.vaultAddress || token.tokenAddress

const [slippagePercentage, setSlippagePercentage] = useState(null)
Expand Down Expand Up @@ -155,8 +158,6 @@ const DepositStart = ({
}

const startDeposit = async () => {
const pickedDefaultToken =
pickedToken.address.toLowerCase() === defaultToken.address.toLowerCase()
if (progressStep === 0) {
setStartSpinner(true)
setProgressStep(1)
Expand Down Expand Up @@ -401,7 +402,7 @@ const DepositStart = ({
)}
</NewLabel>
<NewLabel weight="600" textAlign="right" display="flex" flexFlow="column">
{progressStep === 4 ? (
{!pickedDefaultToken && progressStep === 4 ? (
receiveAmount !== '' ? (
receiveAmount
) : (
Expand All @@ -419,16 +420,16 @@ const DepositStart = ({
<NewLabel display="flex" flexFlow="column" weight="600" textAlign="right">
<span>{useIFARM ? `i${tokenSymbol}` : `f${tokenSymbol}`}</span>
<span>
{progressStep === 4 ? (
{!pickedDefaultToken && progressStep === 4 ? (
receiveUsd !== '' ? (
<>≈ ${receiveUsd}</>
<>≈${receiveUsd}</>
) : (
<>≈ $0</>
<>≈$0</>
)
) : minReceiveUsdAmount !== '' ? (
<>≈ ${minReceiveUsdAmount}</>
<>≈${minReceiveUsdAmount}</>
) : (
<>≈ $0</>
<>≈$0</>
)}
</span>
</NewLabel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ const WithdrawStart = ({

const { getPortalsApproval, portalsApprove, getPortals } = usePortals()

let pickedDefaultToken
if (pickedToken.symbol !== 'Select' && defaultToken) {
pickedDefaultToken = pickedToken.address.toLowerCase() === defaultToken.address.toLowerCase()
}
const SlippageValues = [null, 0.1, 0.5, 1, 5]
const onInputSlippage = e => {
let inputValue = e.target.value
Expand Down Expand Up @@ -118,8 +122,6 @@ const WithdrawStart = ({
}

const startWithdraw = async () => {
const pickedDefaultToken =
pickedToken.address.toLowerCase() === defaultToken.address.toLowerCase()
if (progressStep === 0) {
setStartSpinner(true)
setProgressStep(1)
Expand Down Expand Up @@ -371,7 +373,7 @@ const WithdrawStart = ({
</NewLabel>
<NewLabel display="flex" flexFlow="column" weight="600" textAlign="right">
<>
{progressStep === 4 ? (
{!pickedDefaultToken && progressStep === 4 ? (
revertedAmount !== '' ? (
revertedAmount
) : (
Expand All @@ -397,7 +399,7 @@ const WithdrawStart = ({
) : (
<AnimatedDots />
)} */}
{progressStep === 4 ? (
{!pickedDefaultToken && progressStep === 4 ? (
revertedAmountUsd === 'NaN' || revertedAmountUsd === '' ? (
'-'
) : revertedAmountUsd !== '' ? (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/AdvancedFarm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,18 @@ const AdvancedFarm = () => {
]

// Show vault info badge when platform is 'Lodestar' and firstly view
const firstView = localStorage.getItem('firstView')
useEffect(() => {
const platform = useIFARM ? 'Harvest' : token.platform[0].toLowerCase()
if (platform.includes('lodestar')) {
setVaultInfoMessage(true)
}

const firstView = localStorage.getItem('firstView')
if (firstView === null || firstView === 'true') {
localStorage.setItem('firstView', true)
setFirstViewInfo(true)
}
}, [token.platform, firstView, useIFARM])
}, [token.platform, useIFARM])

const closeBadge = () => {
setVaultInfoMessage(false)
Expand Down
Loading