mirror of
https://github.com/supabase/supabase.git
synced 2026-05-11 19:26:38 +08:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
27 lines
967 B
TypeScript
27 lines
967 B
TypeScript
import { useMemo } from 'react'
|
|
|
|
import type { ConnectMode } from './Connect.types'
|
|
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
|
|
|
export function useAvailableConnectModes(): ConnectMode[] {
|
|
const {
|
|
projectConnectionShowAppFrameworks: showAppFrameworks,
|
|
projectConnectionShowMobileFrameworks: showMobileFrameworks,
|
|
projectConnectionShowOrms: showOrms,
|
|
} = useIsFeatureEnabled([
|
|
'project_connection:show_app_frameworks',
|
|
'project_connection:show_mobile_frameworks',
|
|
'project_connection:show_orms',
|
|
])
|
|
|
|
return useMemo(() => {
|
|
const allModes: { id: ConnectMode; enabled: boolean }[] = [
|
|
{ id: 'framework', enabled: showAppFrameworks || showMobileFrameworks },
|
|
{ id: 'direct', enabled: true },
|
|
{ id: 'orm', enabled: showOrms },
|
|
{ id: 'mcp', enabled: true },
|
|
]
|
|
return allModes.filter((m) => m.enabled).map((m) => m.id)
|
|
}, [showAppFrameworks, showMobileFrameworks, showOrms])
|
|
}
|