Skip to content

Commit 2af88c1

Browse files
committed
fix: fix some types
1 parent e90eeed commit 2af88c1

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

web/src/components/StatDisplay.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const createPair = (iconColor: string, backgroundColor: string) => ({
4444
export interface IStatDisplay {
4545
title: string;
4646
text: string | React.ReactNode;
47-
subtext: string | React.ReactNode;
47+
subtext?: string | React.ReactNode;
4848
icon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
4949
color: "red" | "orange" | "green" | "blue" | "purple";
5050
}

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

+4-6
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,15 @@ const stats: IStat[] = [
185185
},
186186
];
187187

188-
interface IStats {
188+
interface ITimeframedStat {
189189
title: string;
190190
coinId?: number;
191-
getText: any; //(data: CourtDetailsQuery["court"]) => string;
192-
getSubtext?: any; // (data: CourtDetailsQuery["court"], coinPrice?: number) => string;
191+
getText: (data: { treeExpectedRewardPerPnk: number; treeVotesPerPnk: number; treeDisputesPerPnk: number }) => string;
193192
color: IStatDisplay["color"];
194193
icon: React.FC<React.SVGAttributes<SVGElement>>;
195194
}
196195

197-
const timeframedStats: IStats[] = [
196+
const timeframedStats: ITimeframedStat[] = [
198197
{
199198
title: "PNK for 1 ETH",
200199
getText: (data) => {
@@ -299,13 +298,12 @@ const Stats = () => {
299298
</StyledAllTimeText>
300299
</TimeSelectorContainer>
301300
<StyledCard>
302-
{timeframedStats.map(({ title, getText, getSubtext, color, icon }, i) => {
301+
{timeframedStats.map(({ title, getText, color, icon }, i) => {
303302
return (
304303
<StatDisplay
305304
key={i}
306305
{...{ title, color, icon }}
307306
text={foundCourt ? getText(foundCourt) : <StyledSkeleton />}
308-
subtext={calculateSubtextRender(foundCourt, getSubtext)}
309307
/>
310308
);
311309
})}

0 commit comments

Comments
 (0)