Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix drag drop for spreadsheet import

Joshen Lim6f39a2284ba6
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/SpreadsheetImport/SpreadSheetFileUpload.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/SpreadsheetImport/SpreadSheetFileUpload.tsx
index 7ccf8c23c1c..c9f58aa2091 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/SpreadsheetImport/SpreadSheetFileUpload.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/SpreadsheetImport/SpreadSheetFileUpload.tsx
@@ -24,6 +24,8 @@ const SpreadSheetFileUpload: FC<Props> = ({
} else if (event.type === 'dragleave' || event.type === 'drop') {
setIsDraggedOver(false)
}
+ event.stopPropagation()
+ event.preventDefault()
}
const onDrop = (event: DragEvent<HTMLDivElement>) => {
@@ -34,19 +36,19 @@ const SpreadSheetFileUpload: FC<Props> = ({
return (
<div className="space-y-10">
<div>
- <p className="text-sm text-scale-1100 mb-2">
+ <p className="text-scale-1100 mb-2 text-sm">
Upload a CSV or TSV file. The first row should be the headers of the table, and your
headers should not include any special characters other than hyphens (
<span className="text-code">-</span>) or underscores (<span className="text-code">_</span>
).
</p>
- <p className="text-xs text-scale-900">
+ <p className="text-scale-900 text-xs">
Tip: Datetime columns should be formatted as YYYY-MM-DD HH:mm:ss
</p>
</div>
{!uploadedFile ? (
<div
- className={`cursor-pointer flex items-center justify-center border dark:border-gray-500 border-dashed rounded-md h-48 ${
+ className={`flex h-48 cursor-pointer items-center justify-center rounded-md border border-dashed dark:border-gray-500 ${
isDraggedOver ? 'bg-gray-500' : ''
}`}
onDragOver={onDragOver}
@@ -55,12 +57,11 @@ const SpreadSheetFileUpload: FC<Props> = ({
onClick={() => (uploadButtonRef.current as any)?.click()}
>
<Typography.Text>
- Drag and drop, or <span className="text-green-1000">browse</span> your
- files
+ Drag and drop, or <span className="text-green-1000">browse</span> your files
</Typography.Text>
</div>
) : (
- <div className="flex flex-col items-center justify-center border dark:border-gray-500 border-dashed rounded-md h-32 space-y-2">
+ <div className="flex h-32 flex-col items-center justify-center space-y-2 rounded-md border border-dashed dark:border-gray-500">
<div className="flex items-center space-x-2">
<IconFileText size={14} strokeWidth={1.5} />
<h3 className="text-scale-1200 text-base">{uploadedFile.name}</h3>
@@ -70,8 +71,8 @@ const SpreadSheetFileUpload: FC<Props> = ({
Remove File
</Button>
) : (
- <div className="flex items-center w-3/5 space-x-2">
- <IconLoader className="animate-spin w-4 h-4" />
+ <div className="flex w-3/5 items-center space-x-2">
+ <IconLoader className="h-4 w-4 animate-spin" />
<SparkBar
value={parseProgress}
max={100}