2024-02-15 20:14:04 +00:00
|
|
|
import { ActiveRewardCard } from '../rewards-container/active-rewards';
|
2024-01-31 14:21:29 +00:00
|
|
|
import { useT } from '../../lib/use-t';
|
2024-02-20 12:20:35 +00:00
|
|
|
import { type EnrichedRewardTransfer } from '../../lib/hooks/use-rewards';
|
2024-01-31 14:21:29 +00:00
|
|
|
|
|
|
|
export const GamesContainer = ({
|
|
|
|
data,
|
|
|
|
currentEpoch,
|
|
|
|
}: {
|
2024-02-20 12:20:35 +00:00
|
|
|
data: EnrichedRewardTransfer[];
|
2024-01-31 14:21:29 +00:00
|
|
|
currentEpoch: number;
|
|
|
|
}) => {
|
|
|
|
const t = useT();
|
|
|
|
|
2024-02-15 20:14:04 +00:00
|
|
|
if (!data || data.length === 0) {
|
2024-01-31 14:21:29 +00:00
|
|
|
return (
|
2024-02-20 15:17:02 +00:00
|
|
|
<p className="text-sm">
|
|
|
|
{t('Currently no active games on the network.')}
|
2024-01-31 14:21:29 +00:00
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-02-20 15:17:02 +00:00
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
2024-02-15 20:14:04 +00:00
|
|
|
{data.map((game, i) => {
|
2024-01-31 14:21:29 +00:00
|
|
|
// TODO: Remove `kind` prop from ActiveRewardCard
|
|
|
|
const { transfer } = game;
|
|
|
|
if (
|
|
|
|
transfer.kind.__typename !== 'RecurringTransfer' ||
|
|
|
|
!transfer.kind.dispatchStrategy?.dispatchMetric
|
|
|
|
) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<ActiveRewardCard
|
|
|
|
key={i}
|
|
|
|
transferNode={game}
|
|
|
|
currentEpoch={currentEpoch}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|