mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 05:09:12 +03:00
This PR preps the monorepo for a migration to Tailwind v4: - Bump all Tailwind dependencies and libraries to the latest possible version, while still compatible with Tailwind 3. - Cleans up obsolete Tailwind 3 specific options and configs. - Cleans up unused CSS files and fixes the CSS imports. - Migrates all `important` uses in `@apply` lines to using the `!` prefix. - Move `typography.css` to the `config` package and import it from the apps. - Migrated all occurrences of `flex-grow`, `flex-shrink`, `overflow-clip` and `overflow-ellipsis` since they're deprecated and will be removed in Tailwind 4. - Make the default theme object typesafe in the `ui` package. - Migrate all `bg-opacity`, `border-opacity`, `ring-opacity` and `divider-opacity` to the new format where they're declared as part of the property color. - Bump and unify all imports of `postcss` dependency.
38 lines
1.5 KiB
TypeScript
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-[8rem] 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>
|
|
)
|
|
}
|