Skip to content

Commit 1149e9d

Browse files
committed
bug fix, smoother loading
1 parent 1f89bcf commit 1149e9d

File tree

7 files changed

+29
-17
lines changed

7 files changed

+29
-17
lines changed

frontend/src/components/GeyserFirst/GeyserStakeView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const GeyserStakeView = () => {
5353
vaultStats: { currentStakeable },
5454
} = useContext(StatsContext)
5555
const { connectWallet, ready } = useContext(Web3Context)
56+
5657
const currentStakeAmount = BigNumber.from(ready && currentLock ? currentLock.amount : '0')
5758
const [unstakeConfirmModalOpen, setUnstakeConfirmModalOpen] = useState<boolean>(false)
5859
const [actualRewardsFromUnstake, setActualRewardsFromUnstake] = useState<BigNumber>(BigNumber.from('0'))

frontend/src/components/GeyserFirst/UserBalance.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { BigNumber, BigNumberish } from 'ethers'
22
import styled from 'styled-components/macro'
33
import tw from 'twin.macro'
4-
import { formatAmount } from 'utils/amount'
4+
import { formatUnits } from 'ethers/lib/utils'
5+
import { formatTokenBalance } from 'utils/amount'
56

67
interface Props {
78
parsedAmount: BigNumber
@@ -22,7 +23,7 @@ export const UserBalance: React.FC<Props> = ({
2223
}) => {
2324
const formatDisplayAmount = (amt: BigNumberish, sym: string) => (
2425
<BalLink href={poolAddress} target="_blank" rel="noreferrer">
25-
{formatAmount(amt, decimals)} {sym}
26+
{formatTokenBalance(formatUnits(amt, decimals))} {sym}
2627
</BalLink>
2728
)
2829

frontend/src/components/Home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ const InfoText = styled.div`
163163
`
164164

165165
const LoaderContainer = styled.div`
166-
${tw`flex items-center justify-center w-full m-5`}
166+
${tw`m-auto my-4 flex flex-col flex-wrap w-full items-center justify-center`}
167167
`
168168

169169
export default Home

frontend/src/components/PageLoader.css

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
.GenericProgress-Container {
2-
background: #fff;
2+
position: fixed; /* Cover the entire viewport */
3+
top: 0;
4+
left: 0;
5+
width: 100%;
6+
height: 100%;
7+
background: rgba(255, 255, 255, 0.8); /* Transparent white background */
38
color: #000;
4-
text-align: center;
5-
margin: 75px auto;
9+
display: flex; /* Flexbox for loader placement */
10+
align-items: flex-start; /* Align loader to the top */
11+
justify-content: center; /* Center loader horizontally */
12+
padding-top: 250px; /* Add some space from the top */
13+
z-index: 9999; /* Ensure it is above all other elements */
614
}
715

816
.page-loader {
@@ -25,6 +33,7 @@
2533
.page-loader:after {
2634
scale: -1;
2735
}
36+
2837
@keyframes l10 {
2938
50% {
3039
clip-path: inset(0);

frontend/src/components/WelcomeHero.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const WelcomeHero = ({ tvl, totalRewards }) => {
5454
}
5555

5656
const CalloutBox = styled.div`
57-
${tw`justify-around flex flex-col`}
57+
${tw`justify-around flex flex-col w-full`}
5858
${tw`bg-black text-white p-8 rounded-lg text-md font-mono bg-opacity-90`}
5959
${tw`mb-10`}
6060
`
@@ -97,7 +97,7 @@ const Hr = styled.hr`
9797
${tw`border-t border-white w-full`}
9898
`
9999
const LoaderContainer = styled.div`
100-
${tw`flex items-center justify-center w-full m-5 mt-11 mb-10`}
100+
${tw`flex items-center justify-center w-full mt-11 mb-10`}
101101
`
102102

103103
export default WelcomeHero

frontend/src/components/WelcomeMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const WelcomeMessage = () => (
2929
)
3030

3131
const Container = styled.div`
32-
${tw`w-full max-w-4xl mx-auto my-8 px-4`}
32+
${tw`w-full my-8 px-4`}
3333
`
3434

3535
const Title = styled.h1`

frontend/src/context/VaultContext.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ export const VaultContextProvider: React.FC = ({ children }) => {
7979
useEffect(() => {
8080
if (address) {
8181
console.log('vault refresh')
82+
setVaults([])
83+
setSelectedVault(null)
84+
setCurrentLock(null)
8285
getVaults({ variables: { id: address.toLowerCase() } })
8386
}
84-
}, [networkId, address, getVaults])
87+
}, [ready, networkId, address, getVaults])
8588

8689
useEffect(() => {
87-
if (ready && !!vaultData && !!vaultData.user) {
90+
if (ready && vaultData?.user) {
8891
const userVaults = vaultData.user.vaults as Vault[]
8992
setVaults(userVaults)
9093
if (userVaults.length > 0 && !selectedVault) {
@@ -95,19 +98,17 @@ export const VaultContextProvider: React.FC = ({ children }) => {
9598
setSelectedVault(null)
9699
}
97100
}
98-
if (!ready) {
99-
setVaults([])
100-
setSelectedVault(null)
101-
}
102101
}, [vaultData, selectedVault])
103102

104103
useEffect(() => {
105-
if (selectedVault && selectedGeyser) {
104+
if (address && selectedVault && selectedGeyser) {
106105
const { stakingToken } = selectedGeyser
107106
const lockId = `${selectedVault.id}-${selectedGeyser.id}-${stakingToken}`
108107
setCurrentLock(selectedVault.locks.find((lock) => lock.id === lockId) || null)
108+
} else {
109+
setCurrentLock(null)
109110
}
110-
}, [selectedVault, selectedGeyser])
111+
}, [address, selectedVault, selectedGeyser])
111112

112113
return (
113114
<VaultContext.Provider

0 commit comments

Comments
 (0)