Skip to content

Commit

Permalink
fix: checked value option filter
Browse files Browse the repository at this point in the history
  • Loading branch information
DinhTran committed Apr 4, 2024
1 parent 1938795 commit b1b0a40
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/components/GovernanceVotes/index.tsx
Expand Up @@ -1010,8 +1010,8 @@ export interface FilterParams {
isRepeatVote?: boolean;
actionType?: string;
anchorText?: string;
currentStatus?: string;
vote?: string;
actionStatus?: string;
voteType?: string;
}
const FilterGovernanceVotes: React.FC<FilterGovernanceVotes> = ({ query, setQuery, voterType }) => {
const theme = useTheme();
Expand Down Expand Up @@ -1065,15 +1065,15 @@ const FilterGovernanceVotes: React.FC<FilterGovernanceVotes> = ({ query, setQuer
setParamsFilter(params);
setQuery({
tab: query.tab,
isRepeatVote: params?.isRepeatVote,
isRepeatVote: params?.isRepeatVote ? params?.isRepeatVote : undefined,
page: 1,
size: 6,
governanceActionTxHash: params?.governanceActionTxHash,
anchorText: params?.anchorText,
actionType: params?.actionType,
actionStatus: params?.currentStatus,
actionStatus: params?.actionStatus,
voterType: VOTE_TYPE.STAKING_POOL_KEY_HASH,
voteType: params?.vote,
voteType: params?.voteType,
...(params?.fromDate && { fromDate: params.fromDate || "" }),
...(params?.toDate && { toDate: params.toDate || "" })
});
Expand Down Expand Up @@ -1325,16 +1325,14 @@ const FilterGovernanceVotes: React.FC<FilterGovernanceVotes> = ({ query, setQuer
aria-labelledby="demo-controlled-radio-buttons-group"
name="controlled-radio-buttons-group"
sx={{ p: "0px 16px" }}
value={params?.currentStatus}
onChange={(e) => setParams({ ...params, currentStatus: e.target.value })}
value={params?.actionStatus}
onChange={(e) => setParams({ ...params, actionStatus: e.target.value })}
>
{currentStatusList.map((i) => (
<FormControlLabel
key={i.value}
value={i.value}
checked={
params?.currentStatus ? i.value === params?.currentStatus : STATUS_VOTE.ANY === i.value
}
checked={params?.actionStatus ? i.value === params?.actionStatus : STATUS_VOTE.ANY === i.value}
control={
<Radio
sx={{
Expand Down Expand Up @@ -1385,14 +1383,14 @@ const FilterGovernanceVotes: React.FC<FilterGovernanceVotes> = ({ query, setQuer
aria-labelledby="demo-controlled-radio-buttons-group"
name="controlled-radio-buttons-group"
sx={{ p: "0px 16px" }}
value={params?.vote}
onChange={(e) => setParams({ ...params, vote: e.target.value })}
value={params?.voteType}
onChange={(e) => setParams({ ...params, voteType: e.target.value })}
>
{voteList.map((i) => (
<FormControlLabel
key={i.value}
value={i.value}
checked={params?.vote ? i.value === params?.vote : STATUS_VOTE.ANY === i.value}
checked={params?.voteType ? i.value === params?.voteType : STATUS_VOTE.ANY === i.value}
control={
<Radio
sx={{
Expand Down

0 comments on commit b1b0a40

Please sign in to comment.