chore(explorer): more fields for rewards
This commit is contained in:
parent
496b0b5a90
commit
cb0dd17839
@ -41,46 +41,57 @@ export function TransferRewards({ recurring }: TransferRewardsProps) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destructure to make things a bit more readable
|
||||||
|
const {
|
||||||
|
assetForMetric,
|
||||||
|
entityScope,
|
||||||
|
individualScope,
|
||||||
|
teamScope,
|
||||||
|
distributionStrategy,
|
||||||
|
lockPeriod,
|
||||||
|
markets,
|
||||||
|
stakingRequirement,
|
||||||
|
windowLength,
|
||||||
|
notionalTimeWeightedAveragePositionRequirement,
|
||||||
|
rankTable,
|
||||||
|
nTopPerformers,
|
||||||
|
} = recurring.dispatchStrategy;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={wrapperClasses}>
|
<div className={wrapperClasses}>
|
||||||
<h2 className={headerClasses}>{t('Reward metrics')}</h2>
|
<h2 className={headerClasses}>{getRewardTitle(entityScope)}</h2>
|
||||||
<ul className="relative block rounded-lg py-6 text-left p-6">
|
<ul className="relative block rounded-lg py-6 text-left p-6">
|
||||||
{recurring.dispatchStrategy.assetForMetric ? (
|
{assetForMetric ? (
|
||||||
<li>
|
<li>
|
||||||
<strong>{t('Asset')}</strong>:{' '}
|
<strong>{t('Asset')}</strong>:{' '}
|
||||||
<AssetLink assetId={recurring.dispatchStrategy.assetForMetric} />
|
<AssetLink assetId={assetForMetric} />
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
<li>
|
<li>
|
||||||
<strong>{t('Metric')}</strong>: {metricLabels[metric]}
|
<strong>{t('Metric')}</strong>: {metricLabels[metric]}
|
||||||
</li>
|
</li>
|
||||||
{recurring.dispatchStrategy.entityScope &&
|
{entityScope && entityScopeIcons[entityScope] ? (
|
||||||
entityScopeIcons[recurring.dispatchStrategy.entityScope] ? (
|
|
||||||
<li>
|
<li>
|
||||||
<strong>{t('Scope')}</strong>:{' '}
|
<strong>{t('Scope')}</strong>:{' '}
|
||||||
<VegaIcon
|
<VegaIcon name={entityScopeIcons[entityScope]} />
|
||||||
name={entityScopeIcons[recurring.dispatchStrategy.entityScope]}
|
{individualScope ? individualScopeLabels[individualScope] : null}
|
||||||
/>
|
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{recurring.dispatchStrategy.individualScope}
|
{teamScope}
|
||||||
{recurring.dispatchStrategy.teamScope}
|
{distributionStrategy}
|
||||||
|
|
||||||
{recurring.dispatchStrategy.lockPeriod &&
|
{lockPeriod && lockPeriod !== '0' ? (
|
||||||
recurring.dispatchStrategy.lockPeriod !== '0' ? (
|
|
||||||
<li>
|
<li>
|
||||||
<strong>{t('Lock')}</strong>:{' '}
|
<strong>{t('Lock')}</strong>: {lockPeriod}
|
||||||
{recurring.dispatchStrategy.lockPeriod}
|
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{recurring.dispatchStrategy.markets &&
|
{markets && markets.length > 0 ? (
|
||||||
recurring.dispatchStrategy.markets.length > 0 ? (
|
|
||||||
<li>
|
<li>
|
||||||
<strong>{t('Markets in scope')}</strong>:
|
<strong>{t('Markets in scope')}</strong>:
|
||||||
<ul>
|
<ul>
|
||||||
{recurring.dispatchStrategy.markets.map((m) => (
|
{markets.map((m) => (
|
||||||
<li key={m}>
|
<li key={m}>
|
||||||
<MarketLink id={m} />
|
<MarketLink id={m} />
|
||||||
</li>
|
</li>
|
||||||
@ -89,27 +100,38 @@ export function TransferRewards({ recurring }: TransferRewardsProps) {
|
|||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{recurring.dispatchStrategy.stakingRequirement &&
|
{stakingRequirement && stakingRequirement !== '0' ? (
|
||||||
recurring.dispatchStrategy.stakingRequirement !== '0' ? (
|
|
||||||
<li>
|
<li>
|
||||||
<strong>{t('Staking requirement')}</strong>:{' '}
|
<strong>{t('Staking requirement')}</strong>: {stakingRequirement}
|
||||||
{recurring.dispatchStrategy.stakingRequirement}
|
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{recurring.dispatchStrategy.windowLength &&
|
{windowLength && windowLength !== '0' ? (
|
||||||
recurring.dispatchStrategy.windowLength !== '0' ? (
|
|
||||||
<li>
|
<li>
|
||||||
<strong>{t('Window length')}</strong>:{' '}
|
<strong>{t('Window length')}</strong>:{' '}
|
||||||
{recurring.dispatchStrategy.windowLength}
|
{recurring.dispatchStrategy.windowLength}
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{recurring.dispatchStrategy.rankTable &&
|
{notionalTimeWeightedAveragePositionRequirement &&
|
||||||
recurring.dispatchStrategy.rankTable.length > 0 ? (
|
notionalTimeWeightedAveragePositionRequirement !== '' ? (
|
||||||
<li>
|
<li>
|
||||||
<strong>{t('Ranks')}</strong>:{' '}
|
<strong>
|
||||||
{recurring.dispatchStrategy.rankTable.toString()}
|
{t('notionalTimeWeightedAveragePositionRequirement')}
|
||||||
|
</strong>
|
||||||
|
: {notionalTimeWeightedAveragePositionRequirement}
|
||||||
|
</li>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{nTopPerformers && (
|
||||||
|
<li>
|
||||||
|
<strong>{t('Top performers')}</strong>: {nTopPerformers}
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{rankTable && rankTable.length > 0 ? (
|
||||||
|
<li>
|
||||||
|
<strong>{t('Ranks')}</strong>: {rankTable.toString()}
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
</ul>
|
</ul>
|
||||||
@ -117,6 +139,15 @@ export function TransferRewards({ recurring }: TransferRewardsProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getRewardTitle(
|
||||||
|
scope?: components['schemas']['vegaEntityScope']
|
||||||
|
) {
|
||||||
|
if (scope === 'ENTITY_SCOPE_TEAMS') {
|
||||||
|
return t('Game');
|
||||||
|
}
|
||||||
|
return t('Reward metrics');
|
||||||
|
}
|
||||||
|
|
||||||
interface TransferRecurringStrategyProps {
|
interface TransferRecurringStrategyProps {
|
||||||
strategy: Strategy;
|
strategy: Strategy;
|
||||||
}
|
}
|
||||||
@ -147,3 +178,14 @@ export function TransferRecurringStrategy({
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const individualScopeLabels: Record<
|
||||||
|
components['schemas']['vegaIndividualScope'],
|
||||||
|
string
|
||||||
|
> = {
|
||||||
|
// Unspecified and All are not rendered
|
||||||
|
INDIVIDUAL_SCOPE_UNSPECIFIED: '',
|
||||||
|
INDIVIDUAL_SCOPE_ALL: '',
|
||||||
|
INDIVIDUAL_SCOPE_IN_TEAM: '(in team)',
|
||||||
|
INDIVIDUAL_SCOPE_NOT_IN_TEAM: '(not in team)',
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user