mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 18:35:07 +03:00
* Demo api side panel * Add docs for storage and edge functions * Add content * fix * Add scroll to logic * Add storage docs * Add docs URLs * Add connecting to project section in getting started * Link back to docs site for product + resource specific docs * Add entry points into API side panel for table editor, auth users and storage * Add entry points into API side panel for edge functions * Beef up feature preview modal with content * Fix asset path * Address several feedback * Addressing more feedback * Shift GraphiQL page to database if new api docs flag enabled * Spelling * Wording changes * Spacing and wording * Fix small issues * Fix * Update key showing toggle button --------- Co-authored-by: Terry Sutton <saltcod@gmail.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { useParams } from 'common'
|
|
|
|
import { useEdgeFunctionsQuery } from 'data/edge-functions/edge-functions-query'
|
|
import { useAppStateSnapshot } from 'state/app-state'
|
|
import { DOCS_RESOURCE_CONTENT } from '../ProjectAPIDocs.constants'
|
|
import ResourceContent from '../ResourceContent'
|
|
import { ContentProps } from './Content.types'
|
|
|
|
const Bucket = ({ language, apikey = 'API_KEY', endpoint }: ContentProps) => {
|
|
const { ref } = useParams()
|
|
const snap = useAppStateSnapshot()
|
|
const { data } = useEdgeFunctionsQuery({ projectRef: ref })
|
|
|
|
const resource = snap.activeDocsSection[1]
|
|
const edgeFunctions = data ?? []
|
|
const edgeFunction = edgeFunctions.find((fn) => fn.name === resource)
|
|
|
|
if (edgeFunction === undefined) return null
|
|
|
|
return (
|
|
<div className="divide-y">
|
|
<div className="space-y-1 px-4 py-6">
|
|
<div className="flex items-center space-x-2">
|
|
<h2 className="text-xl">{edgeFunction.name}</h2>
|
|
</div>
|
|
</div>
|
|
|
|
<ResourceContent
|
|
selectedLanguage={language}
|
|
snippet={DOCS_RESOURCE_CONTENT.invokeEdgeFunction}
|
|
codeSnippets={DOCS_RESOURCE_CONTENT.invokeEdgeFunction.code({
|
|
name: resource,
|
|
endpoint: `${endpoint}`,
|
|
apikey: apikey,
|
|
})}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default Bucket
|