Files
Drew McLellan 6019742b8c chore(studio): remove local-only header events (#54535)
## Problem

Part of FE-5266 (remove or sample noisy Studio events).
`header_local_dropdown_opened` and `header_local_version_popover_opened`
only render in local Studio, which never sends telemetry, so they can
never fire. Their owner signed off on removing them.

## Solution

- Remove the `track()` calls from `LocalDropdown` and
`LocalVersionPopover`, along with the `useTrack` imports and the empty
`onOpenChange` wrappers they left behind.
- Remove the two event types and their `TelemetryEvent` union entries.

There is no runtime change. This is a standalone PR so it can be
reverted on its own. The catalog deletion sits next to the one in
#54533, so whichever merges second may need a trivial rebase.
2026-12-03 14:37:55 +00:00

95 lines
3.2 KiB
TypeScript

import { Link, useLocation } from '@tanstack/react-router'
import { FlaskConicalIcon, SettingsIcon } from 'lucide-react'
import { useTheme } from 'next-themes'
import {
cn,
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
singleThemes,
} from 'ui'
import { ButtonTooltip } from '../ui/ButtonTooltip'
import { useFeaturePreviewModal } from './App/FeaturePreview/FeaturePreviewContext'
import { DevToolbarMenuGroup } from './DevToolbarMenuGroup'
import { ProfileImage } from '@/components/ui/ProfileImage'
import { useAppStateSnapshot } from '@/state/app-state'
export const LocalDropdown = ({
triggerClassName,
contentClassName,
}: {
triggerClassName?: string
contentClassName?: string
}) => {
const pathname = useLocation({ select: (location) => location.pathname })
const currentRoute = useLocation({ select: (location) => location.href })
const { theme, setTheme } = useTheme()
const appStateSnapshot = useAppStateSnapshot()
const { toggleFeaturePreviewModal } = useFeaturePreviewModal()
return (
<DropdownMenu>
<DropdownMenuTrigger className={cn('border shrink-0 px-3', triggerClassName)} asChild>
<ButtonTooltip
className="[&>span]:flex px-0 py-0 rounded-full overflow-hidden h-8 w-8"
tooltip={{ content: { text: 'Settings' } }}
>
<ProfileImage className="w-8 h-8 rounded-md" />
<span className="sr-only">Settings</span>
</ButtonTooltip>
</DropdownMenuTrigger>
<DropdownMenuContent side="bottom" align="end" className={cn('w-44', contentClassName)}>
<DropdownMenuItem className="flex gap-2 cursor-pointer" asChild>
<Link
to="/account/me"
onClick={() => {
if (pathname !== '/account/me') {
appStateSnapshot.setLastRouteBeforeVisitingAccountPage(currentRoute)
}
}}
>
<SettingsIcon size={14} strokeWidth={1.5} className="text-foreground-lighter" />
Preferences
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="flex gap-2 cursor-pointer"
onClick={() => toggleFeaturePreviewModal(true)}
onSelect={() => toggleFeaturePreviewModal(true)}
>
<FlaskConicalIcon size={14} strokeWidth={1.5} className="text-foreground-lighter" />
Feature previews
</DropdownMenuItem>
<DropdownMenuSeparator />
<DevToolbarMenuGroup />
<DropdownMenuGroup>
<DropdownMenuLabel>Theme</DropdownMenuLabel>
<DropdownMenuRadioGroup
value={theme}
onValueChange={(value) => {
setTheme(value)
}}
>
{singleThemes.map((theme) => (
<DropdownMenuRadioItem
key={theme.value}
value={theme.value}
className="cursor-pointer"
>
{theme.name}
</DropdownMenuRadioItem>
))}
</DropdownMenuRadioGroup>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
)
}