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

fix: Add proposers feature flag [SW-488] #4488

Merged
merged 1 commit into from
Nov 6, 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
43 changes: 24 additions & 19 deletions src/components/settings/ProposersList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import Track from '@/components/common/Track'
import UpsertProposer from '@/features/proposers/components/UpsertProposer'
import DeleteProposerDialog from '@/features/proposers/components/DeleteProposerDialog'
import EditProposerDialog from '@/features/proposers/components/EditProposerDialog'
import { useHasFeature } from '@/hooks/useChains'
import useProposers from '@/hooks/useProposers'
import AddIcon from '@/public/images/common/add.svg'
import { SETTINGS_EVENTS } from '@/services/analytics'
import { FEATURES } from '@/utils/chains'
import { Box, Button, Grid, Paper, SvgIcon, Typography } from '@mui/material'
import EthHashInfo from '@/components/common/EthHashInfo'
import ExternalLink from '@/components/common/ExternalLink'
Expand All @@ -33,6 +35,7 @@ const headCells = [
const ProposersList = () => {
const [isAddDialogOpen, setIsAddDialogOpen] = useState<boolean>()
const proposers = useProposers()
const isEnabled = useHasFeature(FEATURES.PROPOSERS)

const rows = useMemo(() => {
if (!proposers.data) return []
Expand Down Expand Up @@ -60,7 +63,7 @@ const ProposersList = () => {
actions: {
rawValue: '',
sticky: true,
content: (
content: isEnabled && (
<div className={tableCss.actions}>
<EditProposerDialog proposer={proposer} />
<DeleteProposerDialog proposer={proposer} />
Expand Down Expand Up @@ -95,24 +98,26 @@ const ProposersList = () => {
transactions first. <ExternalLink href={HelpCenterArticle.DELEGATES}>Learn more</ExternalLink>
</Typography>

<Box mb={2}>
<CheckWallet allowProposer={false}>
{(isOk) => (
<Track {...SETTINGS_EVENTS.PROPOSERS.ADD_PROPOSER}>
<Button
data-testid="add-proposer-btn"
onClick={onAdd}
variant="text"
startIcon={<SvgIcon component={AddIcon} inheritViewBox fontSize="small" />}
disabled={!isOk}
size="compact"
>
Add proposer
</Button>
</Track>
)}
</CheckWallet>
</Box>
{isEnabled && (
<Box mb={2}>
<CheckWallet allowProposer={false}>
{(isOk) => (
<Track {...SETTINGS_EVENTS.PROPOSERS.ADD_PROPOSER}>
<Button
data-testid="add-proposer-btn"
onClick={onAdd}
variant="text"
startIcon={<SvgIcon component={AddIcon} inheritViewBox fontSize="small" />}
disabled={!isOk}
size="compact"
>
Add proposer
</Button>
</Track>
)}
</CheckWallet>
</Box>
)}

{rows.length > 0 && <EnhancedTable rows={rows} headCells={headCells} />}
</Grid>
Expand Down
1 change: 1 addition & 0 deletions src/utils/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export enum FEATURES {
STAKING_BANNER = 'STAKING_BANNER',
MULTI_CHAIN_SAFE_CREATION = 'MULTI_CHAIN_SAFE_CREATION',
MULTI_CHAIN_SAFE_ADD_NETWORK = 'MULTI_CHAIN_SAFE_ADD_NETWORK',
PROPOSERS = 'PROPOSERS',
}

export const FeatureRoutes = {
Expand Down
Loading