From 306f4489fd6a8793ea1f300678d581d285c58472 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Fri, 10 Jul 2026 00:25:04 +0200 Subject: [PATCH] fix: hoist TooltipProvider to app root, remove per-component instances --- spa/src/components/time-ago.tsx | 16 +++--- spa/src/components/watch-medium-badge.tsx | 25 ++++----- spa/src/components/watch-medium-picker.tsx | 61 ++++++++++------------ spa/src/routes/__root.tsx | 5 +- 4 files changed, 47 insertions(+), 60 deletions(-) diff --git a/spa/src/components/time-ago.tsx b/spa/src/components/time-ago.tsx index c4b76ec..a60e99d 100644 --- a/spa/src/components/time-ago.tsx +++ b/spa/src/components/time-ago.tsx @@ -1,4 +1,4 @@ -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" +import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip" import { timeAgo, shortDate } from "@/lib/date" type TimeAgoProps = { @@ -8,13 +8,11 @@ type TimeAgoProps = { export function TimeAgo({ date, className }: TimeAgoProps) { return ( - - - - - - {shortDate(date)} - - + + + + + {shortDate(date)} + ) } diff --git a/spa/src/components/watch-medium-badge.tsx b/spa/src/components/watch-medium-badge.tsx index 536664a..3812861 100644 --- a/spa/src/components/watch-medium-badge.tsx +++ b/spa/src/components/watch-medium-badge.tsx @@ -1,11 +1,6 @@ import { useTranslation } from "react-i18next" import { Button } from "@/components/ui/button" -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@/components/ui/tooltip" +import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip" import { cn } from "@/lib/utils" import { WATCH_MEDIUMS } from "@/lib/watch-mediums" @@ -22,15 +17,13 @@ export function WatchMediumBadge({ medium, className }: WatchMediumBadgeProps) { const Icon = entry.icon return ( - - - - - - {t(entry.labelKey)} - - + + + + + {t(entry.labelKey)} + ) } diff --git a/spa/src/components/watch-medium-picker.tsx b/spa/src/components/watch-medium-picker.tsx index 2dfca2b..36575b9 100644 --- a/spa/src/components/watch-medium-picker.tsx +++ b/spa/src/components/watch-medium-picker.tsx @@ -1,11 +1,6 @@ import { useTranslation } from "react-i18next" import { Button } from "@/components/ui/button" -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@/components/ui/tooltip" +import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip" import { cn } from "@/lib/utils" import { WATCH_MEDIUMS } from "@/lib/watch-mediums" @@ -22,34 +17,32 @@ export function WatchMediumPicker({ value, onChange }: WatchMediumPickerProps) {

{t("watchMedium.label")}

- -
- {WATCH_MEDIUMS.map(({ value: val, icon: Icon, labelKey }) => { - const selected = value === val - return ( - - - - - {t(labelKey)} - - ) - })} -
-
+
+ {WATCH_MEDIUMS.map(({ value: val, icon: Icon, labelKey }) => { + const selected = value === val + return ( + + + + + {t(labelKey)} + + ) + })} +
) } diff --git a/spa/src/routes/__root.tsx b/spa/src/routes/__root.tsx index a92050e..ec9ec91 100644 --- a/spa/src/routes/__root.tsx +++ b/spa/src/routes/__root.tsx @@ -1,5 +1,6 @@ import { createRootRoute, Outlet } from "@tanstack/react-router" import { ThemeProvider } from "@/components/theme-provider" +import { TooltipProvider } from "@/components/ui/tooltip" export const Route = createRootRoute({ component: RootLayout, @@ -8,7 +9,9 @@ export const Route = createRootRoute({ function RootLayout() { return ( - + + + ) }