|
1 | 1 | import { ChevronDownIcon, ChevronUpDownIcon, ChevronUpIcon } from "@heroicons/react/20/solid"; |
2 | 2 | import type { OutputColumnMetadata } from "@internal/clickhouse"; |
3 | | -import { IconFilter2, IconFilter2X } from "@tabler/icons-react"; |
| 3 | +import { IconFilter2, IconFilter2X, IconTable } from "@tabler/icons-react"; |
| 4 | +import { ChartBlankState } from "../primitives/charts/ChartBlankState"; |
4 | 5 | import { rankItem } from "@tanstack/match-sorter-utils"; |
5 | 6 | import { |
6 | 7 | flexRender, |
@@ -37,7 +38,7 @@ import { useProject } from "~/hooks/useProject"; |
37 | 38 | import { cn } from "~/utils/cn"; |
38 | 39 | import { formatCurrencyAccurate, formatNumber } from "~/utils/numberFormatter"; |
39 | 40 | import { v3ProjectPath, v3RunPathFromFriendlyId } from "~/utils/pathBuilder"; |
40 | | -import { Paragraph } from "../primitives/Paragraph"; |
| 41 | + |
41 | 42 | import { TextLink } from "../primitives/TextLink"; |
42 | 43 | import { InfoIconTooltip, SimpleTooltip } from "../primitives/Tooltip"; |
43 | 44 | import { QueueName } from "../runs/v3/QueueName"; |
@@ -848,7 +849,7 @@ function HeaderCellContent({ |
848 | 849 | }} |
849 | 850 | onMouseEnter={() => setIsFilterHovered(true)} |
850 | 851 | onMouseLeave={() => setIsFilterHovered(false)} |
851 | | - className="flex-shrink-0 rounded text-text-dimmed transition-colors hover:text-text-bright focus-custom" |
| 852 | + className="flex-shrink-0 rounded text-text-dimmed transition-colors focus-custom hover:text-text-bright" |
852 | 853 | title="Toggle column filters" |
853 | 854 | > |
854 | 855 | {showFilters ? <IconFilter2X className="size-4" /> : <IconFilter2 className="size-4" />} |
@@ -978,97 +979,7 @@ export const TSQLResultsTable = memo(function TSQLResultsTable({ |
978 | 979 |
|
979 | 980 | // Empty state |
980 | 981 | if (rows.length === 0) { |
981 | | - return ( |
982 | | - <div |
983 | | - className="h-full min-h-0 w-full overflow-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600" |
984 | | - style={{ position: "relative" }} |
985 | | - > |
986 | | - <table style={{ display: "grid" }}> |
987 | | - <thead |
988 | | - className="border-t border-grid-bright bg-background-bright" |
989 | | - style={{ |
990 | | - display: "grid", |
991 | | - position: "sticky", |
992 | | - top: 0, |
993 | | - zIndex: 1, |
994 | | - }} |
995 | | - > |
996 | | - {table.getHeaderGroups().map((headerGroup) => ( |
997 | | - <tr key={headerGroup.id} style={{ display: "flex", width: "100%" }}> |
998 | | - {headerGroup.headers.map((header) => { |
999 | | - const meta = header.column.columnDef.meta as ColumnMeta | undefined; |
1000 | | - return ( |
1001 | | - <th |
1002 | | - key={header.id} |
1003 | | - className="group/header relative" |
1004 | | - style={{ |
1005 | | - display: "flex", |
1006 | | - width: header.getSize(), |
1007 | | - }} |
1008 | | - > |
1009 | | - <HeaderCellContent |
1010 | | - alignment={meta?.alignment ?? "left"} |
1011 | | - tooltip={meta?.outputColumn.description} |
1012 | | - onFilterClick={() => { |
1013 | | - if (!showFilters) { |
1014 | | - setFocusFilterColumn(header.id); |
1015 | | - } else { |
1016 | | - setColumnFilters([]); |
1017 | | - } |
1018 | | - setShowFilters(!showFilters); |
1019 | | - }} |
1020 | | - showFilters={showFilters} |
1021 | | - hasActiveFilter={!!header.column.getFilterValue()} |
1022 | | - sortDirection={header.column.getIsSorted()} |
1023 | | - onSortClick={header.column.getToggleSortingHandler()} |
1024 | | - canSort={header.column.getCanSort()} |
1025 | | - > |
1026 | | - {flexRender(header.column.columnDef.header, header.getContext())} |
1027 | | - </HeaderCellContent> |
1028 | | - {/* Column resizer */} |
1029 | | - <div |
1030 | | - onDoubleClick={() => header.column.resetSize()} |
1031 | | - onMouseDown={header.getResizeHandler()} |
1032 | | - onTouchStart={header.getResizeHandler()} |
1033 | | - className={cn( |
1034 | | - "absolute right-0 top-0 h-full w-0.5 cursor-col-resize touch-none select-none", |
1035 | | - "opacity-0 group-hover/header:opacity-100", |
1036 | | - "bg-charcoal-600 hover:bg-indigo-500", |
1037 | | - header.column.getIsResizing() && "bg-indigo-500 opacity-100" |
1038 | | - )} |
1039 | | - /> |
1040 | | - </th> |
1041 | | - ); |
1042 | | - })} |
1043 | | - </tr> |
1044 | | - ))} |
1045 | | - {/* Filter row - shown when filters are toggled */} |
1046 | | - {showFilters && ( |
1047 | | - <tr style={{ display: "flex", width: "100%" }}> |
1048 | | - {table.getHeaderGroups()[0]?.headers.map((header) => ( |
1049 | | - <FilterCell |
1050 | | - key={`filter-${header.id}`} |
1051 | | - column={header.column} |
1052 | | - width={header.getSize()} |
1053 | | - shouldFocus={focusFilterColumn === header.id} |
1054 | | - onFocused={() => setFocusFilterColumn(null)} |
1055 | | - /> |
1056 | | - ))} |
1057 | | - </tr> |
1058 | | - )} |
1059 | | - </thead> |
1060 | | - <tbody className="border-b border-grid-bright" style={{ display: "grid" }}> |
1061 | | - <tr style={{ display: "flex" }}> |
1062 | | - <td> |
1063 | | - <Paragraph variant="extra-small" className="p-4 text-text-dimmed"> |
1064 | | - No results |
1065 | | - </Paragraph> |
1066 | | - </td> |
1067 | | - </tr> |
1068 | | - </tbody> |
1069 | | - </table> |
1070 | | - </div> |
1071 | | - ); |
| 982 | + return <ChartBlankState icon={IconTable} message="No data to display" />; |
1072 | 983 | } |
1073 | 984 |
|
1074 | 985 | return ( |
|
0 commit comments