fix: transfer picking
This commit is contained in:
parent
80620abaff
commit
f50e813ed2
@ -10,7 +10,11 @@ import {
|
|||||||
VegaIcon,
|
VegaIcon,
|
||||||
VegaIconNames,
|
VegaIconNames,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import { type Asset, type RecurringTransfer } from '@vegaprotocol/types';
|
import {
|
||||||
|
TransferStatus,
|
||||||
|
type Asset,
|
||||||
|
type RecurringTransfer,
|
||||||
|
} from '@vegaprotocol/types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useT } from '../../lib/use-t';
|
import { useT } from '../../lib/use-t';
|
||||||
import { Table } from '../../components/table';
|
import { Table } from '../../components/table';
|
||||||
@ -124,6 +128,7 @@ const TeamPage = ({
|
|||||||
gamesLoading,
|
gamesLoading,
|
||||||
transfers,
|
transfers,
|
||||||
transfersLoading,
|
transfersLoading,
|
||||||
|
allMarkets,
|
||||||
refetch,
|
refetch,
|
||||||
}: {
|
}: {
|
||||||
team: TeamType;
|
team: TeamType;
|
||||||
@ -187,6 +192,7 @@ const TeamPage = ({
|
|||||||
gamesLoading={gamesLoading}
|
gamesLoading={gamesLoading}
|
||||||
transfers={transfers}
|
transfers={transfers}
|
||||||
transfersLoading={transfersLoading}
|
transfersLoading={transfersLoading}
|
||||||
|
allMarkets={allMarkets}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Members members={members} />
|
<Members members={members} />
|
||||||
@ -231,6 +237,9 @@ const Games = ({
|
|||||||
return (
|
return (
|
||||||
<Table
|
<Table
|
||||||
columns={[
|
columns={[
|
||||||
|
{
|
||||||
|
name: 'id',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'epoch',
|
name: 'epoch',
|
||||||
displayName: t('Epoch'),
|
displayName: t('Epoch'),
|
||||||
@ -262,13 +271,23 @@ const Games = ({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
data={games.map((game) => {
|
data={games.map((game) => {
|
||||||
let transfer = transfers?.find(
|
let transfer = transfers?.find((t) => {
|
||||||
(t) =>
|
if (!isScopedToTeams(t)) return false;
|
||||||
t.transfer.gameId === game.id &&
|
|
||||||
t.transfer.kind.__typename === 'RecurringTransfer' &&
|
const idMatch = t.transfer.gameId === game.id;
|
||||||
|
const metricMatch =
|
||||||
t.transfer.kind.dispatchStrategy?.dispatchMetric ===
|
t.transfer.kind.dispatchStrategy?.dispatchMetric ===
|
||||||
game.team.rewardMetric
|
game.team.rewardMetric;
|
||||||
);
|
|
||||||
|
const start = t.transfer.kind.startEpoch <= game.epoch;
|
||||||
|
const end = t.transfer.kind.endEpoch
|
||||||
|
? t.transfer.kind.endEpoch >= game.epoch
|
||||||
|
: true;
|
||||||
|
|
||||||
|
const rejected = t.transfer.status === TransferStatus.STATUS_REJECTED;
|
||||||
|
|
||||||
|
return idMatch && metricMatch && start && end && !rejected;
|
||||||
|
});
|
||||||
if (!transfer || !isScopedToTeams(transfer)) transfer = undefined;
|
if (!transfer || !isScopedToTeams(transfer)) transfer = undefined;
|
||||||
const asset = transfer?.transfer.asset;
|
const asset = transfer?.transfer.asset;
|
||||||
|
|
||||||
@ -300,6 +319,7 @@ const Games = ({
|
|||||||
const assetSymbol = asset ? <RewardAssetCell asset={asset} /> : '-';
|
const assetSymbol = asset ? <RewardAssetCell asset={asset} /> : '-';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: `${game.id} ${transfer?.transfer.status}`,
|
||||||
amount: dependable(earnedAmount),
|
amount: dependable(earnedAmount),
|
||||||
asset: dependable(assetSymbol),
|
asset: dependable(assetSymbol),
|
||||||
daily: dependable(dailyAmount),
|
daily: dependable(dailyAmount),
|
||||||
|
Loading…
Reference in New Issue
Block a user