@@ -94,6 +94,14 @@ export function AddSmartColumnDialog({
9494 setSampleIndex ( 0 ) ;
9595 } , [ source ] ) ;
9696
97+ const handleSourceChange = ( next : SmartColumnSource ) => {
98+ if ( next === source ) return ;
99+ setSource ( next ) ;
100+ setPath ( "" ) ;
101+ setLabel ( "" ) ;
102+ setLabelEdited ( false ) ;
103+ } ;
104+
97105 const effectiveLabel = labelEdited ? label : labelFromPath ( path ) ;
98106
99107 const sampleLoaded = sample . data !== undefined && sample . state === "idle" ;
@@ -145,8 +153,7 @@ export function AddSmartColumnDialog({
145153 < DialogHeader > { editing ? "Edit smart column" : "Add smart column" } </ DialogHeader >
146154 < div className = "flex flex-col gap-5 p-1" >
147155 < Callout variant = "info" >
148- Display only. A smart column shows you a value from a run, but you can't sort or filter
149- the list by it. To narrow the list, use tags or the query editor.
156+ Smart columns are display only. You can't sort or filter by them.
150157 </ Callout >
151158
152159 < div className = "grid grid-cols-1 gap-5 md:grid-cols-[minmax(0,1fr)_260px_220px]" >
@@ -160,7 +167,7 @@ export function AddSmartColumnDialog({
160167 label = { card . label }
161168 description = { card . description }
162169 selected = { source === card . value }
163- onSelect = { ( ) => setSource ( card . value ) }
170+ onSelect = { ( ) => handleSourceChange ( card . value ) }
164171 />
165172 ) ) }
166173 </ div >
@@ -175,10 +182,9 @@ export function AddSmartColumnDialog({
175182 placeholder = "$.order.total"
176183 spellCheck = { false }
177184 />
178- < Paragraph variant = "extra-small" className = "text-text-dimmed" >
179- Dot and bracket notation, e.g. < code > $.order.total</ code > or{ " " }
180- < code > $.items[0].sku</ code > . Use < code > .length</ code > for an array, string, or
181- key count.
185+ < Paragraph variant = "extra-small" className = "text-balance text-text-dimmed" >
186+ e.g. < code > $.order.total</ code > , < code > $.items[0].sku</ code > ,{ " " }
187+ < code > $.items.length</ code >
182188 </ Paragraph >
183189 </ div >
184190 < div className = "flex flex-col gap-1.5" >
@@ -191,9 +197,6 @@ export function AddSmartColumnDialog({
191197 } }
192198 placeholder = { labelFromPath ( path ) }
193199 />
194- < Paragraph variant = "extra-small" className = "text-text-dimmed" >
195- Defaults to the last part of the path.
196- </ Paragraph >
197200 </ div >
198201 </ div >
199202
@@ -216,16 +219,12 @@ export function AddSmartColumnDialog({
216219 </ button >
217220 ) ) }
218221 </ div >
219- < Paragraph variant = "extra-small" className = "text-text-dimmed" >
220- Number right-aligns the column and uses tabular figures. Anything that doesn't
221- parse falls back to text.
222- </ Paragraph >
223222 </ div >
224223 </ div >
225224
226- < div className = "flex flex-col gap-1.5 self-start rounded-lg border border-grid-dimmed bg-background-dimmed p-3 " >
227- < div className = "flex items-center justify-between gap-2" >
228- < Paragraph variant = "extra-extra-small/dimmed/caps" > Sample — { source } </ Paragraph >
225+ < div className = "flex flex-col gap-1.5 self-start" >
226+ < div className = "flex h-5 items-center justify-between gap-2" >
227+ < Paragraph variant = "extra-extra-small/dimmed/caps" > Sample { source } </ Paragraph >
229228 { usable . length > 1 && (
230229 < SampleRunPicker
231230 index = { activeIndex }
@@ -235,33 +234,37 @@ export function AddSmartColumnDialog({
235234 />
236235 ) }
237236 </ div >
238- { ! sampleLoaded ? (
239- < Paragraph variant = "extra-small" className = "text-text-dimmed" >
240- Loading…
241- </ Paragraph >
242- ) : activeSample ? (
243- < SmartColumnSample
244- value = { activeSample . value }
245- activePath = { path . trim ( ) }
246- onSelectPath = { setPath }
247- />
248- ) : runCount === 0 ? (
249- < Paragraph variant = "extra-small" className = "text-text-dimmed" >
250- No runs to sample.
251- </ Paragraph >
252- ) : anyOffloaded ? (
253- < Paragraph variant = "extra-small" className = "text-text-dimmed" >
254- Recent { source } s are offloaded to object storage, too large to sample here.
255- </ Paragraph >
256- ) : (
257- < Paragraph variant = "extra-small" className = "text-text-dimmed" >
258- No recent run has a { source } value to sample.
259- </ Paragraph >
260- ) }
237+ < div className = "overflow-hidden rounded-lg border border-grid-dimmed bg-charcoal-900 p-3" >
238+ { ! sampleLoaded ? (
239+ < Paragraph variant = "extra-small" className = "text-text-dimmed" >
240+ Loading…
241+ </ Paragraph >
242+ ) : activeSample ? (
243+ < SmartColumnSample
244+ value = { activeSample . value }
245+ activePath = { path . trim ( ) }
246+ onSelectPath = { setPath }
247+ />
248+ ) : runCount === 0 ? (
249+ < Paragraph variant = "extra-small" className = "text-text-dimmed" >
250+ No runs to sample yet.
251+ </ Paragraph >
252+ ) : anyOffloaded ? (
253+ < Paragraph variant = "extra-small" className = "text-text-dimmed" >
254+ Recent { source } s are too large to sample here.
255+ </ Paragraph >
256+ ) : (
257+ < Paragraph variant = "extra-small" className = "text-text-dimmed" >
258+ No recent run has a { source } to sample.
259+ </ Paragraph >
260+ ) }
261+ </ div >
261262 </ div >
262263
263264 < div className = "flex flex-col gap-1.5 self-start" >
264- < Paragraph variant = "extra-extra-small/dimmed/caps" > Preview</ Paragraph >
265+ < div className = "flex h-5 items-center" >
266+ < Paragraph variant = "extra-extra-small/dimmed/caps" > Preview</ Paragraph >
267+ </ div >
265268 < SmartColumnPreview rows = { perRun } def = { previewDef } loaded = { sampleLoaded } />
266269 </ div >
267270 </ div >
@@ -377,7 +380,7 @@ function SmartColumnPreview({
377380 { ! loaded ? (
378381 < div className = "px-2.5 py-2 text-xs text-text-dimmed" > Loading…</ div >
379382 ) : rows . length === 0 ? (
380- < div className = "px-2.5 py-2 text-xs text-text-dimmed" > No runs</ div >
383+ < div className = "px-2.5 py-2 text-xs text-text-dimmed" > No runs yet </ div >
381384 ) : (
382385 rows . map ( ( row , index ) => {
383386 const cell = def . path
0 commit comments