Skip to content

Commit

Permalink
refactor: remove de-activated builders
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscotobar committed Dec 9, 2024
1 parent b2424d3 commit fbd30ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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' },
Expand All @@ -40,7 +41,7 @@ export const ActiveBuildersContent = () => {

return (
<>
<SearchContextProvider builders={builders} filterFunction={filterFunction}>
<SearchContextProvider builders={filteredBuilders} filterFunction={filterFunction}>
<Search status={status} />
{withSpinner(ActiveBuildersGrid)({ isLoading })}
</SearchContextProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const BuilderNameCell: FC<BuilderCellProps> = ({
<TableCell className={cn(className, 'border-solid')}>
<div className="flex flex-row gap-x-1 items-center">
<BuilderStatusFlag stateFlags={stateFlags} />
<Jdenticon className="rounded-md bg-white min-w-6" value={builderName} size="24" />
<Jdenticon className="rounded-md bg-white min-w-6" value={address} size="24" />
<div className="w-32">
<Popover
content={
Expand Down
5 changes: 4 additions & 1 deletion src/app/collective-rewards/utils/isBuilderOperational.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { BuilderStateFlags } from '../types'
import { Builder, BuilderStateFlags } from '../types'

export const isBuilderOperational = (stateFlags?: BuilderStateFlags) => {
return !!(stateFlags && stateFlags.communityApproved && stateFlags.kycApproved && !stateFlags.paused)
}

export const isBuilderDeactivated = ({ gauge, stateFlags }: Builder) =>
!!(gauge && stateFlags && !stateFlags.communityApproved)

export const isBuilderActive = (stateFlags?: BuilderStateFlags) => {
return !!(
stateFlags &&
Expand Down

0 comments on commit fbd30ff

Please sign in to comment.