Files
supabase/apps/studio/components/ui/APIDocsButton.tsx
T
Ivan VasilovandJoshen Lim 75644f8396 chore: Bump react-data-grid to fix a Sentry issue (#42934)
This pull request updates the `react-data-grid` dependency and refactors
code throughout the codebase to use the new import structure and updated
APIs. The changes improve compatibility with the latest version of
`react-data-grid`, simplify imports, and update row selection logic to
match new hook signatures. Additionally, some code is reorganized to use
absolute imports for internal components.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-02-20 14:10:13 +01:00

50 lines
1.3 KiB
TypeScript

import { useParams } from 'common'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
import { BookOpenText } from 'lucide-react'
import { useAppStateSnapshot } from 'state/app-state'
import { ButtonTooltip } from './ButtonTooltip'
interface APIDocsButtonProps {
section?: string[]
source: string
}
export const APIDocsButton = ({ section, source }: APIDocsButtonProps) => {
const snap = useAppStateSnapshot()
const { ref } = useParams()
const { data: org } = useSelectedOrganizationQuery()
const { mutate: sendEvent } = useSendEventMutation()
return (
<ButtonTooltip
size="tiny"
type="default"
onClick={() => {
if (section) snap.setActiveDocsSection(section)
snap.setShowProjectApiDocs(true)
sendEvent({
action: 'api_docs_opened',
properties: {
source,
},
groups: {
project: ref ?? 'Unknown',
organization: org?.slug ?? 'Unknown',
},
})
}}
icon={<BookOpenText />}
className="w-7"
tooltip={{
content: {
side: 'bottom',
text: 'API Docs',
},
}}
/>
)
}