Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
noahlitvin committed Sep 16, 2022
1 parent ec0e419 commit 0ce3004
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions frontend/components/Home/UserGrants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ import { eventsState, fetchEvents } from '../../../lib/store/events'
import { useAccount } from 'wagmi'

export default function UserGrants() {
const { data } = useAccount()
const { address } = useAccount()

const [grants, setGrant] = useRecoilState(getGrantsByUser(data?.address));
const [grants, setGrant] = useRecoilState(getGrantsByUser(address));
const [events, setEvents] = useRecoilState(eventsState);
const [loadingData, setLoadingData] = useState(true);

useEffect(() => {
if (data) {
Promise.all([fetchEvents(setEvents), fetchGrantsByUser(setGrant, data.address)]).finally(() => {
if (address) {
Promise.all([fetchEvents(setEvents), fetchGrantsByUser(setGrant, address)]).finally(() => {
setLoadingData(false)
})
}
}, [data])
}, [address])

const makeGrantElement = (grant, ind) => {
return (<Box key={ind} mb={12}>
Expand All @@ -47,7 +47,7 @@ export default function UserGrants() {

const numNonZeroAvailable = grants.length ? grants.filter(g => g.amountAvailable.gt(0)).length : 0;

return loadingData ? (data ? <Spinner d="block" mx="auto" my={6} /> : <Text textAlign="center" py={16} fontWeight="thin" fontSize="2xl" letterSpacing={1.5}>Connect a wallet to view grants</Text>) :
return loadingData ? (address ? <Spinner d="block" mx="auto" my={6} /> : <Text textAlign="center" py={16} fontWeight="thin" fontSize="2xl" letterSpacing={1.5}>Connect a wallet to view grants</Text>) :
(grants.length ? <div>
{numNonZeroAvailable > 1 ? <RedeemAll /> : ""}
{[...grants].reverse().map(makeGrantElement)}
Expand Down
4 changes: 2 additions & 2 deletions frontend/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import UserGrants from '../components/Home/UserGrants'
import { useAccount } from 'wagmi'

export default function Home() {
const { isSuccess } = useAccount()
const { address } = useAccount()

return (
<div>
<main>
{isSuccess ? (
{address ? (
<UserGrants />
) : (
<Text textAlign="center" py={16} fontWeight="thin" fontSize="3xl" letterSpacing={1.5}>Connect your wallet to view your grants and redeem available tokens.</Text>
Expand Down

1 comment on commit 0ce3004

@vercel
Copy link

@vercel vercel bot commented on 0ce3004 Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.