From 7037b47977c249c9865f9212d943d3d9934f37e7 Mon Sep 17 00:00:00 2001 From: Francisco Tobar Date: Wed, 4 Dec 2024 21:17:07 -0600 Subject: [PATCH] refactor: remove de-activated builders --- .../active-builders/ActiveBuildersContent.tsx | 5 +++-- .../shared/components/Table/TableCells.tsx | 2 +- src/app/collective-rewards/utils/isBuilderOperational.ts | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/collective-rewards/active-builders/ActiveBuildersContent.tsx b/src/app/collective-rewards/active-builders/ActiveBuildersContent.tsx index 0f3049ca..730aa2a6 100644 --- a/src/app/collective-rewards/active-builders/ActiveBuildersContent.tsx +++ b/src/app/collective-rewards/active-builders/ActiveBuildersContent.tsx @@ -1,6 +1,6 @@ import { SearchContextProvider } from '@/app/collective-rewards/shared' import { withSpinner } from '@/components/LoadingSpinner/withLoadingSpinner' -import { useHandleErrors } from '@/app/collective-rewards/utils' +import { isBuilderDeactivated, useHandleErrors } from '@/app/collective-rewards/utils' import { useGetBuildersByState } from '@/app/collective-rewards/user/' import { ActiveBuildersGrid } from '@/app/collective-rewards/active-builders' import { Search } from '@/app/collective-rewards/shared' @@ -31,6 +31,7 @@ export const ActiveBuildersContent = () => { true, ) useHandleErrors({ error, title: 'Error loading builders' }) + const filteredBuilders = builders.filter(isBuilderDeactivated) const status = [ { label: 'All', value: 'all' }, @@ -40,7 +41,7 @@ export const ActiveBuildersContent = () => { return ( <> - + {withSpinner(ActiveBuildersGrid)({ isLoading })} diff --git a/src/app/collective-rewards/shared/components/Table/TableCells.tsx b/src/app/collective-rewards/shared/components/Table/TableCells.tsx index 9f1c90e6..775cecdc 100644 --- a/src/app/collective-rewards/shared/components/Table/TableCells.tsx +++ b/src/app/collective-rewards/shared/components/Table/TableCells.tsx @@ -102,7 +102,7 @@ export const BuilderNameCell: FC = ({
- +
{ return !!(stateFlags && stateFlags.communityApproved && stateFlags.kycApproved && !stateFlags.paused) } +export const isBuilderDeactivated = ({ gauge, stateFlags }: Builder) => + !(gauge && stateFlags && stateFlags.activated && !stateFlags.communityApproved) + export const isBuilderActive = (stateFlags?: BuilderStateFlags) => { return !!( stateFlags &&