Skip to content

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

fix buttons in startup wizard

Jean-Baptiste Kaiseraa80db62fc93
diff --git a/src/components/atomic-crm/contacts/ContactEmpty.tsx b/src/components/atomic-crm/contacts/ContactEmpty.tsx
index c4807acf..5c4f05a4 100644
--- a/src/components/atomic-crm/contacts/ContactEmpty.tsx
+++ b/src/components/atomic-crm/contacts/ContactEmpty.tsx
@@ -1,28 +1,51 @@
import { CreateButton } from "@/components/admin/create-button";
+import { useState } from "react";
+import { Button } from "@/components/ui/button";
+import { Plus } from "lucide-react";
import useAppBarHeight from "../misc/useAppBarHeight";
import { ContactImportButton } from "./ContactImportButton";
+import { ContactCreateSheet } from "./ContactCreateSheet";
+import { useIsMobile } from "@/hooks/use-mobile";
export const ContactEmpty = () => {
const appbarHeight = useAppBarHeight();
+ const isMobile = useIsMobile();
+ const [createOpen, setCreateOpen] = useState(false);
return (
- <div
- className="flex flex-col justify-center items-center gap-3"
- style={{
- height: `calc(100dvh - ${appbarHeight}px)`,
- }}
- >
- <img src="./img/empty.svg" alt="No contacts found" />
- <div className="flex flex-col gap-0 items-center">
- <h6 className="text-lg font-bold">No contacts found</h6>
- <p className="text-sm text-muted-foreground text-center mb-4">
- It seems your contact list is empty.
- </p>
+ <>
+ <ContactCreateSheet open={createOpen} onOpenChange={setCreateOpen} />
+ <div
+ className="flex flex-col justify-center items-center gap-3"
+ style={{
+ height: `calc(100dvh - ${appbarHeight}px)`,
+ }}
+ >
+ <img src="./img/empty.svg" alt="No contacts found" />
+ <div className="flex flex-col gap-0 items-center">
+ <h6 className="text-lg font-bold">No contacts found</h6>
+ <p className="text-sm text-muted-foreground text-center mb-4">
+ It seems your contact list is empty.
+ </p>
+ </div>
+ <div className="flex flex-row gap-2">
+ {isMobile ? (
+ <Button
+ onClick={() => setCreateOpen(true)}
+ variant="outline"
+ className="gap-2"
+ >
+ <Plus className="h-4 w-4" />
+ New Contact
+ </Button>
+ ) : (
+ <>
+ <CreateButton label="New Contact" />
+ <ContactImportButton />
+ </>
+ )}
+ </div>
</div>
- <div className="flex flex-row gap-2">
- <CreateButton label="New Contact" />
- <ContactImportButton />
- </div>
- </div>
+ </>
);
};
diff --git a/src/components/atomic-crm/dashboard/DashboardStepper.tsx b/src/components/atomic-crm/dashboard/DashboardStepper.tsx
index 0fea21d5..df1e9356 100644
--- a/src/components/atomic-crm/dashboard/DashboardStepper.tsx
+++ b/src/components/atomic-crm/dashboard/DashboardStepper.tsx
@@ -1,13 +1,17 @@
-import { CheckCircle, Circle } from "lucide-react";
+import { CheckCircle, Circle, Plus } from "lucide-react";
import type { Identifier } from "ra-core";
import { Link } from "react-router";
+import { useState } from "react";
import { CreateButton } from "@/components/admin/create-button";
import { Progress } from "@/components/ui/progress";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { ContactImportButton } from "../contacts/ContactImportButton";
+import { ContactCreateSheet } from "../contacts/ContactCreateSheet";
+import { NoteCreateSheet } from "../notes/NoteCreateSheet";
import useAppBarHeight from "../misc/useAppBarHeight";
+import { useIsMobile } from "@/hooks/use-mobile";
export const DashboardStepper = ({
step,
@@ -17,56 +21,94 @@ export const DashboardStepper = ({
contactId?: Identifier;
}) => {
const appbarHeight = useAppBarHeight();
+ const isMobile = useIsMobile();
+ const [contactCreateOpen, setContactCreateOpen] = useState(false);
+ const [noteCreateOpen, setNoteCreateOpen] = useState(false);
return (
- <div
- className="flex justify-center items-center"
- style={{
- height: `calc(100dvh - ${appbarHeight}px)`,
- }}
- >
- <Card className="w-full max-w-[600px]">
- <CardContent className="px-6">
- <div className="flex items-center justify-between mb-8">
- <h3 className="text-lg font-bold">What's next?</h3>
- <div className="w-[150px]">
- <Progress value={(step / 3) * 100} className="mb-2" />
- <div className="text-right text-sm">{step}/3 done</div>
- </div>
- </div>
- <div className="flex flex-col gap-12">
- <div className="flex gap-8 items-center">
- <CheckCircle className="text-green-600 w-5 h-5" />
- <h4 className="font-bold">Install Atomic CRM</h4>
+ <>
+ <ContactCreateSheet
+ open={contactCreateOpen}
+ onOpenChange={setContactCreateOpen}
+ />
+ <NoteCreateSheet
+ open={noteCreateOpen}
+ onOpenChange={setNoteCreateOpen}
+ contact_id={contactId}
+ />
+ <div
+ className="flex justify-center items-center"
+ style={{
+ height: isMobile ? undefined : `calc(100dvh - ${appbarHeight}px)`,
+ }}
+ >
+ <Card className="w-full max-w-[600px]">
+ <CardContent className="px-6">
+ <div className="flex items-center justify-between mb-8">
+ <h3 className="text-lg font-bold">What's next?</h3>
+ <div className="w-[150px]">
+ <Progress value={(step / 3) * 100} className="mb-2" />
+ <div className="text-right text-sm">{step}/3 done</div>
+ </div>
</div>
- <div className="flex gap-8 items-start">
- {step > 1 ? (
- <CheckCircle className="text-green-600 w-5 h-5 mt-1" />
- ) : (
- <Circle className="text-muted-foreground w-5 h-5 mt-1" />
- )}
+ <div className="flex flex-col gap-12">
+ <div className="flex gap-8 items-center">
+ <CheckCircle className="text-green-600 w-5 h-5 shrink-0" />
+ <h4 className="font-bold">Install Atomic CRM</h4>
+ </div>
+ <div className="flex gap-8 items-start">
+ {step > 1 ? (
+ <CheckCircle className="text-green-600 w-5 h-5 mt-1 shrink-0" />
+ ) : (
+ <Circle className="text-muted-foreground w-5 h-5 mt-1 shrink-0" />
+ )}
- <div className="flex flex-col gap-4">
- <h4 className="font-bold">Add your first contact</h4>
+ <div className="flex flex-col gap-4">
+ <h4 className="font-bold">Add your first contact</h4>
- <div className="flex gap-8">
- <CreateButton label="New Contact" resource="contacts" />
- <ContactImportButton />
+ <div className="flex gap-8">
+ {isMobile ? (
+ <Button
+ onClick={() => setContactCreateOpen(true)}
+ className="gap-2"
+ variant="outline"
+ >
+ <Plus className="h-4 w-4" />
+ New Contact
+ </Button>
+ ) : (
+ <>
+ <CreateButton label="New Contact" resource="contacts" />
+ <ContactImportButton />
+ </>
+ )}
+ </div>
</div>
</div>
- </div>
- <div className="flex gap-8 items-start">
- <Circle className="text-muted-foreground w-5 h-5 mt-1" />
- <div className="flex flex-col gap-4">
- <h4 className="font-bold">Add your first note</h4>
- <p>Go to a contact page and add a note</p>
- <Button asChild disabled={step < 2} className="w-[100px]">
- <Link to={`/contacts/${contactId}/show`}>Add note</Link>
- </Button>
+ <div className="flex gap-8 items-start">
+ <Circle className="text-muted-foreground w-5 h-5 mt-1 shrink-0" />
+ <div className="flex flex-col gap-4">
+ <h4 className="font-bold">Add your first note</h4>
+ <p>Go to a contact page and add a note</p>
+ {isMobile ? (
+ <Button
+ onClick={() => setNoteCreateOpen(true)}
+ disabled={step < 2}
+ className="w-[100px] gap-2"
+ >
+ <Plus className="h-4 w-4" />
+ Add note
+ </Button>
+ ) : (
+ <Button asChild disabled={step < 2} className="w-[100px]">
+ <Link to={`/contacts/${contactId}/show`}>Add note</Link>
+ </Button>
+ )}
+ </div>
</div>
</div>
- </div>
- </CardContent>
- </Card>
- </div>
+ </CardContent>
+ </Card>
+ </div>
+ </>
);
};