Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Provide a sample file

Gildas Garcia50104ef2be42
diff --git a/src/components/atomic-crm/layout/ImportFromJsonDialog.tsx b/src/components/atomic-crm/layout/ImportFromJsonDialog.tsx
index 84ce5401..117fe180 100644
--- a/src/components/atomic-crm/layout/ImportFromJsonDialog.tsx
+++ b/src/components/atomic-crm/layout/ImportFromJsonDialog.tsx
@@ -27,6 +27,7 @@ import {
TableRow,
} from "@/components/ui/table";
import { Spinner } from "@/components/ui/spinner";
+import sampleFile from "./import-sample.json?url";
export const ImportFromJsonDialog = ({
onOpenChange,
@@ -63,12 +64,24 @@ export const ImportFromJsonDialog = ({
<AlertDescription>
<p>{importStatus.error.message}</p>
</AlertDescription>
- <DownloadErrorFileButton
- failedImports={importStatus.failedImports}
- />
</Alert>
- ) : null}
- <FileInput source="file" validate={required()}>
+ ) : (
+ <Alert>
+ <AlertTitle>Instructions</AlertTitle>
+ <AlertDescription>
+ Provide a JSON file containing sales, companies, contacts,
+ notes or tasks
+ <a
+ className="font-bold hover:underline"
+ download="import-sample.json"
+ href={sampleFile}
+ >
+ Download a sample
+ </a>
+ </AlertDescription>
+ </Alert>
+ )}
+ <FileInput className="mt-4" source="file" validate={required()}>
<FileField source="src" title="title" />
</FileInput>
<DialogFooter>
diff --git a/src/components/atomic-crm/layout/import-sample.json b/src/components/atomic-crm/layout/import-sample.json
new file mode 100644
index 00000000..856e930f
--- /dev/null
+++ b/src/components/atomic-crm/layout/import-sample.json
@@ -0,0 +1,89 @@
+{
+ "sales": [
+ {
+ "id": 123,
+ "first_name": "John",
+ "last_name": "Doe",
+ "email": "[email protected]"
+ }
+ ],
+ "companies": [
+ {
+ "id": 234,
+ "name": "A company"
+ },
+ {
+ "id": 345,
+ "name": "Another company",
+ "description": "A description",
+ "city": "A city",
+ "country": "A country",
+ "address": "An address",
+ "zipcode": "A zipcode",
+ "state_abbr": "A state abbreviation",
+ "sales_id": 123
+ }
+ ],
+ "contacts": [
+ {
+ "id": 456,
+ "first_name": "A first name",
+ "last_name": "A last name"
+ },
+ {
+ "id": 567,
+ "first_name": "A first name",
+ "last_name": "A last name",
+ "title": "A title",
+ "company_id": 345,
+ "background": "A background",
+ "linkedin_url": "A URL",
+ "sales_id": 123,
+ "emails": [
+ {
+ "email": "[email protected]",
+ "type": "Work"
+ }
+ ],
+ "phones": {
+ "number": "45646746788",
+ "type": "Home"
+ },
+ "tags": ["MyTag"]
+ }
+ ],
+ "notes": [
+ {
+ "contact_id": 456,
+ "sales_id": 123,
+ "text": "Some text",
+ "date": "2025-11-13T08:16:10Z"
+ },
+ {
+ "contact_id": 456,
+ "sales_id": 123,
+ "text": "Some long text with lines\n\nAnother line",
+ "date": "2025-02-14T09:20:21Z",
+ "attachments": [
+ {
+ "url": "https://mycurrentcrm.com/files/link",
+ "name": "important.pdf"
+ }
+ ]
+ }
+ ],
+ "tasks": [
+ {
+ "contact_id": 456,
+ "sales_id": 123,
+ "text": "A task title"
+ },
+ {
+ "contact_id": 456,
+ "sales_id": 123,
+ "text": "Another task title",
+ "due_date": "2025-03-26T16:15:00Z",
+ "done_date": "2025-04-01T09:00:00"
+ }
+ ]
+}