Merge pull request #5393 from vegaprotocol/chore/sync-main
chore(trading, datagrid, liquidity, proposals, ui-toolkit): sync main
This commit is contained in:
commit
5c7c626bbc
@ -1,7 +1,6 @@
|
|||||||
import { useAssetDetailsDialogStore } from '@vegaprotocol/assets';
|
import { useAssetDetailsDialogStore } from '@vegaprotocol/assets';
|
||||||
import { DocsLinks, useEnvironment } from '@vegaprotocol/environment';
|
import { DocsLinks, useEnvironment } from '@vegaprotocol/environment';
|
||||||
import { ButtonLink, ExternalLink, Link } from '@vegaprotocol/ui-toolkit';
|
import { ButtonLink, ExternalLink, Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { MarketProposalNotification } from '@vegaprotocol/proposals';
|
|
||||||
import type { Market } from '@vegaprotocol/markets';
|
import type { Market } from '@vegaprotocol/markets';
|
||||||
import {
|
import {
|
||||||
addDecimalsFormatNumber,
|
addDecimalsFormatNumber,
|
||||||
@ -145,7 +144,6 @@ export const MarketHeaderStats = ({ market }: MarketHeaderStatsProps) => {
|
|||||||
/>
|
/>
|
||||||
</HeaderStat>
|
</HeaderStat>
|
||||||
)}
|
)}
|
||||||
<MarketProposalNotification marketId={market.id} />
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -75,22 +75,20 @@ export const useReferralProgram = () => {
|
|||||||
|
|
||||||
const benefitTiers = sortBy(data.currentReferralProgram.benefitTiers, (t) =>
|
const benefitTiers = sortBy(data.currentReferralProgram.benefitTiers, (t) =>
|
||||||
Number(t.referralRewardFactor)
|
Number(t.referralRewardFactor)
|
||||||
)
|
).map((t, i) => {
|
||||||
.reverse()
|
return {
|
||||||
.map((t, i) => {
|
tier: i + 1, // sorted in asc order, hence first is the lowest tier
|
||||||
return {
|
rewardFactor: Number(t.referralRewardFactor),
|
||||||
tier: i + 1,
|
commission: Number(t.referralRewardFactor) * 100 + '%',
|
||||||
rewardFactor: Number(t.referralRewardFactor),
|
discountFactor: Number(t.referralDiscountFactor),
|
||||||
commission: Number(t.referralRewardFactor) * 100 + '%',
|
discount: Number(t.referralDiscountFactor) * 100 + '%',
|
||||||
discountFactor: Number(t.referralDiscountFactor),
|
minimumVolume: Number(t.minimumRunningNotionalTakerVolume),
|
||||||
discount: Number(t.referralDiscountFactor) * 100 + '%',
|
volume: getNumberFormat(0).format(
|
||||||
minimumVolume: Number(t.minimumRunningNotionalTakerVolume),
|
Number(t.minimumRunningNotionalTakerVolume)
|
||||||
volume: getNumberFormat(0).format(
|
),
|
||||||
Number(t.minimumRunningNotionalTakerVolume)
|
epochs: Number(t.minimumEpochs),
|
||||||
),
|
};
|
||||||
epochs: Number(t.minimumEpochs),
|
});
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const stakingTiers = sortBy(
|
const stakingTiers = sortBy(
|
||||||
data.currentReferralProgram.stakingTiers,
|
data.currentReferralProgram.stakingTiers,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import minBy from 'lodash/minBy';
|
||||||
import { CodeTile, StatTile } from './tile';
|
import { CodeTile, StatTile } from './tile';
|
||||||
import {
|
import {
|
||||||
VegaIcon,
|
VegaIcon,
|
||||||
@ -28,7 +29,6 @@ import sortBy from 'lodash/sortBy';
|
|||||||
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useCurrentEpochInfoQuery } from './hooks/__generated__/Epoch';
|
import { useCurrentEpochInfoQuery } from './hooks/__generated__/Epoch';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import maxBy from 'lodash/maxBy';
|
|
||||||
import { DocsLinks } from '@vegaprotocol/environment';
|
import { DocsLinks } from '@vegaprotocol/environment';
|
||||||
import { useT, ns } from '../../lib/use-t';
|
import { useT, ns } from '../../lib/use-t';
|
||||||
import { Trans } from 'react-i18next';
|
import { Trans } from 'react-i18next';
|
||||||
@ -128,7 +128,7 @@ export const useStats = ({
|
|||||||
);
|
);
|
||||||
const nextBenefitTierValue = currentBenefitTierValue
|
const nextBenefitTierValue = currentBenefitTierValue
|
||||||
? benefitTiers.find((t) => t.tier === currentBenefitTierValue.tier - 1)
|
? benefitTiers.find((t) => t.tier === currentBenefitTierValue.tier - 1)
|
||||||
: maxBy(benefitTiers, (bt) => bt.tier); // max tier number is lowest tier
|
: minBy(benefitTiers, (bt) => bt.tier); // min tier number is lowest tier
|
||||||
const epochsValue =
|
const epochsValue =
|
||||||
!isNaN(currentEpoch) && refereeInfo?.atEpoch
|
!isNaN(currentEpoch) && refereeInfo?.atEpoch
|
||||||
? currentEpoch - refereeInfo?.atEpoch
|
? currentEpoch - refereeInfo?.atEpoch
|
||||||
|
@ -218,13 +218,13 @@ const TiersTable = ({
|
|||||||
...d,
|
...d,
|
||||||
className: classNames({
|
className: classNames({
|
||||||
'from-vega-pink-400 dark:from-vega-pink-600 to-20% bg-highlight':
|
'from-vega-pink-400 dark:from-vega-pink-600 to-20% bg-highlight':
|
||||||
d.tier === 1,
|
d.tier >= 3,
|
||||||
'from-vega-purple-400 dark:from-vega-purple-600 to-20% bg-highlight':
|
'from-vega-purple-400 dark:from-vega-purple-600 to-20% bg-highlight':
|
||||||
d.tier === 2,
|
d.tier === 2,
|
||||||
'from-vega-blue-400 dark:from-vega-blue-600 to-20% bg-highlight':
|
'from-vega-blue-400 dark:from-vega-blue-600 to-20% bg-highlight':
|
||||||
d.tier === 3,
|
d.tier === 1,
|
||||||
'from-vega-orange-400 dark:from-vega-orange-600 to-20% bg-highlight':
|
'from-vega-orange-400 dark:from-vega-orange-600 to-20% bg-highlight':
|
||||||
d.tier > 3,
|
d.tier == 0,
|
||||||
}),
|
}),
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
|
@ -36,7 +36,7 @@ export const FeesContainer = () => {
|
|||||||
const { data: markets, loading: marketsLoading } = useMarketList();
|
const { data: markets, loading: marketsLoading } = useMarketList();
|
||||||
|
|
||||||
const { data: programData, loading: programLoading } =
|
const { data: programData, loading: programLoading } =
|
||||||
useDiscountProgramsQuery();
|
useDiscountProgramsQuery({ errorPolicy: 'ignore' });
|
||||||
|
|
||||||
const volumeDiscountWindowLength =
|
const volumeDiscountWindowLength =
|
||||||
programData?.currentVolumeDiscountProgram?.windowLength || 1;
|
programData?.currentVolumeDiscountProgram?.windowLength || 1;
|
||||||
@ -459,25 +459,19 @@ const VolumeTiers = ({
|
|||||||
</tr>
|
</tr>
|
||||||
</THead>
|
</THead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{Array.from(tiers)
|
{Array.from(tiers).map((tier, i) => {
|
||||||
.reverse()
|
const isUserTier = tiers.length - 1 - tierIndex === i;
|
||||||
.map((tier, i) => {
|
|
||||||
const isUserTier = tiers.length - 1 - tierIndex === i;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tr key={i}>
|
<Tr key={i}>
|
||||||
<Td>{i + 1}</Td>
|
<Td>{i + 1}</Td>
|
||||||
<Td>
|
<Td>{formatPercentage(Number(tier.volumeDiscountFactor))}%</Td>
|
||||||
{formatPercentage(Number(tier.volumeDiscountFactor))}%
|
<Td>{formatNumber(tier.minimumRunningNotionalTakerVolume)}</Td>
|
||||||
</Td>
|
<Td>{isUserTier ? formatNumber(lastEpochVolume) : ''}</Td>
|
||||||
<Td>
|
<Td>{isUserTier ? <YourTier /> : null}</Td>
|
||||||
{formatNumber(tier.minimumRunningNotionalTakerVolume)}
|
</Tr>
|
||||||
</Td>
|
);
|
||||||
<Td>{isUserTier ? formatNumber(lastEpochVolume) : ''}</Td>
|
})}
|
||||||
<Td>{isUserTier ? <YourTier /> : null}</Td>
|
|
||||||
</Tr>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</Table>
|
</Table>
|
||||||
</div>
|
</div>
|
||||||
@ -520,37 +514,33 @@ const ReferralTiers = ({
|
|||||||
</tr>
|
</tr>
|
||||||
</THead>
|
</THead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{Array.from(tiers)
|
{Array.from(tiers).map((t, i) => {
|
||||||
.reverse()
|
const isUserTier = tiers.length - 1 - tierIndex === i;
|
||||||
.map((t, i) => {
|
|
||||||
const isUserTier = tiers.length - 1 - tierIndex === i;
|
|
||||||
|
|
||||||
const requiredVolume = Number(
|
const requiredVolume = Number(t.minimumRunningNotionalTakerVolume);
|
||||||
t.minimumRunningNotionalTakerVolume
|
let unlocksIn = null;
|
||||||
|
|
||||||
|
if (
|
||||||
|
referralVolumeInWindow >= requiredVolume &&
|
||||||
|
epochsInSet < t.minimumEpochs
|
||||||
|
) {
|
||||||
|
unlocksIn = (
|
||||||
|
<span className="text-muted">
|
||||||
|
Unlocks in {t.minimumEpochs - epochsInSet} epochs
|
||||||
|
</span>
|
||||||
);
|
);
|
||||||
let unlocksIn = null;
|
}
|
||||||
|
|
||||||
if (
|
return (
|
||||||
referralVolumeInWindow >= requiredVolume &&
|
<Tr key={i}>
|
||||||
epochsInSet < t.minimumEpochs
|
<Td>{i + 1}</Td>
|
||||||
) {
|
<Td>{formatPercentage(Number(t.referralDiscountFactor))}%</Td>
|
||||||
unlocksIn = (
|
<Td>{formatNumber(t.minimumRunningNotionalTakerVolume)}</Td>
|
||||||
<span className="text-muted">
|
<Td>{t.minimumEpochs}</Td>
|
||||||
Unlocks in {t.minimumEpochs - epochsInSet} epochs
|
<Td>{isUserTier ? <YourTier /> : unlocksIn}</Td>
|
||||||
</span>
|
</Tr>
|
||||||
);
|
);
|
||||||
}
|
})}
|
||||||
|
|
||||||
return (
|
|
||||||
<Tr key={i}>
|
|
||||||
<Td>{i + 1}</Td>
|
|
||||||
<Td>{formatPercentage(Number(t.referralDiscountFactor))}%</Td>
|
|
||||||
<Td>{formatNumber(t.minimumRunningNotionalTakerVolume)}</Td>
|
|
||||||
<Td>{t.minimumEpochs}</Td>
|
|
||||||
<Td>{isUserTier ? <YourTier /> : unlocksIn}</Td>
|
|
||||||
</Tr>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</Table>
|
</Table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,10 +36,10 @@ export const AgGridThemed = ({
|
|||||||
<div className={wrapperClasses}>
|
<div className={wrapperClasses}>
|
||||||
<AgGridReact
|
<AgGridReact
|
||||||
defaultColDef={defaultColDef}
|
defaultColDef={defaultColDef}
|
||||||
ref={gridRef}
|
|
||||||
overlayLoadingTemplate={t('Loading...')}
|
overlayLoadingTemplate={t('Loading...')}
|
||||||
overlayNoRowsTemplate={t('No data')}
|
overlayNoRowsTemplate={t('No data')}
|
||||||
suppressDragLeaveHidesColumns
|
suppressDragLeaveHidesColumns
|
||||||
|
ref={gridRef}
|
||||||
{...defaultProps}
|
{...defaultProps}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
@ -107,9 +107,6 @@ export const LiquidityTable = ({
|
|||||||
|
|
||||||
const feesAccruedTooltip = ({ value, data }: ITooltipParams) => {
|
const feesAccruedTooltip = ({ value, data }: ITooltipParams) => {
|
||||||
if (!value) return '-';
|
if (!value) return '-';
|
||||||
const newValue = new BigNumber(value)
|
|
||||||
.times(Number(stakeToCcyVolume) || 1)
|
|
||||||
.toString();
|
|
||||||
let lessThanFull = false,
|
let lessThanFull = false,
|
||||||
lessThanMinimum = false;
|
lessThanMinimum = false;
|
||||||
if (data.sla) {
|
if (data.sla) {
|
||||||
@ -154,7 +151,7 @@ export const LiquidityTable = ({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return addDecimalsFormatNumber(newValue, assetDecimalPlaces ?? 0);
|
return addDecimalsFormatNumber(value, assetDecimalPlaces ?? 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
const stakeToCcyVolumeQuantumFormatter = ({
|
const stakeToCcyVolumeQuantumFormatter = ({
|
||||||
|
@ -30,7 +30,7 @@ export const MarketProposalNotification = ({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<div className="border-default min-w-min whitespace-nowrap border-l pb-1 pl-1 pr-1">
|
<div className="border-default min-w-min border-l pb-1 pl-1 pr-1">
|
||||||
<Notification
|
<Notification
|
||||||
intent={Intent.Warning}
|
intent={Intent.Warning}
|
||||||
message={message}
|
message={message}
|
||||||
|
@ -93,7 +93,7 @@ export const Notification = ({
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'flex flex-col items-start overflow-hidden gap-0 mt-1',
|
'flex flex-col items-start overflow-hidden gap-0',
|
||||||
'text-vega-clight-50 dark:text-vega-cdark-50',
|
'text-vega-clight-50 dark:text-vega-cdark-50',
|
||||||
'font-alpha',
|
'font-alpha',
|
||||||
{ 'text-sm': size === 'small', 'text-base': size === 'medium' }
|
{ 'text-sm': size === 'small', 'text-base': size === 'medium' }
|
||||||
|
Loading…
Reference in New Issue
Block a user