Skip to content

Commit

Permalink
fix: make builder context global
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajpiar committed Nov 21, 2024
1 parent d48e977 commit 3858645
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { CycleContextProvider } from '@/app/collective-rewards/metrics'
import { BuilderRewardPercentage, useGetBuildersRewards } from '@/app/collective-rewards/rewards'
import { BuilderContextProviderWithPrices } from '@/app/collective-rewards/user'
import { useHandleErrors } from '@/app/collective-rewards/utils'
import { AddressOrAliasWithCopy } from '@/components/Address'
import { Button } from '@/components/Button'
Expand Down Expand Up @@ -397,11 +396,9 @@ export const BuildersLeaderBoard = () => {
</CollapsibleTrigger>
<CollapsibleContent>
<CycleContextProvider>
<BuilderContextProviderWithPrices>
<div className="pt-6">
<BuildersLeaderBoardTable />
</div>
</BuilderContextProviderWithPrices>
<div className="pt-6">
<BuildersLeaderBoardTable />
</div>
</CycleContextProvider>
</CollapsibleContent>
</Collapsible>
Expand Down
6 changes: 3 additions & 3 deletions src/app/collective-rewards/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import { BuildersLeaderBoard } from '@/app/collective-rewards/leaderboard'
import { Metrics } from '@/app/collective-rewards/metrics'
import { WhitelistContextProviderWithBuilders, WhitelistSection } from '@/app/collective-rewards/whitelist'
import { WhitelistContextProvider, WhitelistSection } from '@/app/collective-rewards/whitelist'
import { MainContainer } from '@/components/MainContainer/MainContainer'

export default function BuildersIncentiveMarket() {
return (
<MainContainer>
<div className="grid grid-rows-1 gap-[32px]">
<Metrics />
<WhitelistContextProviderWithBuilders>
<WhitelistContextProvider>
<WhitelistSection />
</WhitelistContextProviderWithBuilders>
</WhitelistContextProvider>
<BuildersLeaderBoard />
</div>
</MainContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,5 @@ export const BecomeABuilderHandler = ({ address }: { address: Address }) => {
}

export const BecomeABuilderButton = ({ address }: { address: Address }) => {
return (
<BuilderContextProvider>
<BecomeABuilderHandler address={address} />
</BuilderContextProvider>
)
return <BecomeABuilderHandler address={address} />
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface WhitelistProviderProps {
children: ReactNode
}

const WhitelistContextProvider: FC<WhitelistProviderProps> = ({ children }) => {
export const WhitelistContextProvider: FC<WhitelistProviderProps> = ({ children }) => {
const [search, setSearch] = useState('')
const [filterBy, setFilterBy] = useState<BuilderStatusFilter>(initialFilterByValue)
const { data, isLoading, error } = useGetFilteredBuilders({ builderName: search, status: filterBy })
Expand Down
5 changes: 4 additions & 1 deletion src/app/providers/ContextProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { WagmiProvider } from 'wagmi'
import { AlertProvider } from './AlertProvider'
import ErrorBoundary from '@/components/ErrorPage/ErrorBoundary'
import { AllocationsContextProvider } from '../collective-rewards/allocations'
import { BuilderContextProviderWithPrices } from '../collective-rewards/user'

interface Props {
children: ReactNode
Expand All @@ -18,7 +19,9 @@ export const ContextProviders = ({ children }: Props) => {
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<AlertProvider>
<AllocationsContextProvider>{children}</AllocationsContextProvider>
<BuilderContextProviderWithPrices>
<AllocationsContextProvider>{children}</AllocationsContextProvider>
</BuilderContextProviderWithPrices>
</AlertProvider>
</QueryClientProvider>
</WagmiProvider>
Expand Down

0 comments on commit 3858645

Please sign in to comment.