mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 20:05:06 +03:00
## Problem The `_Shadcn_` suffix isn't needed anymore on label component ## Solution Remove it. No other changes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Standardized Label usage across the codebase by removing the legacy alias and using the direct Label export from the UI package consistently. * **Documentation** * Updated component examples and docs to use the standardized Label component in usage snippets and demos. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45986) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
60 lines
2.2 KiB
TypeScript
60 lines
2.2 KiB
TypeScript
import { Settings } from 'lucide-react'
|
|
import { useState } from 'react'
|
|
import { cn, DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, Label, Switch } from 'ui'
|
|
|
|
import { useChartHoverState } from './useChartHoverState'
|
|
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
|
|
|
|
interface ReportSettingsProps {
|
|
chartId: string
|
|
}
|
|
|
|
export const ReportSettings = ({ chartId }: ReportSettingsProps) => {
|
|
const [isOpen, setIsOpen] = useState(false)
|
|
const { syncHover, syncTooltip, setSyncHover, setSyncTooltip } = useChartHoverState(chartId)
|
|
|
|
return (
|
|
<DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
|
|
<DropdownMenuTrigger asChild>
|
|
<ButtonTooltip
|
|
type="default"
|
|
icon={<Settings />}
|
|
className="w-7"
|
|
tooltip={{ content: { side: 'bottom', text: 'Report settings' } }}
|
|
/>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="start" side="bottom" className="w-64 p-3">
|
|
<div className="space-y-4">
|
|
<Label htmlFor="sync-hover" className="text-sm font-normal">
|
|
<div className="flex items-center justify-between space-x-2">
|
|
Sync chart headers
|
|
<Switch id="sync-hover" checked={syncHover} onCheckedChange={setSyncHover} />
|
|
</div>
|
|
<p className="text-xs text-foreground-light mt-1">
|
|
When enabled, hovering over any chart will update headers across all charts
|
|
</p>
|
|
</Label>
|
|
|
|
<Label htmlFor="sync-tooltips" className="text-sm font-normal flex flex-col">
|
|
<div className="flex items-center justify-between space-x-2">
|
|
Sync tooltips
|
|
<Switch
|
|
id="sync-tooltips"
|
|
checked={syncTooltip}
|
|
disabled={!syncHover}
|
|
onCheckedChange={setSyncTooltip}
|
|
/>
|
|
</div>
|
|
<p className="text-xs text-foreground-light mt-1">
|
|
When enabled, also shows tooltips on all charts.{' '}
|
|
<span className={cn(syncHover ? 'text-foreground-light' : 'text-foreground')}>
|
|
Requires header sync.
|
|
</span>
|
|
</p>
|
|
</Label>
|
|
</div>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
)
|
|
}
|