From c345623a06360c73452943bc65109de83762fd82 Mon Sep 17 00:00:00 2001 From: Dexter Edwards Date: Wed, 6 Sep 2023 21:34:18 +0100 Subject: [PATCH] feat: add marketCreationQuantumMultiple into tooltip (#3706) --- apps/governance/src/i18n/translations/dev.json | 2 +- .../epoch-individual-rewards-table.spec.tsx | 5 ++++- .../epoch-individual-rewards-table.tsx | 3 +++ .../epoch-individual-rewards.tsx | 5 +++++ .../epoch-total-rewards-table.spec.tsx | 5 ++++- .../epoch-total-rewards-table.tsx | 8 +++++++- .../epoch-total-rewards/epoch-total-rewards.tsx | 11 ++++++++++- .../shared-rewards-table-assets.tsx | 16 +++++++++++++--- .../network-parameters/src/use-network-params.ts | 2 ++ 9 files changed, 49 insertions(+), 8 deletions(-) diff --git a/apps/governance/src/i18n/translations/dev.json b/apps/governance/src/i18n/translations/dev.json index 95a131119..423fd080e 100644 --- a/apps/governance/src/i18n/translations/dev.json +++ b/apps/governance/src/i18n/translations/dev.json @@ -474,7 +474,7 @@ "rewardsColLiquidityProvisionHeader": "LIQUIDITY PROVISION", "rewardsColLiquidityProvisionTooltip": "Liquidity provision rewards are distributed based on how much you have earned in liquidity fees, funded by a liquidity reward pool for that market", "rewardsColMarketCreationHeader": "MARKET CREATION", - "rewardsColMarketCreationTooltip": "Market creation rewards are paid out to the creator of any market that exceeds a set threshold of cumulative volume in a given epoch, currently [rewards.marketCreationQuantumMultiple]", + "rewardsColMarketCreationTooltip": "Market creation rewards are paid out to the creator of any market that exceeds a set threshold of cumulative volume in a given epoch, currently {{marketCreationQuantumMultiple}}", "rewardsColTotalHeader": "TOTAL", "ofTotalDistributed": "of total distributed", "checkBackSoon": "Check back soon", diff --git a/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.spec.tsx b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.spec.tsx index 1977563a6..5e55043f8 100644 --- a/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.spec.tsx +++ b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.spec.tsx @@ -43,7 +43,10 @@ describe('EpochIndividualRewardsTable', () => { it('should render correctly', () => { const { getByTestId } = render( - + ); expect(getByTestId('epoch-individual-rewards-table')).toBeInTheDocument(); diff --git a/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx index 3112bed91..68c9ea3d3 100644 --- a/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx +++ b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx @@ -8,6 +8,7 @@ import type { EpochIndividualReward } from './generate-epoch-individual-rewards- interface EpochIndividualRewardsGridProps { data: EpochIndividualReward; + marketCreationQuantumMultiple: string | null; } interface RewardItemProps { @@ -69,9 +70,11 @@ const RewardItem = ({ export const EpochIndividualRewardsTable = ({ data, + marketCreationQuantumMultiple, }: EpochIndividualRewardsGridProps) => { return ( diff --git a/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx index ef4b35a2f..e96c7395a 100644 --- a/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx +++ b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx @@ -9,6 +9,7 @@ import { useVegaWallet } from '@vegaprotocol/wallet'; import { EpochIndividualRewardsTable } from './epoch-individual-rewards-table'; import { generateEpochIndividualRewardsList } from './generate-epoch-individual-rewards-list'; import { calculateEpochOffset } from '../../../lib/epoch-pagination'; +import { useNetworkParam } from '@vegaprotocol/network-parameters'; const EPOCHS_PAGE_SIZE = 10; @@ -26,6 +27,9 @@ export const EpochIndividualRewards = ({ const { t } = useTranslation(); const { pubKey } = useVegaWallet(); const { delegationsPagination } = ENV; + const { param: marketCreationQuantumMultiple } = useNetworkParam( + 'rewards_marketCreationQuantumMultiple' + ); const { data, loading, error, refetch } = useRewardsQuery({ notifyOnNetworkStatusChange: true, @@ -103,6 +107,7 @@ export const EpochIndividualRewards = ({ {epochIndividualRewardSummaries.map( (epochIndividualRewardSummary) => ( ) diff --git a/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.spec.tsx b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.spec.tsx index cf581e3b9..55a8dec3a 100644 --- a/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.spec.tsx +++ b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.spec.tsx @@ -66,7 +66,10 @@ describe('EpochTotalRewardsTable', () => { it('should render correctly', () => { const { getByTestId } = render( - + ); expect(getByTestId('epoch-total-rewards-table')).toBeInTheDocument(); diff --git a/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx index d70ce0333..c0d4a30e8 100644 --- a/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx +++ b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx @@ -8,6 +8,7 @@ import type { EpochTotalSummary } from './generate-epoch-total-rewards-list'; interface EpochTotalRewardsGridProps { data: EpochTotalSummary; + marketCreationQuantumMultiple: string | null; } interface RewardItemProps { @@ -52,9 +53,14 @@ const RewardItem = ({ export const EpochTotalRewardsTable = ({ data, + marketCreationQuantumMultiple, }: EpochTotalRewardsGridProps) => { return ( - + {Array.from(data.assetRewards.values()).map( ({ name, rewards, totalAmount, decimals }, i) => (
diff --git a/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards.tsx b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards.tsx index f4c8c3ef5..c518f03c5 100644 --- a/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards.tsx +++ b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards.tsx @@ -6,6 +6,7 @@ import { useEpochAssetsRewardsQuery } from '../home/__generated__/Rewards'; import { generateEpochTotalRewardsList } from './generate-epoch-total-rewards-list'; import { EpochTotalRewardsTable } from './epoch-total-rewards-table'; import { calculateEpochOffset } from '../../../lib/epoch-pagination'; +import { useNetworkParam } from '@vegaprotocol/network-parameters'; const EPOCHS_PAGE_SIZE = 10; @@ -18,6 +19,10 @@ export const EpochTotalRewards = ({ currentEpoch }: EpochTotalRewardsProps) => { const epochId = Number(currentEpoch.id) - 1; const totalPages = Math.ceil(epochId / EPOCHS_PAGE_SIZE); const { t } = useTranslation(); + const { param: marketCreationQuantumMultiple } = useNetworkParam( + 'rewards_marketCreationQuantumMultiple' + ); + console.log(marketCreationQuantumMultiple); const [page, setPage] = useState(1); const { data, loading, error, refetch } = useEpochAssetsRewardsQuery({ notifyOnNetworkStatusChange: true, @@ -70,7 +75,11 @@ export const EpochTotalRewards = ({ currentEpoch }: EpochTotalRewardsProps) => { > {Array.from(epochTotalRewardSummaries.values()).map( (epochTotalSummary, index) => ( - + ) )} ); -const ColumnHeaders = () => { +const ColumnHeaders = ({ + marketCreationQuantumMultiple, +}: { + marketCreationQuantumMultiple: string | null; +}) => { const { t } = useTranslation(); return (
@@ -89,7 +93,9 @@ const ColumnHeaders = () => { ))} @@ -105,6 +111,7 @@ export interface RewardTableProps { dataTestId: string; epoch: number; children: ReactNode; + marketCreationQuantumMultiple: string | null; } // Rewards table children will be the row items. Make sure they contain @@ -113,12 +120,15 @@ export const RewardsTable = ({ dataTestId, epoch, children, + marketCreationQuantumMultiple, }: RewardTableProps) => (
- + {children}
diff --git a/libs/network-parameters/src/use-network-params.ts b/libs/network-parameters/src/use-network-params.ts index c0b7afc9c..bc6cd31f2 100644 --- a/libs/network-parameters/src/use-network-params.ts +++ b/libs/network-parameters/src/use-network-params.ts @@ -8,6 +8,8 @@ import { export const NetworkParams = { blockchains_ethereumConfig: 'blockchains_ethereumConfig', reward_asset: 'reward_asset', + rewards_marketCreationQuantumMultiple: + 'rewards_marketCreationQuantumMultiple', reward_staking_delegation_payoutDelay: 'reward_staking_delegation_payoutDelay', governance_proposal_market_minVoterBalance: