Skip to content

Commit

Permalink
Merge pull request #5545 from LiskHQ/5544-commission-change-history-view
Browse files Browse the repository at this point in the history
Fix commission history view for all validators
  • Loading branch information
ManuGowda authored Dec 11, 2023
2 parents 392b153 + b59ab83 commit 4aee9c3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/modules/pos/validator/components/CommissionHistory/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import grid from 'flexboxgrid/dist/flexboxgrid.css';
import { useCurrentAccount } from '@account/hooks';
import { useTransactionEvents } from '@transaction/hooks/queries';
Expand All @@ -8,13 +9,18 @@ import Box from '@theme/box';
import BoxHeader from '@theme/box/header';
import BoxContent from '@theme/box/content';
import { QueryTable } from '@theme/QueryTable';
import { selectSearchParamValue } from 'src/utils/searchParams';
import header from './header';
import CommissionHistoryRow from './CommissionHistoryRow';
import styles from './styles.css';

const CommissionHistory = () => {
const { t } = useTranslation();
const [currentAccount] = useCurrentAccount();
const history = useHistory();
/* istanbul ignore next */
const [{ metadata: { address: currentAddress } = {} }] = useCurrentAccount();
const address =
selectSearchParamValue(history.location.search, 'validatorAddress') || currentAddress;
return (
<Dialog hasClose>
<Box className={`${grid.col} ${styles.historyContainer} history-container`}>
Expand All @@ -29,7 +35,7 @@ const CommissionHistory = () => {
queryConfig={{
config: {
params: {
senderAddress: currentAccount.metadata.address,
senderAddress: address,
name: 'commissionChange',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useTransactionsFromPool } from '@transaction/hooks/queries';
import styles from './ValidatorProfile.css';
import { convertCommissionToPercentage } from '../../utils';
import usePosToken from '../../hooks/usePosToken';
import { MAX_VALIDATOR_COMMISSION } from '../../consts';

const DetailsView = ({ data, isMyProfile }) => {
const { name, rank, validatorWeight, commission, lastGeneratedHeight } = data;
Expand Down Expand Up @@ -59,9 +60,10 @@ const DetailsView = ({ data, isMyProfile }) => {
onEdit: !isMyProfile
? undefined
: () => addSearchParamsToUrl(history, { modal: 'changeCommission' }),
onView: !isMyProfile
? undefined
: () => addSearchParamsToUrl(history, { modal: 'commissionHistory' }),
onView:
commission < MAX_VALIDATOR_COMMISSION
? () => addSearchParamsToUrl(history, { modal: 'commissionHistory' })
: undefined,
},
{
icon: 'calendar',
Expand Down
2 changes: 1 addition & 1 deletion src/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export const modals = {
forbiddenTokens: [],
},
commissionHistory: {
isPrivate: true,
isPrivate: false,
forbiddenTokens: [],
},
noTokenBalance: {
Expand Down

0 comments on commit 4aee9c3

Please sign in to comment.