@quantumwake/terminal-ux-dashboard-components 0.1.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +93 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +95 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -27,6 +27,7 @@ interface DashboardCapabilities {
|
|
|
27
27
|
deleteDashboard?: (id: string) => Promise<void> | void;
|
|
28
28
|
analyzeDataset?: () => Promise<void> | void;
|
|
29
29
|
refineDashboard?: (prompt: string) => Promise<void> | void;
|
|
30
|
+
newDashboard?: () => void;
|
|
30
31
|
addPanel?: (panel: PanelInput) => void;
|
|
31
32
|
removePanel?: (panelId: string) => void;
|
|
32
33
|
}
|
|
@@ -48,6 +49,7 @@ declare function useCapabilities(): {
|
|
|
48
49
|
canDelete: boolean;
|
|
49
50
|
canAnalyze: boolean;
|
|
50
51
|
canRefine: boolean;
|
|
52
|
+
canNew: boolean;
|
|
51
53
|
canAddPanel: boolean;
|
|
52
54
|
canEditPanels: boolean;
|
|
53
55
|
};
|
|
@@ -324,6 +326,9 @@ interface SqlConsoleColumn {
|
|
|
324
326
|
interface SqlConsoleProps {
|
|
325
327
|
columns?: SqlConsoleColumn[];
|
|
326
328
|
stateId?: string;
|
|
329
|
+
defaultColumnsOpen?: boolean;
|
|
330
|
+
defaultSql?: string;
|
|
331
|
+
autoRun?: boolean;
|
|
327
332
|
}
|
|
328
333
|
/**
|
|
329
334
|
* SqlConsole — a HuggingFace-style read-only SQL editor over a state's full
|
|
@@ -331,7 +336,7 @@ interface SqlConsoleProps {
|
|
|
331
336
|
* in the viewer) as a view named `data`; queries run against the entire dataset,
|
|
332
337
|
* not a client sample.
|
|
333
338
|
*/
|
|
334
|
-
declare function SqlConsole({ columns, stateId }: SqlConsoleProps): react.JSX.Element;
|
|
339
|
+
declare function SqlConsole({ columns, stateId, defaultColumnsOpen, defaultSql, autoRun }: SqlConsoleProps): react.JSX.Element;
|
|
335
340
|
|
|
336
341
|
interface PanelConfig {
|
|
337
342
|
sql?: string;
|
|
@@ -455,6 +460,7 @@ interface Dashboard {
|
|
|
455
460
|
panels?: DashboardPanel[];
|
|
456
461
|
[key: string]: unknown;
|
|
457
462
|
}
|
|
463
|
+
type Mode = 'dashboard' | 'builder' | 'sql';
|
|
458
464
|
interface DataExplorerProps {
|
|
459
465
|
/** All records for the active state (viz/builder source). Empty when not loaded. */
|
|
460
466
|
records: Row[];
|
|
@@ -476,11 +482,17 @@ interface DataExplorerProps {
|
|
|
476
482
|
loading?: boolean;
|
|
477
483
|
/** True while the AI is generating/refining the dashboard. */
|
|
478
484
|
analyzing?: boolean;
|
|
485
|
+
/** Initial mode tab. Defaults to 'dashboard'; the published viewer uses 'sql'
|
|
486
|
+
* so the SQL console is the primary surface. Clamped to `tabs`. */
|
|
487
|
+
defaultMode?: Mode;
|
|
488
|
+
/** Which mode tabs to show, in order. Defaults to all three. Pass a subset to
|
|
489
|
+
* turn tabs off (e.g. ['sql'] for a SQL-only explorer). */
|
|
490
|
+
tabs?: Mode[];
|
|
479
491
|
/** Select a state (host fetches its profile/records). */
|
|
480
492
|
onSelectState: (id: string) => void;
|
|
481
493
|
/** Refresh the states catalog. */
|
|
482
494
|
onRefreshStates?: () => void;
|
|
483
495
|
}
|
|
484
|
-
declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
|
|
496
|
+
declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, defaultMode, tabs, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
|
|
485
497
|
|
|
486
498
|
export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, type PanelInput, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, legendConfig, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ interface DashboardCapabilities {
|
|
|
27
27
|
deleteDashboard?: (id: string) => Promise<void> | void;
|
|
28
28
|
analyzeDataset?: () => Promise<void> | void;
|
|
29
29
|
refineDashboard?: (prompt: string) => Promise<void> | void;
|
|
30
|
+
newDashboard?: () => void;
|
|
30
31
|
addPanel?: (panel: PanelInput) => void;
|
|
31
32
|
removePanel?: (panelId: string) => void;
|
|
32
33
|
}
|
|
@@ -48,6 +49,7 @@ declare function useCapabilities(): {
|
|
|
48
49
|
canDelete: boolean;
|
|
49
50
|
canAnalyze: boolean;
|
|
50
51
|
canRefine: boolean;
|
|
52
|
+
canNew: boolean;
|
|
51
53
|
canAddPanel: boolean;
|
|
52
54
|
canEditPanels: boolean;
|
|
53
55
|
};
|
|
@@ -324,6 +326,9 @@ interface SqlConsoleColumn {
|
|
|
324
326
|
interface SqlConsoleProps {
|
|
325
327
|
columns?: SqlConsoleColumn[];
|
|
326
328
|
stateId?: string;
|
|
329
|
+
defaultColumnsOpen?: boolean;
|
|
330
|
+
defaultSql?: string;
|
|
331
|
+
autoRun?: boolean;
|
|
327
332
|
}
|
|
328
333
|
/**
|
|
329
334
|
* SqlConsole — a HuggingFace-style read-only SQL editor over a state's full
|
|
@@ -331,7 +336,7 @@ interface SqlConsoleProps {
|
|
|
331
336
|
* in the viewer) as a view named `data`; queries run against the entire dataset,
|
|
332
337
|
* not a client sample.
|
|
333
338
|
*/
|
|
334
|
-
declare function SqlConsole({ columns, stateId }: SqlConsoleProps): react.JSX.Element;
|
|
339
|
+
declare function SqlConsole({ columns, stateId, defaultColumnsOpen, defaultSql, autoRun }: SqlConsoleProps): react.JSX.Element;
|
|
335
340
|
|
|
336
341
|
interface PanelConfig {
|
|
337
342
|
sql?: string;
|
|
@@ -455,6 +460,7 @@ interface Dashboard {
|
|
|
455
460
|
panels?: DashboardPanel[];
|
|
456
461
|
[key: string]: unknown;
|
|
457
462
|
}
|
|
463
|
+
type Mode = 'dashboard' | 'builder' | 'sql';
|
|
458
464
|
interface DataExplorerProps {
|
|
459
465
|
/** All records for the active state (viz/builder source). Empty when not loaded. */
|
|
460
466
|
records: Row[];
|
|
@@ -476,11 +482,17 @@ interface DataExplorerProps {
|
|
|
476
482
|
loading?: boolean;
|
|
477
483
|
/** True while the AI is generating/refining the dashboard. */
|
|
478
484
|
analyzing?: boolean;
|
|
485
|
+
/** Initial mode tab. Defaults to 'dashboard'; the published viewer uses 'sql'
|
|
486
|
+
* so the SQL console is the primary surface. Clamped to `tabs`. */
|
|
487
|
+
defaultMode?: Mode;
|
|
488
|
+
/** Which mode tabs to show, in order. Defaults to all three. Pass a subset to
|
|
489
|
+
* turn tabs off (e.g. ['sql'] for a SQL-only explorer). */
|
|
490
|
+
tabs?: Mode[];
|
|
479
491
|
/** Select a state (host fetches its profile/records). */
|
|
480
492
|
onSelectState: (id: string) => void;
|
|
481
493
|
/** Refresh the states catalog. */
|
|
482
494
|
onRefreshStates?: () => void;
|
|
483
495
|
}
|
|
484
|
-
declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
|
|
496
|
+
declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, defaultMode, tabs, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
|
|
485
497
|
|
|
486
498
|
export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, type PanelInput, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, legendConfig, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, useContext, useMemo, useState,
|
|
1
|
+
import { createContext, useContext, useMemo, useState, useEffect, useRef, Suspense } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { ResponsiveBar } from '@nivo/bar';
|
|
4
4
|
import { ResponsivePie } from '@nivo/pie';
|
|
@@ -7,7 +7,7 @@ import { ResponsiveScatterPlot } from '@nivo/scatterplot';
|
|
|
7
7
|
import { ResponsiveHeatMap } from '@nivo/heatmap';
|
|
8
8
|
import PivotTableUI from 'react-pivottable/PivotTableUI';
|
|
9
9
|
import 'react-pivottable/pivottable.css';
|
|
10
|
-
import { Loader2, Play, AlertCircle, Rows3, BarChart3, PieChart, TrendingUp, ScatterChart, LayoutGrid, Code,
|
|
10
|
+
import { Loader2, Play, ChevronDown, AlertCircle, Rows3, BarChart3, PieChart, TrendingUp, ScatterChart, LayoutGrid, Code, Sparkles, X, Terminal, RefreshCw, Minimize2, Maximize2, Plus, Save, FolderOpen, Trash2, Filter, Database, Send, GripVertical } from 'lucide-react';
|
|
11
11
|
|
|
12
12
|
// src/context/DashboardContext.tsx
|
|
13
13
|
var DashboardContext = createContext(null);
|
|
@@ -32,6 +32,7 @@ function useCapabilities() {
|
|
|
32
32
|
canDelete: !!c.deleteDashboard,
|
|
33
33
|
canAnalyze: !!c.analyzeDataset,
|
|
34
34
|
canRefine: !!c.refineDashboard,
|
|
35
|
+
canNew: !!c.newDashboard,
|
|
35
36
|
canAddPanel: !!c.addPanel,
|
|
36
37
|
canEditPanels: !!c.removePanel
|
|
37
38
|
};
|
|
@@ -642,18 +643,19 @@ var renderCell = (v) => {
|
|
|
642
643
|
if (typeof v === "boolean") return v ? "true" : "false";
|
|
643
644
|
return String(v);
|
|
644
645
|
};
|
|
645
|
-
function SqlConsole({ columns = [], stateId }) {
|
|
646
|
+
function SqlConsole({ columns = [], stateId, defaultColumnsOpen = false, defaultSql = DEFAULT_SQL, autoRun = false }) {
|
|
646
647
|
const { theme, runQuery } = useDashboard();
|
|
647
|
-
const [sql, setSql] = useState(
|
|
648
|
+
const [sql, setSql] = useState(defaultSql);
|
|
648
649
|
const [result, setResult] = useState(null);
|
|
649
650
|
const [error, setError] = useState(null);
|
|
650
651
|
const [running, setRunning] = useState(false);
|
|
651
|
-
const
|
|
652
|
-
|
|
652
|
+
const [columnsOpen, setColumnsOpen] = useState(defaultColumnsOpen);
|
|
653
|
+
const run = async (text = sql) => {
|
|
654
|
+
if (running || !text.trim()) return;
|
|
653
655
|
setRunning(true);
|
|
654
656
|
setError(null);
|
|
655
657
|
try {
|
|
656
|
-
const data = await runQuery(
|
|
658
|
+
const data = await runQuery(text, stateId);
|
|
657
659
|
setResult({ columns: data.columns || [], rows: data.rows || [] });
|
|
658
660
|
} catch (err) {
|
|
659
661
|
setResult(null);
|
|
@@ -662,6 +664,11 @@ function SqlConsole({ columns = [], stateId }) {
|
|
|
662
664
|
setRunning(false);
|
|
663
665
|
}
|
|
664
666
|
};
|
|
667
|
+
useEffect(() => {
|
|
668
|
+
if (!autoRun || !stateId) return;
|
|
669
|
+
setSql(defaultSql);
|
|
670
|
+
void run(defaultSql);
|
|
671
|
+
}, [stateId, autoRun, defaultSql]);
|
|
665
672
|
const onKeyDown = (e) => {
|
|
666
673
|
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
667
674
|
e.preventDefault();
|
|
@@ -702,19 +709,34 @@ function SqlConsole({ columns = [], stateId }) {
|
|
|
702
709
|
placeholder: "SELECT ... FROM data"
|
|
703
710
|
}
|
|
704
711
|
),
|
|
705
|
-
columns.length > 0 && /* @__PURE__ */
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
712
|
+
columns.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
|
|
713
|
+
/* @__PURE__ */ jsxs(
|
|
714
|
+
"button",
|
|
715
|
+
{
|
|
716
|
+
onClick: () => setColumnsOpen((o) => !o),
|
|
717
|
+
className: "flex items-center gap-1 text-[11px] font-mono text-midnight-text-muted hover:text-midnight-text-body transition-colors",
|
|
718
|
+
children: [
|
|
719
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: `w-3 h-3 transition-transform ${columnsOpen ? "" : "-rotate-90"}` }),
|
|
720
|
+
"Columns (",
|
|
721
|
+
columns.length,
|
|
722
|
+
")"
|
|
723
|
+
]
|
|
724
|
+
}
|
|
725
|
+
),
|
|
726
|
+
columnsOpen && /* @__PURE__ */ jsx("div", { className: "mt-1.5 flex flex-wrap gap-1", children: columns.map((c) => /* @__PURE__ */ jsxs(
|
|
727
|
+
"button",
|
|
728
|
+
{
|
|
729
|
+
title: `Insert ${c.name}`,
|
|
730
|
+
onClick: () => setSql((s) => `${s}${s.endsWith(" ") || s.endsWith("\n") || !s ? "" : " "}${c.name}`),
|
|
731
|
+
className: "px-1.5 py-0.5 border border-midnight-border text-[11px] font-mono text-midnight-text-muted hover:bg-midnight-raised transition-colors",
|
|
732
|
+
children: [
|
|
733
|
+
c.name,
|
|
734
|
+
/* @__PURE__ */ jsx("span", { className: "opacity-50 ml-1", children: c.type })
|
|
735
|
+
]
|
|
736
|
+
},
|
|
737
|
+
c.name
|
|
738
|
+
)) })
|
|
739
|
+
] })
|
|
718
740
|
] }),
|
|
719
741
|
(result || error) && /* @__PURE__ */ jsx("div", { className: `flex items-center gap-4 px-3 py-1.5 border-b ${theme.border} text-xs font-mono shrink-0 ${error ? "text-red-400" : "text-midnight-text-muted"}`, children: error ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
720
742
|
/* @__PURE__ */ jsx(AlertCircle, { className: "w-3.5 h-3.5" }),
|
|
@@ -1605,6 +1627,11 @@ function ModeTab({ active, onClick, icon: Icon, label }) {
|
|
|
1605
1627
|
}
|
|
1606
1628
|
);
|
|
1607
1629
|
}
|
|
1630
|
+
var MODE_TABS = [
|
|
1631
|
+
{ mode: "dashboard", icon: Sparkles, label: "Dashboard" },
|
|
1632
|
+
{ mode: "builder", icon: BarChart3, label: "Chart Builder" },
|
|
1633
|
+
{ mode: "sql", icon: Terminal, label: "SQL" }
|
|
1634
|
+
];
|
|
1608
1635
|
function DataExplorer({
|
|
1609
1636
|
records,
|
|
1610
1637
|
columns,
|
|
@@ -1616,12 +1643,15 @@ function DataExplorer({
|
|
|
1616
1643
|
savedDashboards = [],
|
|
1617
1644
|
loading = false,
|
|
1618
1645
|
analyzing = false,
|
|
1646
|
+
defaultMode = "dashboard",
|
|
1647
|
+
tabs = ["dashboard", "builder", "sql"],
|
|
1619
1648
|
onSelectState,
|
|
1620
1649
|
onRefreshStates
|
|
1621
1650
|
}) {
|
|
1622
|
-
const { theme, addPanel, saveDashboard, listDashboards, searchDashboards, loadDashboard, deleteDashboard, analyzeDataset, refineDashboard } = useDashboard();
|
|
1651
|
+
const { theme, newDashboard, addPanel, saveDashboard, listDashboards, searchDashboards, loadDashboard, deleteDashboard, analyzeDataset, refineDashboard } = useDashboard();
|
|
1623
1652
|
const caps = useCapabilities();
|
|
1624
|
-
const
|
|
1653
|
+
const visibleTabs = MODE_TABS.filter((t) => tabs.includes(t.mode));
|
|
1654
|
+
const [mode, setMode] = useState(tabs.includes(defaultMode) ? defaultMode : tabs[0] ?? "sql");
|
|
1625
1655
|
const [fullscreen, setFullscreen] = useState(false);
|
|
1626
1656
|
const [showSaved, setShowSaved] = useState(false);
|
|
1627
1657
|
const [saveName, setSaveName] = useState("");
|
|
@@ -1686,9 +1716,22 @@ function DataExplorer({
|
|
|
1686
1716
|
)
|
|
1687
1717
|
] }),
|
|
1688
1718
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mb-3 shrink-0", children: [
|
|
1689
|
-
/* @__PURE__ */ jsx(ModeTab, { active: mode ===
|
|
1690
|
-
/* @__PURE__ */
|
|
1691
|
-
|
|
1719
|
+
visibleTabs.map((t) => /* @__PURE__ */ jsx(ModeTab, { active: mode === t.mode, onClick: () => setMode(t.mode), icon: t.icon, label: t.label }, t.mode)),
|
|
1720
|
+
caps.canNew && /* @__PURE__ */ jsxs(
|
|
1721
|
+
"button",
|
|
1722
|
+
{
|
|
1723
|
+
onClick: () => {
|
|
1724
|
+
newDashboard?.();
|
|
1725
|
+
setMode("builder");
|
|
1726
|
+
},
|
|
1727
|
+
title: "Start a new dashboard",
|
|
1728
|
+
className: "flex items-center gap-1 px-2 py-1 text-xs font-mono border border-midnight-border text-midnight-text-muted hover:bg-midnight-raised hover:text-midnight-accent transition-colors",
|
|
1729
|
+
children: [
|
|
1730
|
+
/* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
|
|
1731
|
+
" New Dashboard"
|
|
1732
|
+
]
|
|
1733
|
+
}
|
|
1734
|
+
),
|
|
1692
1735
|
showPersistence && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 ml-auto", children: [
|
|
1693
1736
|
caps.canSave && showSaveInput && /* @__PURE__ */ jsx(
|
|
1694
1737
|
"input",
|
|
@@ -1757,14 +1800,39 @@ function DataExplorer({
|
|
|
1757
1800
|
)
|
|
1758
1801
|
] }, d.id))
|
|
1759
1802
|
] }),
|
|
1760
|
-
/* @__PURE__ */ jsx("div", { className: `border ${theme.border} bg-midnight-surface flex-1 flex flex-col min-h-0`, children: mode === "sql" ? /* @__PURE__ */ jsx(SqlConsole, { columns, stateId: activeStateId ?? void 0 }) : mode === "builder" ? /* @__PURE__ */ jsx(
|
|
1803
|
+
/* @__PURE__ */ jsx("div", { className: `border ${theme.border} bg-midnight-surface flex-1 flex flex-col min-h-0`, children: mode === "sql" ? /* @__PURE__ */ jsx(SqlConsole, { columns, stateId: activeStateId ?? void 0 }) : mode === "builder" ? /* @__PURE__ */ jsx(
|
|
1804
|
+
ChartBuilder,
|
|
1805
|
+
{
|
|
1806
|
+
records,
|
|
1807
|
+
columns,
|
|
1808
|
+
stateId: activeStateId ?? void 0,
|
|
1809
|
+
onSave: addPanel ? (panel) => {
|
|
1810
|
+
addPanel(panel);
|
|
1811
|
+
setMode("dashboard");
|
|
1812
|
+
} : void 0
|
|
1813
|
+
}
|
|
1814
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1761
1815
|
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-auto", children: dashboard ? /* @__PURE__ */ jsx(DashboardRenderer, { dashboard, records, columns }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center h-full gap-4 text-midnight-text-muted", children: [
|
|
1762
1816
|
/* @__PURE__ */ jsx(Sparkles, { className: "w-8 h-8" }),
|
|
1763
1817
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: caps.canAnalyze ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1764
1818
|
"Click ",
|
|
1765
1819
|
/* @__PURE__ */ jsx("strong", { children: "Auto-Analyze" }),
|
|
1766
1820
|
" to generate an AI dashboard"
|
|
1767
|
-
] }) : "No dashboard to display" })
|
|
1821
|
+
] }) : caps.canNew ? "Start a new dashboard, then add charts from the Chart Builder" : "No dashboard to display" }),
|
|
1822
|
+
caps.canNew && /* @__PURE__ */ jsxs(
|
|
1823
|
+
"button",
|
|
1824
|
+
{
|
|
1825
|
+
onClick: () => {
|
|
1826
|
+
newDashboard?.();
|
|
1827
|
+
setMode("builder");
|
|
1828
|
+
},
|
|
1829
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-mono border border-midnight-accent text-midnight-accent hover:bg-midnight-accent/10 transition-colors",
|
|
1830
|
+
children: [
|
|
1831
|
+
/* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" }),
|
|
1832
|
+
" Create Dashboard"
|
|
1833
|
+
]
|
|
1834
|
+
}
|
|
1835
|
+
)
|
|
1768
1836
|
] }) }),
|
|
1769
1837
|
dashboard && caps.canRefine && refineDashboard && /* @__PURE__ */ jsx(ChatInput, { onSend: refineDashboard, loading: analyzing, theme })
|
|
1770
1838
|
] }) })
|