@@ -69,6 +69,7 @@ import { getSourceCellContent } from "src/shared/cell-content/source-cell-conten
69
69
import { getSourceFileContent } from "src/shared/cell-content/source-file-content" ;
70
70
import { getFileCellContent } from "src/shared/cell-content/file-cell-content" ;
71
71
import { getDateCellContent } from "src/shared/cell-content/date-cell-content" ;
72
+ import DisabledCell from "../disabled-cell" ;
72
73
73
74
interface BaseCellProps {
74
75
frontmatterKey : string | null ;
@@ -185,6 +186,7 @@ export default function BodyCellContainer(props: Props) {
185
186
const {
186
187
id,
187
188
columnId,
189
+ hasValidFrontmatter,
188
190
source,
189
191
includeTime,
190
192
aspectRatio,
@@ -216,7 +218,17 @@ export default function BodyCellContainer(props: Props) {
216
218
type === CellType . MULTI_TAG ||
217
219
type === CellType . DATE ;
218
220
219
- const isDisabled = source !== null && frontmatterKey === null ;
221
+ let isDisabled = false ;
222
+ if ( hasValidFrontmatter === false ) {
223
+ isDisabled = true ;
224
+ } else if (
225
+ source !== null &&
226
+ frontmatterKey === null &&
227
+ type !== CellType . SOURCE &&
228
+ type !== CellType . SOURCE_FILE
229
+ ) {
230
+ isDisabled = true ;
231
+ }
220
232
221
233
const isUneditable =
222
234
type === CellType . CHECKBOX ||
@@ -239,14 +251,12 @@ export default function BodyCellContainer(props: Props) {
239
251
240
252
function onMenuTriggerEnterDown ( cellActionCallback : ( ) => void ) {
241
253
return ( ) => {
242
- if ( isDisabled ) return ;
243
254
cellActionCallback ( ) ;
244
255
} ;
245
256
}
246
257
247
258
function onMenuTriggerClick ( cellActionCallback : ( ) => void ) {
248
259
return ( ) => {
249
- if ( isDisabled ) return ;
250
260
cellActionCallback ( ) ;
251
261
} ;
252
262
}
@@ -322,23 +332,29 @@ export default function BodyCellContainer(props: Props) {
322
332
323
333
if ( isUneditable ) {
324
334
className += " dataloom-cell--uneditable" ;
325
- } else if ( isDisabled ) {
326
- className += " dataloom-cell--disabled" ;
327
335
}
328
336
329
337
let shouldRunTrigger = true ;
330
- if ( isUneditable || isDisabled ) {
338
+ if ( isUneditable ) {
331
339
shouldRunTrigger = false ;
332
340
}
333
341
334
- let ariaLabel = "" ;
335
- if (
336
- isDisabled &&
337
- type !== CellType . SOURCE &&
338
- type !== CellType . SOURCE_FILE
339
- ) {
340
- ariaLabel =
341
- "This cell is disabled until you choose a frontmatter key for this column" ;
342
+ if ( isDisabled ) {
343
+ return (
344
+ < div
345
+ className = {
346
+ className + " dataloom-cell--body__container--no-padding"
347
+ }
348
+ style = { {
349
+ width,
350
+ } }
351
+ >
352
+ < DisabledCell
353
+ hasValidFrontmatter = { hasValidFrontmatter ?? true }
354
+ doesColumnHaveFrontmatterKey = { frontmatterKey !== null }
355
+ />
356
+ </ div >
357
+ ) ;
342
358
}
343
359
344
360
let contentNode : React . ReactNode | null = null ;
@@ -728,7 +744,6 @@ export default function BodyCellContainer(props: Props) {
728
744
return (
729
745
< >
730
746
< MenuTrigger
731
- ariaLabel = { ariaLabel }
732
747
ref = { menu . triggerRef }
733
748
variant = "cell"
734
749
menuId = { menu . id }
0 commit comments