Skip to content

Commit 9d10769

Browse files
committed
Improved the graph layout
1 parent 40d42a6 commit 9d10769

2 files changed

Lines changed: 27 additions & 24 deletions

File tree

apps/webapp/app/components/code/ChartConfigPanel.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export function ChartConfigPanel({ columns, config, onChange, className }: Chart
241241
return (
242242
<div className={cn("flex flex-col gap-2 px-3 py-2", className)}>
243243
{/* Chart Type */}
244-
<div className="flex items-center gap-1">
244+
<div className="flex flex-col gap-3">
245245
<ConfigField label="Type">
246246
<div className="flex items-center">
247247
<Button
@@ -286,7 +286,7 @@ export function ChartConfigPanel({ columns, config, onChange, className }: Chart
286286
</ConfigField>
287287
</div>
288288

289-
<div className="flex flex-wrap items-center gap-3">
289+
<div className="flex flex-col gap-2">
290290
{/* X-Axis */}
291291
<ConfigField label="X-Axis">
292292
<Select
@@ -399,10 +399,9 @@ export function ChartConfigPanel({ columns, config, onChange, className }: Chart
399399

400400
{/* Stacked toggle (only when grouped) */}
401401
{config.groupByColumn && (
402-
<ConfigField label="">
402+
<ConfigField label="Stack groups">
403403
<Switch
404-
variant="small"
405-
label="Stacked"
404+
variant="medium"
406405
checked={config.stacked}
407406
onCheckedChange={(checked) => updateConfig({ stacked: checked })}
408407
/>
@@ -438,7 +437,7 @@ export function ChartConfigPanel({ columns, config, onChange, className }: Chart
438437

439438
{/* Sort Direction (only when sorting) */}
440439
{config.sortByColumn && (
441-
<ConfigField label="">
440+
<ConfigField label="Sort direction">
442441
<SortDirectionToggle
443442
direction={config.sortDirection}
444443
onChange={(direction) => updateConfig({ sortDirection: direction })}
@@ -452,7 +451,7 @@ export function ChartConfigPanel({ columns, config, onChange, className }: Chart
452451

453452
function ConfigField({ label, children }: { label: string; children: React.ReactNode }) {
454453
return (
455-
<div className="flex items-center gap-2">
454+
<div className="flex flex-col gap-1">
456455
{label && <span className="text-xs text-text-dimmed">{label}</span>}
457456
{children}
458457
</div>

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/route.tsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,9 @@ export default function Page() {
457457
<PageTitle title={<AlphaTitle>Query</AlphaTitle>} />
458458
</NavBar>
459459
<PageBody scrollable={false}>
460-
<ResizablePanelGroup orientation="horizontal" className="max-h-full bg-charcoal-800">
461-
<ResizablePanel id="query-main" className="max-h-full">
462-
<div className="grid max-h-full grid-rows-[auto_1fr] overflow-hidden">
460+
<ResizablePanelGroup orientation="horizontal" className="h-full max-h-full bg-charcoal-800">
461+
<ResizablePanel id="query-main" className="h-full">
462+
<div className="grid h-full grid-rows-[auto_1fr] overflow-hidden">
463463
{/* Query editor - isolated component to prevent re-renders */}
464464
<QueryEditorForm
465465
ref={editorRef}
@@ -518,7 +518,7 @@ export default function Page() {
518518
</ClientTabsList>
519519
<ClientTabsContent value="table" className="min-h-0 overflow-y-hidden">
520520
{isLoading ? (
521-
<div className="flex items-center gap-2 p-4 text-text-dimmed">
521+
<div className="flex items-center gap-2 p-4 text-sm text-text-dimmed">
522522
<Spinner className="size-4" />
523523
<span>Executing query...</span>
524524
</div>
@@ -585,24 +585,28 @@ export default function Page() {
585585
</ClientTabsContent>
586586
<ClientTabsContent
587587
value="graph"
588-
className="flex min-h-0 flex-col overflow-hidden"
588+
className="grid min-h-0 grid-rows-[1fr] overflow-hidden"
589589
>
590590
{results?.rows && results?.columns && results.rows.length > 0 ? (
591-
<>
592-
<ChartConfigPanel
593-
columns={results.columns}
594-
config={chartConfig}
595-
onChange={handleChartConfigChange}
596-
className="shrink-0 border-b border-grid-dimmed"
597-
/>
598-
<div className="min-h-0 flex-1 overflow-auto p-3">
599-
<QueryResultsChart
600-
rows={results.rows}
591+
<ResizablePanelGroup className="h-full overflow-hidden">
592+
<ResizablePanel id="chart-results">
593+
<div className="h-full bg-background-dimmed p-3">
594+
<QueryResultsChart
595+
rows={results.rows}
596+
columns={results.columns}
597+
config={chartConfig}
598+
/>
599+
</div>
600+
</ResizablePanel>
601+
<ResizableHandle id="chart-split" />
602+
<ResizablePanel id="chart-config" min="50px" default="200px">
603+
<ChartConfigPanel
601604
columns={results.columns}
602605
config={chartConfig}
606+
onChange={handleChartConfigChange}
603607
/>
604-
</div>
605-
</>
608+
</ResizablePanel>
609+
</ResizablePanelGroup>
606610
) : (
607611
<Paragraph variant="small" className="p-4 text-text-dimmed">
608612
Run a query to visualize results.

0 commit comments

Comments
 (0)