Skip to content

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

add back to the list button

Jean-Baptiste Kaiser998f0039c20c
diff --git a/registry.json b/registry.json
index 7d8ad5bd..3b8595a4 100644
--- a/registry.json
+++ b/registry.json
@@ -348,6 +348,10 @@
"path": "src/components/atomic-crm/misc/RelativeDate.tsx",
"type": "registry:component"
},
+ {
+ "path": "src/components/atomic-crm/misc/ListButton.tsx",
+ "type": "registry:component"
+ },
{
"path": "src/components/atomic-crm/misc/InfinitePagination.tsx",
"type": "registry:component"
diff --git a/src/components/atomic-crm/contacts/ContactShow.tsx b/src/components/atomic-crm/contacts/ContactShow.tsx
index 5369a050..3465f138 100644
--- a/src/components/atomic-crm/contacts/ContactShow.tsx
+++ b/src/components/atomic-crm/contacts/ContactShow.tsx
@@ -18,6 +18,7 @@ import { ContactBackgroundInfo } from "./ContactBackgroundInfo";
import type { Contact } from "../types";
import { Avatar } from "./Avatar";
import { ContactAside } from "./ContactAside";
+import { ListButton } from "../misc/ListButton";
export const ContactShow = () => {
const isMobile = useIsMobile();
@@ -36,7 +37,8 @@ const ContactShowContentMobile = () => {
return (
<>
<MobileHeader>
- <div className="flex items-center gap-2 text-secondary-foreground no-underline py-3">
+ <ListButton />
+ <div className="flex flex-1 items-center gap-2 text-secondary-foreground no-underline py-3">
<h1 className="text-xl font-semibold">Contacts</h1>
</div>
</MobileHeader>
diff --git a/src/components/atomic-crm/misc/ListButton.tsx b/src/components/atomic-crm/misc/ListButton.tsx
new file mode 100644
index 00000000..c79f291c
--- /dev/null
+++ b/src/components/atomic-crm/misc/ListButton.tsx
@@ -0,0 +1,27 @@
+import { useResourceContext, useCreatePath } from "ra-core";
+import { useNavigate } from "react-router";
+import { ChevronLeft } from "lucide-react";
+import { Button } from "@/components/ui/button";
+
+export const ListButton = () => {
+ const resource = useResourceContext();
+ const navigate = useNavigate();
+ const createPath = useCreatePath();
+ const to = createPath({ resource, type: "list" });
+
+ return (
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ className="rounded-full"
+ onClick={(e) => {
+ e.preventDefault();
+ navigate(to);
+ }}
+ >
+ <ChevronLeft className="size-6" />
+ <span className="sr-only">Back to list</span>
+ </Button>
+ );
+};