mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
## Context As per PR title - just adjusts the vertical height for a couple of empty states in QueryCells for Notebooks ### Query not run yet | Before | After | | -------- | -------- | | <img width="1072" height="350" alt="image" src="https://github.com/user-attachments/assets/cbf14619-ac01-4082-9732-41737a028c40" /> | <img width="1083" height="313" alt="image" src="https://github.com/user-attachments/assets/1144eebf-7293-4be4-adaf-af2dc21bc40f" /> | | <img width="1083" height="292" alt="image" src="https://github.com/user-attachments/assets/511754f8-5128-41b7-a4c8-542fb93b77e5" /> | <img width="1100" height="163" alt="image" src="https://github.com/user-attachments/assets/53de5b4a-8284-406a-a8ae-4602f61f3ca3" /> | ### Chart empty state | Before | After | | -------- | -------- | | <img width="1079" height="291" alt="image" src="https://github.com/user-attachments/assets/068fe573-1f65-4efc-831c-db2ddda2be1a" /> | <img width="1078" height="225" alt="image" src="https://github.com/user-attachments/assets/b9d58d8f-162d-463d-90e2-fbf3470c6db8" /> | <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Style** - Improved query editor layout by reducing unnecessary spacing and ensuring result areas fit more consistently within available space. - Refined chart empty states with cleaner borders, compact spacing, and improved vertical sizing. - Updated query error presentation with more compact padding. - Simplified result panel sizing for a more consistent viewing experience. - **User Experience** - Added a play icon alongside the “Run the query to see results” prompt when no results are available. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import { Play } from 'lucide-react'
|
|
|
|
import { type SqlSnippetSource } from '../../SQLEditor/querySource'
|
|
import { type QueryResult } from '../types'
|
|
import { QueryResultChart } from './QueryResultChart'
|
|
import { QueryResultError } from './QueryResultError'
|
|
import { DataGridResults } from '@/components/ui/DataGridResults'
|
|
import { type ChartConfig } from '@/data/content/notebooks/notebook-schema'
|
|
|
|
interface QueryResultRendererProps {
|
|
result?: QueryResult
|
|
view?: 'table' | 'chart'
|
|
chart?: ChartConfig
|
|
/** The query that produced `result`, used to build the "Debug with Assistant" prompt on error. */
|
|
sql?: string
|
|
source?: SqlSnippetSource
|
|
onDebug?: (prompt: string) => void
|
|
}
|
|
|
|
export const QueryResultRenderer = ({
|
|
result,
|
|
view,
|
|
chart,
|
|
sql,
|
|
source,
|
|
onDebug,
|
|
}: QueryResultRendererProps) => {
|
|
const { rows, error, autoLimit } = result ?? {}
|
|
|
|
if (!result) {
|
|
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) {
|
|
return (
|
|
<QueryResultError
|
|
error={error}
|
|
autoLimit={autoLimit}
|
|
sql={sql}
|
|
source={source}
|
|
onDebug={onDebug}
|
|
/>
|
|
)
|
|
}
|
|
|
|
if ((rows ?? []).length === 0) {
|
|
return <p className="text-xs text-foreground-lighter py-8">Success. No rows returned</p>
|
|
}
|
|
|
|
if (rows && rows.length > 0) {
|
|
if (view === 'table') return <DataGridResults rows={rows} />
|
|
if (view === 'chart') return <QueryResultChart chart={chart} result={result} />
|
|
}
|
|
|
|
return null
|
|
}
|