Fix text overlapping in PublicSchemaNotEnabledAlert (#33473)

* Fix text overlapping in PublicSchemaNotEnabledAlert

* Update

* Smol fix
This commit is contained in:
Joshen Lim authored and GitHub committed 2025-02-10 16:03:35 +08:00
1 parent fecb0808fc
commit ceed8bf792
4 files changed
+27 -34

No files matched your search

@@ -172,7 +172,7 @@ export const SchemaGraph = () => {
deletable: false,
style: {
stroke: 'hsl(var(--border-stronger))',
strokeWidth: 0.5,
strokeWidth: 1,
},
}}
nodeTypes={nodeTypes}
@@ -15,7 +15,7 @@ export default function Introduction({ selectedLang }: Props) {
const { ref: projectRef } = useParams()
const { data: settings } = useProjectSettingsV2Query({ projectRef })
const { data: config } = useProjectPostgrestConfigQuery({ projectRef })
const { data: config, isSuccess } = useProjectPostgrestConfigQuery({ projectRef })
const protocol = settings?.app_config?.protocol ?? 'https'
const hostEndpoint = settings?.app_config?.endpoint
@@ -42,9 +42,9 @@ export default function Introduction({ selectedLang }: Props) {
the easiest way to interact with everything we offer within the Supabase ecosystem.
</p>
</article>
<article className="code">
<article className="code flex flex-col gap-y-2">
<CodeSnippet selectedLang={selectedLang} snippet={Snippets.init(endpoint)} />
{!isPublicSchemaEnabled && <PublicSchemaNotEnabledAlert />}
{isSuccess && !isPublicSchemaEnabled && <PublicSchemaNotEnabledAlert />}
</article>
</div>
</>
@@ -13,7 +13,7 @@ interface IntroductionProps {
const Introduction = ({ selectedLang }: IntroductionProps) => {
const { ref: projectRef } = useParams()
const { data: config } = useProjectPostgrestConfigQuery({ projectRef })
const { data: config, isSuccess } = useProjectPostgrestConfigQuery({ projectRef })
const isPublicSchemaEnabled = config?.db_schema
.split(',')
@@ -24,13 +24,14 @@ const Introduction = ({ selectedLang }: IntroductionProps) => {
<>
<h2 className="doc-heading">Introduction</h2>
<div className="doc-section">
<article className="code-column text-foreground">
<article className="code-column text-foreground flex flex-col gap-y-2">
<p>
All views and tables in the <code>public</code> schema and accessible by the active
database role for a request are available for querying.
</p>
{!isPublicSchemaEnabled && <PublicSchemaNotEnabledAlert />}
</article>
<article className="code">
{isSuccess && !isPublicSchemaEnabled && <PublicSchemaNotEnabledAlert />}
</article>
</div>
@@ -1,36 +1,28 @@
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button } from 'ui'
import { Info } from 'lucide-react'
import ReactMarkdown from 'react-markdown'
import Link from 'next/link'
import { useParams } from 'common'
import { Button } from 'ui'
import { Admonition } from 'ui-patterns'
const PublicSchemaNotEnabledAlert = () => {
const { ref: projectRef } = useParams()
return (
<Alert_Shadcn_ variant="default">
<Info className="h-4 w-4" />
<AlertTitle_Shadcn_ className="!-mt-4">
<ReactMarkdown>The `public` schema for this project is not exposed</ReactMarkdown>
</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_ className="grid gap-3 !-mt-7">
<ReactMarkdown>
You will not be able to query tables and views in the `public` schema via supabase-js or
HTTP clients.
</ReactMarkdown>
<div className="!-mt-4 inline-block">
<Button asChild type="default">
<Link
href={`/project/${projectRef}/settings/api#postgrest-config`}
className="!no-underline !hover:bg-surface-100 !text-foreground"
>
View schema settings
</Link>
</Button>
</div>
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
<Admonition type="default">
<p className="!mt-0 !mb-1.5">The public schema for this project is not exposed</p>
<p className="!mt-0 !mb-1.5 text-foreground-light">
You will not be able to query tables and views in the public schema via supabase-js or HTTP
clients. Configure this behavior in your project's Data API settings.
</p>
<Button asChild type="default" className="mt-1">
<Link
href={`/project/${projectRef}/settings/api#postgrest-config`}
className="!no-underline"
>
View API settings
</Link>
</Button>
</Admonition>
)
}