Skip to content

Commit 79e0124

Browse files
committed
fix: code smells
1 parent 59f19b3 commit 79e0124

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

web/src/pages/Dashboard/JurorInfo/JurorRewards.tsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ const rewards: IReward[] = [
4949
];
5050

5151
const calculateTotalReward = (coinId: number, data: any) => {
52-
const total =
53-
data &&
54-
data.user.shifts
55-
.map((shift) => parseInt(coinId === 0 ? shift.tokenAmount : shift.ethAmount))
56-
.reduce((acc, curr) => acc + curr, 0);
52+
const total = data?.user.shifts
53+
.map((shift) => parseInt(coinId === 0 ? shift.tokenAmount : shift.ethAmount))
54+
.reduce((acc, curr) => acc + curr, 0);
55+
5756
return total;
5857
};
5958

@@ -70,12 +69,12 @@ const Coherency: React.FC = () => {
7069
<label> Juror Rewards </label>
7170
</WithHelpTooltip>
7271

73-
{rewards.map(({ token, coinId, getValue, getAmount }, i) => {
74-
const coinPrice = !isUndefined(pricesData) ? pricesData[coinIdToAddress[coinId!]]?.price : undefined;
72+
{rewards.map(({ token, coinId, getValue, getAmount }) => {
73+
const coinPrice = !isUndefined(pricesData) ? pricesData[coinIdToAddress[coinId]]?.price : undefined;
7574
const totalReward = calculateTotalReward(coinId, data);
7675
return (
7776
<TokenRewards
78-
key={i}
77+
key={coinId}
7978
{...{ token }}
8079
amount={data ? getAmount(totalReward) : "Fetching..."}
8180
value={data ? getValue(totalReward, coinPrice) : "Fetching..."}

0 commit comments

Comments
 (0)