diff --git a/app/[username]/wrapped/sections/wrapped-runs-and-pbs.tsx b/app/[username]/wrapped/sections/wrapped-runs-and-pbs.tsx index 2b3bd69d..96d1d5f8 100644 --- a/app/[username]/wrapped/sections/wrapped-runs-and-pbs.tsx +++ b/app/[username]/wrapped/sections/wrapped-runs-and-pbs.tsx @@ -13,6 +13,7 @@ import { import styles from "~src/components/css/LiveRun.module.scss"; import { GameImage } from "~src/components/image/gameimage"; import { TrophyIcon } from "~src/icons/trophy-icon"; +import { TruncatedTextTooltip } from "~src/components/tooltip"; interface WrappedRunsAndPbsProps { wrapped: WrappedWithData; @@ -252,28 +253,35 @@ const GameOverview: React.FC<
- {i < 3 && ( - - )} - - {key} - + + {i < 3 && ( + + )} + + {key} + + + } + />
@@ -459,25 +467,35 @@ const ShowGame: React.FC< setSelectedCategory(category); }} > -
- {category} -{" "} - {" "} - {categoryData.timeBefore && - categoryData.pb && - categoryData.timeBefore !== - categoryData.pb && ( - - ( - + + {category} -{" "} + {" "} - this year) - - )} + {categoryData.timeBefore && + categoryData.pb && + categoryData.timeBefore !== + categoryData.pb && ( + + ( + {" "} + this year) + + )} + + } + />
diff --git a/app/[username]/wrapped/sections/wrapped-streak.tsx b/app/[username]/wrapped/sections/wrapped-streak.tsx index 2bfe067e..02ece601 100644 --- a/app/[username]/wrapped/sections/wrapped-streak.tsx +++ b/app/[username]/wrapped/sections/wrapped-streak.tsx @@ -13,6 +13,7 @@ import { } from "~src/components/util/datetime"; import { Col, Row, Table } from "react-bootstrap"; import styles from "../hearts.module.scss"; +import { TruncatedTextTooltip } from "~src/components/tooltip"; export const WrappedStreak = ({ wrapped }: { wrapped: WrappedWithData }) => { const streakInDays = wrapped.streak.length; @@ -396,10 +397,14 @@ export const WrappedStreak = ({ wrapped }: { wrapped: WrappedWithData }) => { return ( -
- {getDateAsMonthDay( - new Date(run.endedAt), - )} +
+
{ }} >
- {run.game} +
{run.category} @@ -447,8 +454,8 @@ const StreakStatItem = ({ }) => { return ( - - {stat} + + {stat}} /> {explanation} diff --git a/app/[username]/wrapped/sections/wrapped-top-games.tsx b/app/[username]/wrapped/sections/wrapped-top-games.tsx index 002927f5..f4112af6 100644 --- a/app/[username]/wrapped/sections/wrapped-top-games.tsx +++ b/app/[username]/wrapped/sections/wrapped-top-games.tsx @@ -8,6 +8,7 @@ import { SectionWrapper } from "./section-wrapper"; import { SectionBody } from "./section-body"; import { SectionTitle } from "./section-title"; import { TrophyIcon } from "~src/icons/trophy-icon"; +import { TruncatedTextTooltip } from "~src/components/tooltip"; interface WrappedTopGamesProps { wrapped: WrappedWithData; @@ -127,8 +128,10 @@ export const WrappedTopGames = memo(({ wrapped }) => { autosize />
-

- {display} +

+

diff --git a/src/components/tooltip.tsx b/src/components/tooltip.tsx index f094044c..0501b460 100644 --- a/src/components/tooltip.tsx +++ b/src/components/tooltip.tsx @@ -1,4 +1,5 @@ -import { OverlayTrigger, Popover } from "react-bootstrap"; +import { ReactNode, memo } from "react"; +import { OverlayTrigger, Popover, Tooltip } from "react-bootstrap"; import { ReactElementLike } from "prop-types"; export const InfoTooltip = ({ @@ -70,3 +71,30 @@ export const QuestionMark = () => { ); }; + +interface TruncatedTextTooltipProps { + text: ReactNode; + maxWidth?: number; +} +export const TruncatedTextTooltip = memo( + ({ text, maxWidth }) => { + return ( +
+ {text}} + > + {text} + +
+ ); + }, +); +TruncatedTextTooltip.displayName = "TruncatedTextTooltip";