@@ -80,7 +80,12 @@ export const Grid = memo(
8080
8181 const { mutate : sendEvent } = useSendEventMutation ( )
8282
83- const { isDraggedOver, onDragOver, onFileDrop } = useCsvFileDrop ( {
83+ const {
84+ isValidFile : isValidFileDraggedOver ,
85+ isDraggedOver,
86+ onDragOver,
87+ onFileDrop,
88+ } = useCsvFileDrop ( {
8489 enabled : isTableEmpty && ! isForeignTable ,
8590 onFileDropped : ( file ) => tableEditorSnap . onImportData ( valtioRef ( file ) ) ,
8691 onTelemetryEvent : ( eventName ) => {
@@ -133,21 +138,21 @@ export const Grid = memo(
133138
134139 return (
135140 < div
136- className = { cn (
137- 'flex flex-col relative transition-colors' ,
138- containerClass ,
139- isTableEmpty && isDraggedOver && 'border-2 border-dashed border-brand-600'
140- ) }
141+ className = { cn ( 'flex flex-col relative transition-colors' , containerClass ) }
141142 style = { { width : width || '100%' , height : height || '50vh' } }
142- onDragOver = { onDragOver }
143- onDragLeave = { onDragOver }
144- onDrop = { onFileDrop }
145143 >
146144 { /* Render no rows fallback outside of the DataGrid */ }
147145 { ( rows ?? [ ] ) . length === 0 && (
148146 < div
147+ className = { cn (
148+ 'absolute top-9 p-2 w-full z-[1]' ,
149+ isTableEmpty && isDraggedOver && 'border-2 border-dashed' ,
150+ isValidFileDraggedOver ? 'border-brand-600' : 'border-destructive-600'
151+ ) }
149152 style = { { height : `calc(100% - 35px)` } }
150- className = "absolute top-9 p-2 w-full z-[1] pointer-events-none"
153+ onDragOver = { onDragOver }
154+ onDragLeave = { onDragOver }
155+ onDrop = { onFileDrop }
151156 >
152157 { isLoading && < GenericSkeletonLoader /> }
153158
@@ -171,7 +176,15 @@ export const Grid = memo(
171176 ) : ( filters ?? [ ] ) . length === 0 ? (
172177 < div className = "flex flex-col items-center justify-center col-span-full h-full" >
173178 < p className = "text-sm text-light" >
174- { isDraggedOver ? 'Drop your CSV file here' : 'This table is empty' }
179+ { isDraggedOver ? (
180+ isValidFileDraggedOver ? (
181+ 'Drop your CSV file here'
182+ ) : (
183+ < span className = "text-destructive" > Only CSV files are accepted</ span >
184+ )
185+ ) : (
186+ 'This table is empty'
187+ ) }
175188 </ p >
176189 { tableEntityType === ENTITY_TYPE . FOREIGN_TABLE ? (
177190 < div className = "flex items-center space-x-2 mt-4" >
0 commit comments