Skip to content

Commit 638c5ba

Browse files
committed
feat: add tooltips to the 4 stat variables, typing, wording adjustment
1 parent 40e8011 commit 638c5ba

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

web/src/components/StatDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const createPair = (iconColor: string, backgroundColor: string) => ({
4242
});
4343

4444
export interface IStatDisplay {
45-
title: string;
45+
title: string | React.ReactNode;
4646
text: string | React.ReactNode;
4747
subtext?: string | React.ReactNode;
4848
icon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;

web/src/pages/Courts/CourtDetails/StakePanel/SimulatorPopup/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ const SimulatorPopup: React.FC<{ stakingAmount: number }> = ({ stakingAmount })
131131
const jurorOdds = calculateJurorOdds(stakingAmount, effectiveStakeAsNumber + stakingAmount);
132132

133133
const simulatorItems = [
134-
{ icon: <LawBalanceIcon />, description: "You would have been selected in", value: `${expectedCases} case(s)` },
135-
{ icon: <PNKIcon />, description: "You would have had", value: `${expectedVotes} vote(s)` },
134+
{ icon: <LawBalanceIcon />, description: "You would have been selected in", value: `${expectedCases} cases` },
135+
{ icon: <PNKIcon />, description: "You would have had", value: `${expectedVotes} votes` },
136136
{ icon: <PileCoinsIcon />, description: "You would have earned", value: `${expectedRewardsUSD}` },
137137
{ icon: <DiceIcon />, description: "Your juror odds would have been", value: `${jurorOdds}` },
138138
];

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

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { commify } from "utils/commify";
3131

3232
import StatDisplay, { IStatDisplay } from "components/StatDisplay";
3333
import { StyledSkeleton } from "components/StyledSkeleton";
34+
import WithHelpTooltip from "components/WithHelpTooltip";
3435
import Info from "./Info";
3536

3637
const StyledAccordion = styled(Accordion)`
@@ -193,7 +194,7 @@ const stats: IStat[] = [
193194
];
194195

195196
interface ITimeframedStat {
196-
title: string;
197+
title: string | React.ReactNode;
197198
coinId?: number;
198199
getText: (data: { treeExpectedRewardPerPnk: number; treeVotesPerPnk: number; treeDisputesPerPnk: number }) => string;
199200
color: IStatDisplay["color"];
@@ -236,7 +237,11 @@ const Stats = () => {
236237

237238
const timeframedStats: ITimeframedStat[] = [
238239
{
239-
title: "PNK for 1 USD",
240+
title: (
241+
<WithHelpTooltip place="top" tooltipMsg="Amount of PNK you need to stake to earn 1 USD in rewards.">
242+
PNK for 1 USD
243+
</WithHelpTooltip>
244+
),
240245
getText: (data) => {
241246
const treeExpectedRewardPerPnk = data?.treeExpectedRewardPerPnk;
242247
const ethPriceUSD = pricesData ? pricesData[CoinIds.ETH]?.price : undefined;
@@ -248,7 +253,11 @@ const Stats = () => {
248253
icon: PNKUSDIcon,
249254
},
250255
{
251-
title: "PNK for 1 ETH",
256+
title: (
257+
<WithHelpTooltip place="top" tooltipMsg="Amount of PNK you need to stake to earn 1 ETH in rewards.">
258+
PNK for 1 ETH
259+
</WithHelpTooltip>
260+
),
252261
getText: (data) => {
253262
const treeExpectedRewardPerPnk = data?.treeExpectedRewardPerPnk;
254263
if (!treeExpectedRewardPerPnk) return "N/A";
@@ -259,7 +268,11 @@ const Stats = () => {
259268
icon: PNKETHIcon,
260269
},
261270
{
262-
title: "PNK for 1 Vote",
271+
title: (
272+
<WithHelpTooltip place="top" tooltipMsg="Amount of PNK you need to stake to get 1 vote.">
273+
PNK for 1 Vote
274+
</WithHelpTooltip>
275+
),
263276
getText: (data) => {
264277
const treeVotesPerPnk = data?.treeVotesPerPnk;
265278
return beautifyStatNumber(treeVotesPerPnk);
@@ -268,7 +281,14 @@ const Stats = () => {
268281
icon: VotesPerPNKIcon,
269282
},
270283
{
271-
title: "PNK for 1 Case",
284+
title: (
285+
<WithHelpTooltip
286+
place="top"
287+
tooltipMsg="Amount of PNK you need to stake to be drawn in 1 case (which may involve one or more votes)."
288+
>
289+
PNK for 1 Case
290+
</WithHelpTooltip>
291+
),
272292
getText: (data) => {
273293
const treeDisputesPerPnk = data?.treeDisputesPerPnk;
274294
return beautifyStatNumber(treeDisputesPerPnk);

0 commit comments

Comments
 (0)