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

TOK-528/deactivated-builders #450

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
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
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(builder => !isBuilderDeactivated(builder))

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
2 changes: 1 addition & 1 deletion src/components/Table/tableDocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ const data = [
## Styling

- Use the `className` prop to apply custom styles to the table.
- The component provides a basic structure and styles. You can override or extend these styles as needed.
- The component provides a basic structure and styles. You can override or extend these styles as needed.
Loading