mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 20:05:06 +03:00
## Summary - Removes the "API Docs" navigation item from the sidebar and mobile menu - Removes the `UI_PREVIEW_API_SIDE_PANEL` feature preview flag since the feature is fully rolled out - Makes API docs buttons unconditionally visible across Auth Users, Storage, Edge Functions, and SecondLevelNav ## Test plan - [x] `NavigationBar.utils` tests pass (26 tests) - [x] `FileExplorerHeader` tests pass (6 tests) - [x] TypeScript compiles with no errors - [ ] Verify sidebar no longer shows "API Docs" nav item - [ ] Verify API docs buttons still appear in Auth Users, Storage, and Edge Functions pages - [ ] Verify feature preview modal no longer lists "Project API documentation" Resolves FE-2759 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * APIDocs button can optionally display a label and use a custom tooltip. * **Chores** * Removed the API docs side-panel feature flag and its localStorage key. * “API Docs” navigation entry removed; sidebar no longer special-cases that route. * Back links and API Docs buttons now render consistently across the app (no flag gating). * **Tests** * Tests updated to stop depending on the removed feature-flag behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import { useParams } from 'common'
|
|
import { BookOpenText } from 'lucide-react'
|
|
|
|
import { ButtonTooltip } from './ButtonTooltip'
|
|
import { useSendEventMutation } from '@/data/telemetry/send-event-mutation'
|
|
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
|
|
import { useAppStateSnapshot } from '@/state/app-state'
|
|
|
|
interface APIDocsButtonProps {
|
|
section?: string[]
|
|
source: string
|
|
label?: string
|
|
tooltip?: string
|
|
}
|
|
|
|
export const APIDocsButton = ({ section, source, label, tooltip }: 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={label ? undefined : 'w-7'}
|
|
tooltip={{
|
|
content: {
|
|
side: 'bottom',
|
|
text: tooltip ?? 'API Docs',
|
|
},
|
|
}}
|
|
>
|
|
{label}
|
|
</ButtonTooltip>
|
|
)
|
|
}
|