From 3ef5fa543c48d75ce381b82e519d094d508748c0 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Fri, 19 Dec 2025 13:15:26 +0000 Subject: [PATCH] Make columns right aligned if they're numbers --- .../app/components/code/TSQLResultsTable.tsx | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/apps/webapp/app/components/code/TSQLResultsTable.tsx b/apps/webapp/app/components/code/TSQLResultsTable.tsx index 90cc78f14..085aa9f0a 100644 --- a/apps/webapp/app/components/code/TSQLResultsTable.tsx +++ b/apps/webapp/app/components/code/TSQLResultsTable.tsx @@ -196,6 +196,24 @@ function CellValue({ return {String(value)}; } +/** + * Check if a column should be right-aligned (numeric columns, duration, cost) + */ +function isRightAlignedColumn(column: OutputColumnMetadata): boolean { + // Check for custom render types that display numeric values + if (column.customRenderType === "duration" || column.customRenderType === "cost") { + return true; + } + + // Check for numeric types (excluding UInt8 which is often used for booleans) + const { type } = column; + if (type === "UInt8" || type === "Nullable(UInt8)") { + return false; + } + + return isNumericType(type); +} + export function TSQLResultsTable({ rows, columns, @@ -212,7 +230,10 @@ export function TSQLResultsTable({ {columns.map((col) => ( - + {col.description ? ( ( {columns.map((col) => ( - +