Files
supabase/apps/studio/components/interfaces/QueryInsights/QueryInsightsChart/QueryInsightsChartTooltip.tsx
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

38 lines
1.5 KiB
TypeScript

import dayjs from 'dayjs'
import type { TooltipProps } from 'recharts'
import { formatDuration } from '../QueryInsightsTable/QueryInsightsTable.utils'
import { isTimeMetric } from './QueryInsightsChart.utils'
import { guessLocalTimezone } from '@/lib/dayjs'
export const QueryInsightsChartTooltip = ({ active, payload }: TooltipProps<number, string>) => {
if (!active || !payload?.length) return null
const time = payload[0]?.payload?.time
const localTimeZone = guessLocalTimezone()
return (
<div className="grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg px-2.5 py-1.5 text-xs shadow-xl">
<p className="text-foreground-light text-xs">{localTimeZone}</p>
<p className="font-medium">{dayjs(time).format('MMM D, hh:mm:ssa')}</p>
<div className="grid gap-0">
{payload.map((entry, index) => (
<div key={`${entry.name}-${index}`} className="flex items-center w-full">
<svg width="10" height="10" viewBox="0 0 10 10" fill="none">
<circle cx="5" cy="5" r="3" fill={entry.color} />
</svg>
<span className="text-foreground-lighter ml-1 grow">{entry.name}</span>
<span className="ml-3.5">
{typeof entry.value === 'number'
? isTimeMetric(typeof entry.dataKey === 'string' ? entry.dataKey : '')
? formatDuration(entry.value)
: entry.value.toLocaleString()
: entry.value}
</span>
</div>
))}
</div>
</div>
)
}