Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Adjust vertical space for explorer notebook query cells (#50169)

Joshen Lim246bd9acbfdc
diff --git a/apps/studio/components/interfaces/Explorer/QueryCell/index.tsx b/apps/studio/components/interfaces/Explorer/QueryCell/index.tsx
index 73df59b8315..8dd4120afe2 100644
--- a/apps/studio/components/interfaces/Explorer/QueryCell/index.tsx
+++ b/apps/studio/components/interfaces/Explorer/QueryCell/index.tsx
@@ -120,6 +120,7 @@ export const QueryCell = forwardRef<QueryEditorHandle, QueryCellProps>(function
ref={ref}
id={cell._id}
variant="embedded"
+ className="min-h-0"
title={title}
query={toQueryModel(cell, sql)}
result={result}
diff --git a/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultChart.tsx b/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultChart.tsx
index acfb7cd7e94..760b3a994bd 100644
--- a/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultChart.tsx
+++ b/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultChart.tsx
@@ -80,8 +80,7 @@ export const QueryResultChart = ({ chart, result }: QueryResultChartProps) => {
if (!result || (result?.rows && result.rows.length === 0)) {
return (
<NoDataPlaceholder
- isFullHeight
- className="border-0"
+ className="border-0 min-h-0! py-8"
size="normal"
message="No results"
description="Your query returned no rows"
@@ -92,8 +91,7 @@ export const QueryResultChart = ({ chart, result }: QueryResultChartProps) => {
if (!hasConfig) {
return (
<NoDataPlaceholder
- isFullHeight
- className="border-0"
+ className="border-0 min-h-0! py-8"
size="normal"
message="Configure your chart"
description="Select your X and Y axis in the display settings"
diff --git a/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultError.tsx b/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultError.tsx
index 0cfe3be9b24..ed45c4d2466 100644
--- a/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultError.tsx
+++ b/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultError.tsx
@@ -85,7 +85,7 @@ export const QueryResultError = ({
return (
<div className="w-full overflow-y-auto">
- <div className="flex flex-row justify-between items-start py-4 px-6 gap-x-4">
+ <div className="flex flex-row justify-between items-start p-3 gap-x-4">
{isTimeout ? (
<div className="flex flex-col gap-y-1">
<p className="font-mono text-sm tracking-tight">
diff --git a/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultRenderer.tsx b/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultRenderer.tsx
index a389395cd07..fb29b99e92d 100644
--- a/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultRenderer.tsx
+++ b/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultRenderer.tsx
@@ -1,3 +1,5 @@
+import { Play } from 'lucide-react'
+
import { type SqlSnippetSource } from '../../SQLEditor/querySource'
import { type QueryResult } from '../types'
import { QueryResultChart } from './QueryResultChart'
@@ -26,7 +28,12 @@ export const QueryResultRenderer = ({
const { rows, error, autoLimit } = result ?? {}
if (!result) {
- return <p className="text-xs text-foreground-lighter py-8">Run the query to see results</p>
+ return (
+ <div className="flex items-center gap-x-2 p-3 w-full">
+ <Play size={12} className="text-foreground-lighter" />
+ <p className="text-xs text-foreground-lighter">Run the query to see results</p>
+ </div>
+ )
}
if (error) {
diff --git a/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx b/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx
index baea5d34660..4aa80d762e2 100644
--- a/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx
+++ b/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx
@@ -189,9 +189,6 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
const rowLimit = query._tag === 'database' ? query.rowLimit : undefined
const databaseIdentifier = query._tag === 'database' ? query.database_identifier : undefined
- const { x_column, y_series } = display?.chart ?? {}
- const hasConfig = !!x_column && (y_series ?? []).length > 0
-
const [promptInput, setPromptInput] = useState('')
const [pendingRun, setPendingRun] = useState<{ sql: string; issues: PotentialIssues }>()
const [pendingProposal, setPendingProposal] = useState<PendingProposal | null>(null)
@@ -392,16 +389,8 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
return () => node.removeEventListener('keydown', handleEscapeKey)
}, [promptState?.isOpen])
- const shouldCenterResults =
- !result?.error && ((result?.rows ?? []).length === 0 || (view === 'chart' && !hasConfig))
-
const queryResults = (
- <ExplorerQueryResults
- className={cn(
- variant === 'embedded' ? 'max-h-80' : 'h-full',
- shouldCenterResults ? 'items-center justify-center' : 'overflow-x-auto'
- )}
- >
+ <ExplorerQueryResults className={cn(variant === 'embedded' ? 'max-h-80' : 'h-full')}>
<QueryResultRenderer
view={view}
result={result}