Skip to content

Commit

Permalink
fix(web): fix-price-calculation-in-dashboard-juror-rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
Harman-singh-waraich authored and jaybuidl committed Jan 23, 2024
1 parent 255338a commit fe8a6f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions web/src/components/NumberDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ const NumberDisplay: React.FC<INumberDisplay> = ({
const parsedValue = Number(value);
const formattedValue = parsedValue % 1 !== 0 ? parsedValue.toFixed(decimals) : parsedValue.toFixed(0);
const tooltipValue = isCurrency ? `${unit} ${value}` : `${value} ${unit}`;
const displayValue = isCurrency
? `${showUnitInDisplay ? unit : ""} ${formattedValue}`
: `${formattedValue} ${showUnitInDisplay ? unit : ""}`;
const displayUnit = showUnitInDisplay ? unit : "";
const displayValue = isCurrency ? `${displayUnit} ${formattedValue}` : `${formattedValue} ${displayUnit}`;
return (
<Tooltip small text={tooltipValue} place={place}>
{displayValue}
Expand Down
4 changes: 3 additions & 1 deletion web/src/utils/jurorRewardConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { formatUnits, formatEther } from "viem";
import { isUndefined } from "utils/index";
import { UserQuery } from "queries/useUser";
import { CoinIds } from "consts/coingecko";

export interface IReward {
token: "ETH" | "PNK";
Expand Down Expand Up @@ -34,7 +35,8 @@ export const calculateTotalJurorReward = (coinId: number, data: UserQuery): bigi

export const getFormattedRewards = (data: any, pricesData: any) => {
return rewards.map(({ token, coinId, getValue, getAmount }) => {
const coinPrice = !isUndefined(pricesData) ? pricesData[coinId]?.price : undefined;
const coinPrice = !isUndefined(pricesData) ? pricesData[CoinIds[token]]?.price : undefined;

const totalReward = data && calculateTotalJurorReward(coinId, data);
return {
token,
Expand Down

0 comments on commit fe8a6f3

Please sign in to comment.