Skip to content

Commit 721d029

Browse files
committed
refactor(web): rabbit-feedback
1 parent faa026b commit 721d029

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

web/src/hooks/useCoinPrice.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ const fetchCoinPrices = async (...coinIds) => {
66
return data.coins;
77
};
88

9+
export type Prices = {
10+
[coinId: string]: { price: number };
11+
};
12+
913
export const useCoinPrice = (coinIds: string[]) => {
1014
const isEnabled = coinIds !== undefined;
1115

12-
const { data: prices, isError } = useQuery({
16+
const { data: prices, isError } = useQuery<Prices>({
1317
queryKey: [`coinPrice${coinIds}`],
1418
enabled: isEnabled,
1519
queryFn: async () => fetchCoinPrices(coinIds),

web/src/pages/Courts/CourtDetails/Stats/StatsContent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import styled from "styled-components";
33

44
import ChartIcon from "svgs/icons/chart.svg";
55

6+
import { Prices } from "hooks/useCoinPrice";
67
import { calculateSubtextRender } from "utils/calculateSubtextRender";
78
import { isUndefined } from "utils/index";
89

@@ -50,7 +51,7 @@ const StyledCard = styled.div`
5051
gap: 20px 0;
5152
`;
5253

53-
const StatsContent: React.FC<{ court: CourtDetailsQuery["court"]; pricesData: any; coinIds: string[] }> = ({
54+
const StatsContent: React.FC<{ court: CourtDetailsQuery["court"]; pricesData?: Prices; coinIds: string[] }> = ({
5455
court,
5556
pricesData,
5657
coinIds,

web/src/pages/Courts/CourtDetails/Stats/stats.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const stats: IStat[] = [
5454
return `${formatPNK(stake)} PNK`;
5555
},
5656
getSubtext: (data, coinPrice) => {
57-
const stake = BigInt((data?.minStake * data?.alpha) / 1e4);
57+
const stake = (BigInt(data?.minStake) * BigInt(data?.alpha)) / BigInt(1e4);
5858
return formatUSD(Number(formatUnitsWei(stake)) * (coinPrice ?? 0));
5959
},
6060
color: "blue",

0 commit comments

Comments
 (0)