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

refactor: disable manage allocations button #432

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion src/app/collective-rewards/leaderboard/BuilderLeaderBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,32 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/component
import { HeaderTitle } from '@/components/Typography'
import { BuildersLeaderBoardContent } from '@/app/collective-rewards/leaderboard'
import { useRouter } from 'next/navigation'
import { useContext } from 'react'
import { AllocationsContext } from '@/app/collective-rewards/allocations/context'

export const BuildersLeaderBoard = () => {
const {
state: { selections, allocations },
} = useContext(AllocationsContext)
const router = useRouter()
const onManageAllocations = () => {
router.push('/collective-rewards/allocations')
}

const isSelectionsEmpty = Object.values(selections).every(value => !value)
const isAllocationsEmpty = !Object.keys(allocations).length

return (
<>
<Collapsible defaultOpen>
<CollapsibleTrigger>
<div className="flex items-center justify-between w-full">
<HeaderTitle className="">Rewards leaderboard</HeaderTitle>
<Button variant="primary" onClick={onManageAllocations}>
<Button
variant="primary"
onClick={onManageAllocations}
disabled={isSelectionsEmpty && isAllocationsEmpty}
>
Manage Allocations
</Button>
</div>
Expand Down