The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(studio): PageSectionSummary alignment (#42019)
Danny White60dfcc00eac9
diff --git a/apps/design-system/README.md b/apps/design-system/README.mdindex f7d0347f0b5..06296fb3f4b 100644--- a/apps/design-system/README.md+++ b/apps/design-system/README.md@@ -60,9 +60,9 @@ With that out of the way, there are several parts of this design system that nee- `config/docs.ts`: list of components in the sidebar- `content/docs`: the actual component documentation- `registry/examples.ts`: list of example components-- `registry/default/example`: the actual example components-- `registry/charts.ts`: chart components-- `registry/fragments.ts`: fragment components+- `registry/fragments.ts`: list of fragment components+- `registry/charts.ts`: list of chart components+- `registry/default/example/*`: the actual example componentsYou will probably need to rebuild the design system’s registry after making new additions. You can do that via:diff --git a/apps/design-system/__registry__/default/block/chart-composed-basic.tsx b/apps/design-system/__registry__/default/block/chart-composed-basic.tsxindex 99778d63f43..d9457c3d308 100644--- a/apps/design-system/__registry__/default/block/chart-composed-basic.tsx+++ b/apps/design-system/__registry__/default/block/chart-composed-basic.tsx@@ -28,16 +28,38 @@ export default function ComposedChartBasic() {},]- const data = Array.from({ length: 46 }, (_, i) => {+ const data = Array.from({ length: 40 }, (_, i) => {const date = new Date()- date.setMinutes(date.getMinutes() - i * 5) // Each point 5 minutes apart+ date.setMinutes(date.getMinutes() - i * 3) // Each point 3 minutes apart++ const progress = i / 40+ const standard_score = Math.floor(55 + progress * 55 + (Math.random() - 0.5) * 12)+ const performance = Math.floor(35 + progress * 35 + (Math.random() - 0.5) * 10)+ const efficiency = Math.floor(25 + progress * 25 + (Math.random() - 0.5) * 12)return {timestamp: date.toISOString(),- standard_score: Math.floor(Math.random() * 100),+ standard_score: Math.max(0, Math.min(100, standard_score)),+ performance: Math.max(0, Math.min(100, performance)),+ efficiency: Math.max(0, Math.min(100, efficiency)),}}).reverse()+ const chartConfig = {+ standard_score: {+ label: 'Standard Score',+ color: 'hsl(var(--brand-default))',+ },+ performance: {+ label: 'Performance',+ color: 'hsl(var(--chart-2))',+ },+ efficiency: {+ label: 'Efficiency',+ color: 'hsl(var(--chart-5))',+ },+ }+useEffect(() => {setTimeout(() => {setIsLoading(false)@@ -50,10 +72,8 @@ export default function ComposedChartBasic() {<ChartCard><ChartHeader><ChartTitle tooltip="This is a tooltip">Standard Bar Chart</ChartTitle>-<ChartActions actions={actions} /></ChartHeader>-<ChartContentisEmpty={data.length === 0}emptyState={@@ -86,10 +106,8 @@ export default function ComposedChartBasic() {<ChartCard><ChartHeader><ChartTitle tooltip="This is a tooltip">Standard Line Chart</ChartTitle>-<ChartActions actions={actions} /></ChartHeader>-<ChartContentisEmpty={data.length === 0}emptyState={@@ -105,6 +123,8 @@ export default function ComposedChartBasic() {<ChartLinedata={data}dataKey="standard_score"+ dataKeys={['standard_score', 'performance', 'efficiency']}+ config={chartConfig}showGrid={true}showYAxis={true}YAxisProps={{diff --git a/apps/design-system/__registry__/index.tsx b/apps/design-system/__registry__/index.tsxindex b88ab4709bb..fc94395ea85 100644--- a/apps/design-system/__registry__/index.tsx+++ b/apps/design-system/__registry__/index.tsx@@ -159,17 +159,6 @@ export const Index: Record<string, any> = {subcategory: "undefined",chunks: []},- "aspect-ratio-demo": {- name: "aspect-ratio-demo",- type: "components:example",- registryDependencies: ["aspect-ratio"],- component: React.lazy(() => import("@/registry/default/example/aspect-ratio-demo")),- source: "",- files: ["registry/default/example/aspect-ratio-demo.tsx"],- category: "undefined",- subcategory: "undefined",- chunks: []- },"alert-dialog-destructive": {name: "alert-dialog-destructive",type: "components:example",@@ -192,6 +181,17 @@ export const Index: Record<string, any> = {subcategory: "undefined",chunks: []},+ "aspect-ratio-demo": {+ name: "aspect-ratio-demo",+ type: "components:example",+ registryDependencies: ["aspect-ratio"],+ component: React.lazy(() => import("@/registry/default/example/aspect-ratio-demo")),+ source: "",+ files: ["registry/default/example/aspect-ratio-demo.tsx"],+ category: "undefined",+ subcategory: "undefined",+ chunks: []+ },"avatar-demo": {name: "avatar-demo",type: "components:example",@@ -2238,6 +2238,17 @@ export const Index: Record<string, any> = {subcategory: "undefined",chunks: []},+ "page-section-title-only": {+ name: "page-section-title-only",+ type: "components:example",+ registryDependencies: undefined,+ component: React.lazy(() => import("@/registry/default/example/page-section-title-only")),+ source: "",+ files: ["registry/default/example/page-section-title-only.tsx"],+ category: "undefined",+ subcategory: "undefined",+ chunks: []+ },"page-section-with-aside": {name: "page-section-with-aside",type: "components:example",diff --git a/apps/design-system/content/docs/fragments/page-section.mdx b/apps/design-system/content/docs/fragments/page-section.mdxindex bc70b83723a..997276759a0 100644--- a/apps/design-system/content/docs/fragments/page-section.mdx+++ b/apps/design-system/content/docs/fragments/page-section.mdx@@ -14,11 +14,11 @@ fragment: true## Sub-components- `PageSection` - Root container with orientation variants (`horizontal` or `vertical`)-- `PageSectionMeta` - Meta wrapper for summary and aside (groups summary and aside together)-- `PageSectionSummary` - Container for section title and description (should be inside PageSectionMeta, has `flex-1`)+- `PageSectionMeta` - Meta wrapper for `PageSectionSummary` and optional `PageSectionAside`+- `PageSectionSummary` - Container for section title and description (should be inside `PageSectionMeta`, has `flex-1`)- `PageSectionTitle` - Section heading (h2)- `PageSectionDescription` - Supporting text below section title-- `PageSectionAside` - Container for section-level actions (should be inside PageSectionMeta, has `shrink-0`)+- `PageSectionAside` - Container for section-level actions (should be inside `PageSectionMeta`, has `shrink-0`)- `PageSectionContent` - Container for the main section content## Orientation Variants@@ -45,3 +45,12 @@ fragment: truepeekCodewide/>++### Without Aside++<ComponentPreview+ name="page-section-title-only"+ description="PageSection with title only"+ peekCode+ wide+/>diff --git a/apps/design-system/registry/default/example/page-section-title-only.tsx b/apps/design-system/registry/default/example/page-section-title-only.tsxnew file mode 100644index 00000000000..93e26b659e8--- /dev/null+++ b/apps/design-system/registry/default/example/page-section-title-only.tsx@@ -0,0 +1,32 @@+import { Card, CardContent } from 'ui'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'++export default function PageSectionTitleOnly() {+ return (+ <div className="w-full">+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Section Title</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Card>+ <CardContent className="p-6">+ <p className="text-sm text-foreground-light">+ PageSectionSummary should still be wrapped in PageSectionMeta, as the latter is a+ flex container that will allow the former to span its full width.+ </p>+ </CardContent>+ </Card>+ </PageSectionContent>+ </PageSection>+ </div>+ )+}diff --git a/apps/design-system/registry/examples.ts b/apps/design-system/registry/examples.tsindex 699d249b682..ad110f54fd0 100644--- a/apps/design-system/registry/examples.ts+++ b/apps/design-system/registry/examples.ts@@ -1263,6 +1263,11 @@ export const examples: Registry = [type: 'components:example',files: ['example/page-section-horizontal.tsx'],},+ {+ name: 'page-section-title-only',+ type: 'components:example',+ files: ['example/page-section-title-only.tsx'],+ },{name: 'page-section-with-aside',type: 'components:example',diff --git a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsxindex ac54e140449..f88fa07ce42 100644--- a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx+++ b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx@@ -50,6 +50,7 @@ import { PageContainer } from 'ui-patterns/PageContainer'import {PageSection,PageSectionContent,+ PageSectionMeta,PageSectionSummary,PageSectionTitle,} from 'ui-patterns/PageSection'@@ -175,7 +176,11 @@ export const EdgeFunctionDetails = () => {<PageSectionTitle>Details</PageSectionTitle>{isLoading && <GenericSkeletonLoader />}{isError && (- <AlertError error={error} subject="Failed to retrieve edge function details" />+ <AlertError+ error={error}+ subject="Failed to retrieve edge function details"+ layout="vertical"+ />)}{isSuccess && (<dl className="grid grid-cols-1 @xl:grid-cols-[auto_1fr] gap-y-2 [&>dd]:mb-3 @xl:[&>dd]:mb-0 @xl:gap-y-4 gap-x-10">@@ -244,9 +249,11 @@ export const EdgeFunctionDetails = () => {</PageSectionSummary><PageSectionContent><PageSection className="pt-0">- <PageSectionSummary>- <PageSectionTitle>Function Configuration</PageSectionTitle>- </PageSectionSummary>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Function configuration</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta><PageSectionContent><Form_Shadcn_ {...form}><form onSubmit={form.handleSubmit(onUpdateFunction)}>@@ -326,9 +333,11 @@ export const EdgeFunctionDetails = () => {</PageSection><PageSection>- <PageSectionSummary>- <PageSectionTitle>Invoke function</PageSectionTitle>- </PageSectionSummary>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Invoke function</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta><PageSectionContent><Card><CardContent className="px-0">@@ -394,9 +403,11 @@ export const EdgeFunctionDetails = () => {</PageSection><PageSection>- <PageSectionSummary>- <PageSectionTitle>Develop locally</PageSectionTitle>- </PageSectionSummary>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Develop locally</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta><PageSectionContent><div className="rounded border bg-surface-100 px-6 py-4 drop-shadow-sm"><div className="space-y-6">@@ -422,9 +433,11 @@ export const EdgeFunctionDetails = () => {</PageSectionContent></PageSection><PageSection>- <PageSectionSummary>- <PageSectionTitle>Delete function</PageSectionTitle>- </PageSectionSummary>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Delete function</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta><PageSectionContent><Alert_Shadcn_ variant="destructive"><CriticalIcon />diff --git a/packages/ui-patterns/src/PageSection/index.tsx b/packages/ui-patterns/src/PageSection/index.tsxindex 47f24c6f29d..46d9ce4bcc1 100644--- a/packages/ui-patterns/src/PageSection/index.tsx+++ b/packages/ui-patterns/src/PageSection/index.tsx@@ -66,12 +66,7 @@ const PageSectionSummary = ({ className, children, ...props }: PageSectionSummarreturn (<divdata-slot="page-section-summary"- className={cn(- 'flex flex-col gap-1',- // Center alignment with PageSection Aside in case no PageSectionDescription present- '@xl:self-center',- className- )}+ className={cn('flex flex-col gap-1', className)}{...props}>{children}@@ -176,6 +171,8 @@ const PageSectionMeta = ({ className, children, ...props }: PageSectionMetaPropsclassName={cn('flex flex-col @xl:flex-row @xl:justify-between @xl:items-center gap-4','[&>[data-slot="page-section-summary"]]:flex-1',+ // Center alignment with PageSectionAside in case no PageSectionDescription present+ '[&>[data-slot="page-section-summary"]]:@xl:self-center','[&>[data-slot="page-section-aside"]]:shrink-0',className)}