Files
supabase/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/SqlCodeBlock.tsx
Ivan Vasilov 9ac44f5985 feat: Add Third Party Auth settings (#27564)
* Add queries and mutations for third party auth.

* Show the ThirdPartyAuth form in the auth settings.

* Minor fixes to the mutations.

* Add a comment for TODO.

* Add all components for third party auth.

* Minor fixes.

* Update the firebase icons.

* Update the api-types.

* Fix the barrel file imports.

* Make the sheets more intuitive.

* Add a dialog for adding RLS policies for the firebase integration.

* Hide the 3rd party auth section behind a form.

* Fix a type error.

* Update the wording on the Add RLS policy dialog.

* Replace the sheets with dialogs.

* Add fixes for the comments on github.

* Minor fixes.

* Fix a type error.

* Make the delete integration awaitable.
2024-07-25 11:07:09 +02:00

39 lines
941 B
TypeScript

import { format } from 'sql-formatter'
import { CodeBlock, cn } from 'ui'
interface SQLCodeBlockProps {
children: string[]
projectRef: string
}
export const SQLCodeBlock = ({ children }: SQLCodeBlockProps) => {
let formatted = (children || [''])[0]
try {
formatted = format(formatted, {
language: 'postgresql',
keywordCase: 'upper',
})
} catch {}
if (formatted.length === 0) {
return null
}
return (
<pre className="rounded-md relative group">
<CodeBlock
value={formatted}
language="sql"
className={cn(
'!py-3 !px-3.5 prose dark:prose-dark transition max-w-full',
// change the look of the code block. The flex hack is so that the code is wrapping since
// every word is a separate span
'[&>code]:m-0 [&>code>span]:flex [&>code>span]:flex-wrap'
)}
hideCopy
hideLineNumbers
/>
</pre>
)
}