A full-featured CRM built with React, shadcn/ui, and Supabase.
Merge remote-tracking branch 'origin/main' into mobile-2
Jean-Baptiste Kaiser90e6fbf3838a
diff --cc package-lock.jsonindex 44446ceb,1a391196..c8db76f8--- a/package-lock.json+++ b/package-lock.json@@@ -25,11 -25,9 +25,11 @@@"@radix-ui/react-slot": "^1.2.4","@radix-ui/react-switch": "^1.2.6","@radix-ui/react-tabs": "^1.1.12",+ "@radix-ui/react-toggle": "^1.1.10",+ "@radix-ui/react-toggle-group": "^1.1.11","@radix-ui/react-tooltip": "^1.2.8",- "@tailwindcss/vite": "^4.1.11",- "@tanstack/react-query": "^5.90.12",+ "@tailwindcss/vite": "^4.1.18",+ "@tanstack/react-query": "^5.90.16","class-variance-authority": "^0.7.1","clsx": "^2.1.1","cmdk": "^1.1.1",@@@ -4567,13 -6356,12 +6388,13 @@@}},"node_modules/@tanstack/react-query": {- "version": "5.90.12",- "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.90.12.tgz",- "integrity": "sha512-graRZspg7EoEaw0a8faiUASCyJrqjKPdqJ9EwuDRUF9mEYJ1YPczI9H+/agJ0mOJkPCJDk0lsz5QTrLZ/jQ2rg==",+ "version": "5.90.16",+ "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.90.16.tgz",+ "integrity": "sha512-bpMGOmV4OPmif7TNMteU/Ehf/hoC0Kf98PDc0F4BZkFrEapRMEqI/V6YS0lyzwSV6PQpY1y4xxArUIfBW5LVxQ==","license": "MIT",+ "peer": true,"dependencies": {- "@tanstack/query-core": "5.90.12"+ "@tanstack/query-core": "5.90.16"},"funding": {"type": "github",@@@ -5346,9 -7142,8 +7174,9 @@@"version": "8.15.0","resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz","integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",- "devOptional": true,+ "dev": true,"license": "MIT",+ "peer": true,"bin": {"acorn": "bin/acorn"},@@@ -9746,11 -11570,10 +11600,11 @@@"license": "MIT"},"node_modules/ra-core": {- "version": "5.13.3",- "resolved": "https://registry.npmjs.org/ra-core/-/ra-core-5.13.3.tgz",- "integrity": "sha512-EAUIK/PVDTvUv/ZM0uZFrSFBbE7iwGFrPwyGvPrIrqvbvpyYgxzE9AeP9kf3twDM0Ks9RQCIA5zGGraRwH199w==",+ "version": "5.13.4",+ "resolved": "https://registry.npmjs.org/ra-core/-/ra-core-5.13.4.tgz",+ "integrity": "sha512-f8tcZOi6og8VKRbbuictj9+gYzXWE+f4fI7m6hqhLrNHSkVcyqK8/A/Vs/feY16W9R1oMWWW0a0SCrZSdPqfcg==","license": "MIT",+ "peer": true,"dependencies": {"date-fns": "^3.6.0","eventemitter3": "^5.0.1",@@@ -9947,11 -11765,10 +11798,11 @@@}},"node_modules/react-hook-form": {- "version": "7.68.0",- "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.68.0.tgz",- "integrity": "sha512-oNN3fjrZ/Xo40SWlHf1yCjlMK417JxoSJVUXQjGdvdRCU07NTFei1i1f8ApUAts+IVh14e4EdakeLEA+BEAs/Q==",+ "version": "7.70.0",+ "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.70.0.tgz",+ "integrity": "sha512-COOMajS4FI3Wuwrs3GPpi/Jeef/5W1DRR84Yl5/ShlT3dKVFUfoGiEZ/QE6Uw8P4T2/CLJdcTVYKvWBMQTEpvw==","license": "MIT",+ "peer": true,"engines": {"node": ">=18.0.0"},@@@ -10050,11 -11867,10 +11901,11 @@@}},"node_modules/react-router": {- "version": "7.10.1",- "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.10.1.tgz",- "integrity": "sha512-gHL89dRa3kwlUYtRQ+m8NmxGI6CgqN+k4XyGjwcFoQwwCWF6xXpOCUlDovkXClS0d0XJN/5q7kc5W3kiFEd0Yw==",+ "version": "7.12.0",+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.12.0.tgz",+ "integrity": "sha512-kTPDYPFzDVGIIGNLS5VJykK0HfHLY5MF3b+xj0/tTyNYL1gF1qs7u67Z9jEhQk2sQ98SUaHxlG31g1JtF7IfVw==","license": "MIT",+ "peer": true,"dependencies": {"cookie": "^1.0.1","set-cookie-parser": "^2.6.0"@@@ -10787,11 -12591,12 +12627,11 @@@}},"node_modules/storybook/node_modules/semver": {- "version": "7.7.2",- "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",- "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",+ "version": "7.7.3",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",+ "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==","dev": true,"license": "ISC",- "peer": true,"bin": {"semver": "bin/semver.js"},@@@ -12456,11 -14206,10 +14245,11 @@@}},"node_modules/zod": {- "version": "4.1.12",- "resolved": "https://registry.npmjs.org/zod/-/zod-4.1.12.tgz",- "integrity": "sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==",+ "version": "4.3.6",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",+ "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==","license": "MIT",+ "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}diff --cc package.jsonindex 0c856286,b2b7d338..f73a9265--- a/package.json+++ b/package.json@@@ -38,11 -38,9 +38,11 @@@"@radix-ui/react-slot": "^1.2.4","@radix-ui/react-switch": "^1.2.6","@radix-ui/react-tabs": "^1.1.12",+ "@radix-ui/react-toggle": "^1.1.10",+ "@radix-ui/react-toggle-group": "^1.1.11","@radix-ui/react-tooltip": "^1.2.8",- "@tailwindcss/vite": "^4.1.11",- "@tanstack/react-query": "^5.90.12",+ "@tailwindcss/vite": "^4.1.18",+ "@tanstack/react-query": "^5.90.16","class-variance-authority": "^0.7.1","clsx": "^2.1.1","cmdk": "^1.1.1",diff --cc registry.jsonindex 48c5cd5f,54eed0ac..af5b9b62--- a/registry.json+++ b/registry.json@@@ -376,14 -344,10 +376,18 @@@"path": "src/components/atomic-crm/misc/RelativeDate.tsx","type": "registry:component"},+ {+ "path": "src/components/atomic-crm/misc/MobileBackButton.tsx",+ "type": "registry:component"+ },+ {+ "path": "src/components/atomic-crm/misc/Markdown.tsx",+ "type": "registry:component"+ },+ {+ "path": "src/components/atomic-crm/misc/InfinitePagination.tsx",+ "type": "registry:component"+ },{"path": "src/components/atomic-crm/misc/ImageEditorField.tsx","type": "registry:component"diff --cc src/components/atomic-crm/activity/ActivityLogContactNoteCreated.tsxindex 3ca8fa1c,27167ec8..f358ffd4--- a/src/components/atomic-crm/activity/ActivityLogContactNoteCreated.tsx+++ b/src/components/atomic-crm/activity/ActivityLogContactNoteCreated.tsx@@@ -35,35 -35,36 +35,41 @@@ export function ActivityLogContactNoteC<ContactAvatar /></ReferenceField>- <span className="text-muted-foreground text-sm flex-grow">- <ReferenceField- source="sales_id"- reference="sales"- record={activity}- >- <SaleName />- </ReferenceField>- <ReferenceField- source="contact_id"- reference="contacts"- record={activity.contactNote}- >- added a note about - <TextField source="first_name" />- - <TextField source="last_name" />- </ReferenceField>- {context !== "company" && (- <>- + <div className="flex flex-row flex-grow">+ <div className="text-sm text-muted-foreground flex-grow">+ <span className="text-muted-foreground text-sm flex flex-wrap">+ <ReferenceField+ source="sales_id"+ reference="sales"+ record={activity}+ >+ <SaleName />+ </ReferenceField>+ added a note about + <ReferenceField+ source="contact_id"+ reference="contacts"+ record={activity.contactNote}+ >+ <TextField source="first_name" />+ + <TextField source="last_name" />+ </ReferenceField>++ {context !== "company" && (++ <>++ ++ <RelativeDate date={activity.date} />++ </>++ )}+ </span>+ </div>++ {context === "company" && (+ <span className="text-muted-foreground text-sm"><RelativeDate date={activity.date} />- </>+ </span>)}- </span>- {context === "company" && (- <span className="text-muted-foreground text-sm">- <RelativeDate date={activity.date} />- </span>- )}+ </div></div>}text={contactNote.text}diff --cc src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsxindex 450aece5,6513700f..e4d3a96f--- a/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx+++ b/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx@@@ -36,7 -36,7 +36,7 @@@ export function ActivityLogDealNoteCrea</ReferenceField></ReferenceField>- <span className="text-sm text-muted-foreground flex-grow flex flex-wrap">- <span className="text-muted-foreground text-sm flex-grow">++ <span className="text-muted-foreground text-sm flex-grow flex flex-wrap"><ReferenceFieldsource="sales_id"reference="sales"diff --cc src/components/atomic-crm/contacts/ContactListContent.tsxindex bedc2c71,9e806e3d..2bd96331--- a/src/components/atomic-crm/contacts/ContactListContent.tsx+++ b/src/components/atomic-crm/contacts/ContactListContent.tsx@@@ -14,8 -19,48 +19,48 @@@ import { Avatar } from "./Avatar"import { TagsList } from "./TagsList";export const ContactListContent = () => {- const { data: contacts, error, isPending } = useListContext<Contact>();+ const {+ data: contacts,+ error,+ isPending,- onToggleItem,+ onSelect,++ onToggleItem,+ selectedIds,+ } = useListContext<Contact>();const isSmall = useIsMobile();+ const lastSelected = useRef<Identifier | null>(null);++ // Handle shift+click to select a range of rows+ const handleToggleItem = useCallback(+ (id: Identifier, event: MouseEvent) => {+ if (!contacts) return;++ const ids = contacts.map((contact) => contact.id);+ const lastSelectedIndex = lastSelected.current+ ? ids.indexOf(lastSelected.current)+ : -1;++ if (event.shiftKey && lastSelectedIndex !== -1) {+ const index = ids.indexOf(id);+ const idsBetweenSelections = ids.slice(+ Math.min(lastSelectedIndex, index),+ Math.max(lastSelectedIndex, index) + 1,+ );++ const isClickedItemSelected = selectedIds?.includes(id);+ const newSelectedIds = isClickedItemSelected+ ? difference(selectedIds, idsBetweenSelections)+ : union(selectedIds, idsBetweenSelections);++ onSelect?.(newSelectedIds);+ } else {+ onToggleItem(id);+ }++ lastSelected.current = id;+ },+ [contacts, selectedIds, onSelect, onToggleItem],+ );// StopPropagation does not work for some reason on Checkbox, this handler is a workaroundconst handleLinkClick = useCallback(function handleLinkClick(@@@ -38,17 -84,62 +83,20 @@@<div className="divide-y">{contacts.map((contact) => (<RecordContextProvider key={contact.id} value={contact}>- <div className="flex flex-row items-center py-2 hover:bg-muted transition-colors first:rounded-t-xl last:rounded-b-xl">- <div- className="px-4 py-3 flex items-center cursor-pointer"- onClick={(e) => handleToggleItem(contact.id, e)}- >- <Checkbox checked={selectedIds.includes(contact.id)} />- </div>- <Link- to={`/contacts/${contact.id}/show`}- onClick={handleLinkClick}- className="flex-1 flex flex-row gap-4 items-center"- >- <Avatar />- <div className="flex-1 min-w-0">- <div className="font-medium">- {`${contact.first_name} ${contact.last_name ?? ""}`}- </div>- {contact.title ||- contact.company_id != null ||- contact.nb_tasks ? (- <div className="text-sm text-muted-foreground">- {contact.title}- {contact.title && contact.company_id != null && " at "}- {contact.company_id != null && (- <ReferenceField- source="company_id"- reference="companies"- link={false}- >- <TextField source="name" />- </ReferenceField>- )}- {contact.nb_tasks- ? ` - ${contact.nb_tasks} task${- contact.nb_tasks > 1 ? "s" : ""- }`- : ""}- - <TagsList />- </div>- ) : null}- </div>- {contact.last_seen && (- <div className="text-right ml-4">- <div- className="text-sm text-muted-foreground"- title={contact.last_seen}- >- {!isSmall && "last activity "}- {formatRelative(contact.last_seen, now)}{" "}- <Status status={contact.status} />- </div>- </div>- )}- </Link>- </div>+ <Link+ to={`/contacts/${contact.id}/show`}+ className="flex flex-row gap-4 items-center px-4 py-2 hover:bg-muted transition-colors first:rounded-t-xl last:rounded-b-xl"+ onClick={handleLinkClick}+ >+ {isSmall ? (+ <ContactItemContentMobile contact={contact} />+ ) : (- <ContactItemContentDesktop contact={contact} />++ <ContactItemContentDesktop++ contact={contact}++ handleToggleItem={handleToggleItem}++ />+ )}+ </Link></RecordContextProvider>))}@@@ -60,94 -151,3 +108,102 @@@</div>);};+- const ContactItemContentDesktop = ({ contact }: { contact: Contact }) => {- const { onToggleItem, selectedIds } = useListContext<Contact>();++const ContactItemContentDesktop = ({++ contact,++ handleToggleItem,++}: {++ contact: Contact;++ handleToggleItem: (id: Identifier, event: MouseEvent) => void;++}) => {++ const { selectedIds } = useListContext<Contact>();+ const now = Date.now();++ return (+ <>+ <Checkbox+ className="cursor-pointer"+ checked={selectedIds.includes(contact.id)}- onCheckedChange={() => onToggleItem(contact.id)}++ onClick={(e) => handleToggleItem(contact.id, e)}+ />+ <Avatar />+ <div className="flex-1 min-w-0">+ <div className="font-medium">+ {`${contact.first_name} ${contact.last_name ?? ""}`}+ </div>- <div className="text-sm text-muted-foreground">- {contact.title}- {contact.title && contact.company_id != null && " at "}- {contact.company_id != null && (- <ReferenceField- source="company_id"- reference="companies"- link={false}- >- <TextField source="name" />- </ReferenceField>- )}- {contact.nb_tasks- ? ` - ${contact.nb_tasks} task${contact.nb_tasks > 1 ? "s" : ""}`- : ""}- - <TagsList />- </div>++ {contact.title || contact.company_id != null || contact.nb_tasks ? (++ <div className="text-sm text-muted-foreground">++ {contact.title}++ {contact.title && contact.company_id != null && " at "}++ {contact.company_id != null && (++ <ReferenceField++ source="company_id"++ reference="companies"++ link={false}++ >++ <TextField source="name" />++ </ReferenceField>++ )}++ {contact.nb_tasks++ ? ` - ${contact.nb_tasks} task${contact.nb_tasks > 1 ? "s" : ""}`++ : ""}++ ++ <TagsList />++ </div>++ ) : null}+ </div>+ {contact.last_seen && (+ <div className="text-right ml-4">+ <div+ className="text-sm text-muted-foreground"+ title={contact.last_seen}+ >+ {"last activity "}+ {formatRelative(contact.last_seen, now)}{" "}+ <Status status={contact.status} />+ </div>+ </div>+ )}+ </>+ );+};++const ContactItemContentMobile = ({ contact }: { contact: Contact }) => {+ return (+ <>+ <Avatar />+ <div className="flex flex-col grow justify-between">+ <div className="flex-1 min-w-0">+ <div className="flex justify-between">+ <div className="font-medium">+ {`${contact.first_name} ${contact.last_name ?? ""}`}+ </div>+ <Status status={contact.status} />+ </div>+ <div className="text-sm text-muted-foreground">+ <div className="flex flex-col gap-1">+ <span>+ {contact.title}+ {contact.title && contact.company_id != null && " at "}+ {contact.company_id != null && (+ <ReferenceField+ source="company_id"+ reference="companies"+ link={false}+ >+ <TextField source="name" />+ </ReferenceField>+ )}+ </span>+ {contact.nb_tasks ? (+ <span>+ {contact.nb_tasks} task{contact.nb_tasks > 1 ? "s" : ""}+ </span>+ ) : null}+ </div>+ </div>+ </div>+ </div>+ </>+ );+};diff --cc src/components/atomic-crm/contacts/ContactShow.tsxindex b56ed18f,d895991a..c5a7ea5f--- a/src/components/atomic-crm/contacts/ContactShow.tsx+++ b/src/components/atomic-crm/contacts/ContactShow.tsx@@@ -22,148 -9,12 +22,148 @@@ import { ContactTasksList } from "./Conimport type { Contact } from "../types";import { Avatar } from "./Avatar";import { ContactAside } from "./ContactAside";+import { MobileBackButton } from "../misc/MobileBackButton";+import { Pencil } from "lucide-react";-export const ContactShow = () => (- <ShowBase>- <ContactShowContent />- </ShowBase>-);+export const ContactShow = () => {+ const isMobile = useIsMobile();++ return (+ <ShowBase>+ {isMobile ? <ContactShowContentMobile /> : <ContactShowContent />}+ </ShowBase>+ );+};++const ContactShowContentMobile = () => {+ const { record, isPending } = useShowContext<Contact>();+ const [noteCreateOpen, setNoteCreateOpen] = useState(false);+ const [editOpen, setEditOpen] = useState(false);+ if (isPending || !record) return null;++ return (+ <>+ <NoteCreateSheet+ open={noteCreateOpen}+ onOpenChange={setNoteCreateOpen}+ contact_id={record.id}+ />+ <ContactEditSheet+ open={editOpen}+ onOpenChange={setEditOpen}+ contactId={record.id}+ />+ <MobileHeader>+ <MobileBackButton />+ <div className="flex flex-1">+ <h1 className="text-xl font-semibold">Contacts</h1>+ </div>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="rounded-full"+ onClick={() => setEditOpen(true)}+ >+ <Pencil className="size-5" />+ <span className="sr-only">Edit record</span>+ </Button>+ </MobileHeader>+ <MobileContent>+ <div className="mb-6">+ <div className="flex items-center mb-4">+ <Avatar />+ <div className="mx-3 flex-1">+ <h2 className="text-2xl font-bold">+ {record.first_name} {record.last_name}+ </h2>+ <div className="text-sm text-muted-foreground">+ {record.title}+ {record.title && record.company_id != null && " at "}+ {record.company_id != null && (+ <ReferenceField+ source="company_id"+ reference="companies"+ link="show"+ >+ <TextField source="name" className="underline" />+ </ReferenceField>+ )}+ </div>+ </div>+ <div>+ <ReferenceField+ source="company_id"+ reference="companies"+ link="show"+ className="no-underline"+ >+ <CompanyAvatar />+ </ReferenceField>+ </div>+ </div>+ </div>++ <Tabs defaultValue="notes" className="w-full">+ <TabsList className="grid w-full grid-cols-3 h-10">+ <TabsTrigger value="notes">Notes</TabsTrigger>+ <TabsTrigger value="tasks">+ <ReferenceManyCount+ target="contact_id"+ reference="tasks"+ filter={{ "done_date@is": null }}+ />{" "}+ Tasks+ </TabsTrigger>+ <TabsTrigger value="details">Contact Details</TabsTrigger>+ </TabsList>++ <TabsContent value="notes" className="mt-4">+ <ReferenceManyField+ target="contact_id"- reference="contactNotes"++ reference="contact_notes"+ sort={{ field: "date", order: "DESC" }}+ empty={+ <div className="flex flex-col items-center justify-center py-8 text-center">+ <p className="text-muted-foreground mb-4">No notes yet</p>+ <Button+ variant="outline"+ onClick={() => setNoteCreateOpen(true)}+ >+ Add note+ </Button>+ </div>+ }+ >+ <NotesIterator reference="contacts" showStatus />+ </ReferenceManyField>+ </TabsContent>++ <TabsContent value="tasks" className="mt-4">+ <ContactTasksList />+ </TabsContent>++ <TabsContent value="details" className="mt-4">+ <div className="space-y-6">+ <div>+ <h3 className="text-lg font-semibold mb-3">Personal info</h3>+ <ContactPersonalInfo />+ </div>+ <div>+ <h3 className="text-lg font-semibold mb-3">Background info</h3>+ <ContactBackgroundInfo />+ </div>+ <div>+ <h3 className="text-lg font-semibold mb-3">Tags</h3>+ <TagsListEdit />+ </div>+ </div>+ </TabsContent>+ </Tabs>+ </MobileContent>+ </>+ );+};const ContactShowContent = () => {const { record, isPending } = useShowContext<Contact>();diff --cc src/components/atomic-crm/dashboard/MobileDashboard.tsxindex 11016a34,00000000..816f571emode 100644,000000..100644--- a/src/components/atomic-crm/dashboard/MobileDashboard.tsx+++ b/src/components/atomic-crm/dashboard/MobileDashboard.tsx@@@ -1,79 -1,0 +1,79 @@@+import { useGetList } from "ra-core";++import type { Contact, ContactNote } from "../types";+import { DashboardActivityLog } from "./DashboardActivityLog";+import { DashboardStepper } from "./DashboardStepper";+import { Welcome } from "./Welcome";+import MobileHeader from "../layout/MobileHeader";+import { MobileContent } from "../layout/MobileContent";+import { useConfigurationContext } from "../root/ConfigurationContext";++const Wrapper = ({ children }: { children: React.ReactNode }) => {+ const { darkModeLogo, lightModeLogo, title } = useConfigurationContext();+ return (+ <>+ <MobileHeader>+ <div className="flex items-center gap-2 text-secondary-foreground no-underline py-3">+ <img+ className="[.light_&]:hidden h-6"+ src={darkModeLogo}+ alt={title}+ />+ <img+ className="[.dark_&]:hidden h-6"+ src={lightModeLogo}+ alt={title}+ />+ <h1 className="text-xl font-semibold">{title}</h1>+ </div>+ </MobileHeader>+ <MobileContent>{children}</MobileContent>+ </>+ );+};++export const MobileDashboard = () => {+ const {+ data: dataContact,+ total: totalContact,+ isPending: isPendingContact,+ } = useGetList<Contact>("contacts", {+ pagination: { page: 1, perPage: 1 },+ });++ const { total: totalContactNotes, isPending: isPendingContactNotes } =- useGetList<ContactNote>("contactNotes", {++ useGetList<ContactNote>("contact_notes", {+ pagination: { page: 1, perPage: 1 },+ });++ const isPending = isPendingContact || isPendingContactNotes;++ if (isPending) {+ return null;+ }++ if (!totalContact) {+ return (+ <Wrapper>+ <DashboardStepper step={1} />+ </Wrapper>+ );+ }++ if (!totalContactNotes) {+ return (+ <Wrapper>+ <DashboardStepper step={2} contactId={dataContact?.[0]?.id} />+ </Wrapper>+ );+ }++ return (+ <Wrapper>+ <div className="grid grid-cols-1 md:grid-cols-12 gap-6 mt-1">+ {import.meta.env.VITE_IS_DEMO === "true" ? <Welcome /> : null}+ <DashboardActivityLog />+ </div>+ </Wrapper>+ );+};diff --cc src/components/atomic-crm/notes/Note.tsxindex 6cfda48e,2cce8cf9..38b4ce27--- a/src/components/atomic-crm/notes/Note.tsx+++ b/src/components/atomic-crm/notes/Note.tsx@@@ -19,6 -20,8 +20,7 @@@ import} from "@/components/ui/tooltip";import { CompanyAvatar } from "../companies/CompanyAvatar";-import { Avatar } from "../contacts/Avatar";+ import { Markdown } from "../misc/Markdown";import { RelativeDate } from "../misc/RelativeDate";import { Status } from "../misc/Status";import { SaleName } from "../sales/SaleName";@@@ -36,9 -37,11 +38,12 @@@ export const Note = (note: DealNote | ContactNote;isLast: boolean;}) => {+ const isMobile = useIsMobile();const [isHover, setHover] = useState(false);const [isEditing, setEditing] = useState(false);+ const [isExpanded, setExpanded] = useState(false);+ const [isTruncated, setTruncated] = useState(false);+ const contentRef = useRef<HTMLDivElement>(null);const resource = useResourceContext();const notify = useNotify();diff --cc src/components/atomic-crm/notes/NoteCreate.tsxindex c86be32c,09927da2..8985d6d3--- a/src/components/atomic-crm/notes/NoteCreate.tsx+++ b/src/components/atomic-crm/notes/NoteCreate.tsx@@@ -80,19 -80,18 +80,23 @@@ export const NoteCreateButton = (}const handleSuccess = (data: any) => {+ const referenceRecordId = record?.id || data[foreignKeyMapping[reference]];+ if (!referenceRecordId) return;reset(resetValues, { keepValues: false });- refetch();update(reference, {- id: (record && record.id) as unknown as Identifier,+ id: referenceRecordId as unknown as Identifier,- data: { last_seen: new Date().toISOString(), status: data.status },+ data: {+ last_seen:+ reference === "contacts" ? new Date().toISOString() : undefined,+ status: data.status,+ },previousData: record,});+ if (refetch) refetch();notify("Note added");+ if (isMobile) {+ redirect("show", reference, referenceRecordId);+ }};return (@@@ -102,10 -101,9 +106,10 @@@label="Add this note"transform={(data) => ({...data,- [foreignKeyMapping[reference]]: record.id,+ [foreignKeyMapping[reference]]:+ record?.id || data[foreignKeyMapping[reference]],sales_id: identity.id,- date: data.date || getCurrentDate(),+ date: new Date(data.date || getCurrentDate()).toISOString(),})}mutationOptions={{onSuccess: handleSuccess,diff --cc src/components/atomic-crm/notes/NoteCreateSheet.tsxindex af49b4f5,00000000..85ba27ddmode 100644,000000..100644--- a/src/components/atomic-crm/notes/NoteCreateSheet.tsx+++ b/src/components/atomic-crm/notes/NoteCreateSheet.tsx@@@ -1,92 -1,0 +1,92 @@@+import {+ type Identifier,+ RecordRepresentation,+ useDataProvider,+ useGetIdentity,+ useGetOne,+ useNotify,+ useRedirect,+ useUpdate,+} from "ra-core";+import { CreateSheet } from "../misc/CreateSheet";+import { foreignKeyMapping } from "./foreignKeyMapping";+import { NoteInputs } from "./NoteInputs";+import { getCurrentDate } from "./utils";++export interface NoteCreateSheetProps {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ contact_id?: Identifier;+}++export const NoteCreateSheet = ({+ open,+ onOpenChange,+ contact_id,+}: NoteCreateSheetProps) => {+ const { identity } = useGetIdentity();++ const selectContact = contact_id == null;+ const { data: contact } = useGetOne(+ "contacts",+ { id: contact_id! },+ { enabled: !!contact_id },+ );+ const [update] = useUpdate();+ const dataProvider = useDataProvider();+ const notify = useNotify();+ const redirect = useRedirect();++ if (!identity) return null;++ const handleSuccess = async (data: any) => {+ const referenceRecordId = data[foreignKeyMapping["contacts"]];+ if (!referenceRecordId) return;+ const { data: contact } = await dataProvider.getOne("contacts", {+ id: referenceRecordId,+ });+ if (!contact) return;+ update("contacts", {+ id: referenceRecordId as unknown as Identifier,+ data: { last_seen: new Date().toISOString(), status: data.status },+ previousData: contact,+ });+ notify("Note added");+ redirect("show", "contacts", referenceRecordId);+ onOpenChange(false);+ };++ return (+ <CreateSheet- resource="contactNotes"++ resource="contact_notes"+ title={+ <>+ {!selectContact ? "Create Note for " : "Create Note"}+ {!selectContact && (+ <RecordRepresentation record={contact} resource="contacts" />+ )}+ </>+ }+ redirect={false}+ defaultValues={{ sales_id: identity?.id }}+ transform={(data: any) => ({+ ...data,+ [foreignKeyMapping["contacts"]]:+ contact_id || data[foreignKeyMapping["contacts"]],+ sales_id: identity.id,+ date: data.date || getCurrentDate(),+ })}+ mutationOptions={{+ onSuccess: handleSuccess,+ }}+ open={open}+ onOpenChange={onOpenChange}+ >+ <NoteInputs+ showStatus+ reference="contacts"+ selectReference={selectContact}+ />+ </CreateSheet>+ );+};diff --cc src/components/atomic-crm/notes/NoteEditSheet.tsxindex f1ec6209,00000000..e9f4cb45mode 100644,000000..100644--- a/src/components/atomic-crm/notes/NoteEditSheet.tsx+++ b/src/components/atomic-crm/notes/NoteEditSheet.tsx@@@ -1,77 -1,0 +1,77 @@@+import { DeleteButton, ReferenceField } from "@/components/admin";+import {+ type Identifier,+ RecordRepresentation,+ useCreatePath,+ WithRecord,+} from "ra-core";+import { EditSheet } from "../misc/EditSheet";+import { foreignKeyMapping } from "./foreignKeyMapping";+import { NoteInputs } from "./NoteInputs";++export interface NoteEditSheetProps {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ noteId: Identifier;+}++export const NoteEditSheet = ({+ open,+ onOpenChange,+ noteId,+}: NoteEditSheetProps) => {+ const createPath = useCreatePath();+ const getRedirectTo = (record: any) => {+ return createPath({+ resource: "contacts",+ type: "show",+ id: record ? record[foreignKeyMapping["contacts"]] : undefined,+ });+ };++ return (+ <EditSheet- resource="contactNotes"++ resource="contact_notes"+ id={noteId}+ title={+ <ReferenceField+ source={foreignKeyMapping["contacts"]}+ reference="contacts"+ render={({ referenceRecord }) => (+ <>+ Edit Note+ {referenceRecord ? (+ <>+ {" for "}+ <RecordRepresentation+ record={referenceRecord}+ resource="contacts"+ />+ </>+ ) : null}+ </>+ )}+ />+ }+ redirect={(_resource, _id, record) => getRedirectTo(record)}+ open={open}+ onOpenChange={onOpenChange}+ deleteButton={+ <WithRecord+ render={(record) => (+ <DeleteButton+ variant="destructive"+ className="flex-1"+ redirect={getRedirectTo(record)}+ onClick={() => {+ onOpenChange(false);+ }}+ />+ )}+ />+ }+ >+ <NoteInputs showStatus />+ </EditSheet>+ );+};diff --cc src/components/atomic-crm/root/CRM.tsxindex 0b50a2a8,fe3a6687..3c0cb6ba--- a/src/components/atomic-crm/root/CRM.tsx+++ b/src/components/atomic-crm/root/CRM.tsx@@@ -155,72 -167,3 +155,72 @@@ export const CRM = (</ConfigurationProvider>);};++const DesktopAdmin = (props: CoreAdminProps) => {+ return (+ <Admin+ store={localStorageStore(undefined, "CRM")}+ layout={Layout}+ loginPage={StartPage}+ i18nProvider={i18nProvider}+ dashboard={Dashboard}+ requireAuth+ disableTelemetry+ {...props}+ >+ <CustomRoutes noLayout>+ <Route path={SignupPage.path} element={<SignupPage />} />+ <Route path={SetPasswordPage.path} element={<SetPasswordPage />} />+ <Route+ path={ForgotPasswordPage.path}+ element={<ForgotPasswordPage />}+ />+ <Route path={OAuthConsentPage.path} element={<OAuthConsentPage />} />+ </CustomRoutes>++ <CustomRoutes>+ <Route path={SettingsPage.path} element={<SettingsPage />} />+ </CustomRoutes>+ <Resource name="deals" {...deals} />+ <Resource name="contacts" {...contacts} />+ <Resource name="companies" {...companies} />- <Resource name="contactNotes" />- <Resource name="dealNotes" />++ <Resource name="contact_notes" />++ <Resource name="deal_notes" />+ <Resource name="tasks" />+ <Resource name="sales" {...sales} />+ <Resource name="tags" />+ </Admin>+ );+};++const MobileAdmin = (props: CoreAdminProps) => {+ return (+ <Admin+ store={localStorageStore(undefined, "CRM")}+ layout={MobileLayout}+ loginPage={StartPage}+ i18nProvider={i18nProvider}+ dashboard={MobileDashboard}+ requireAuth+ disableTelemetry+ {...props}+ >+ <CustomRoutes noLayout>+ <Route path={SignupPage.path} element={<SignupPage />} />+ <Route path={SetPasswordPage.path} element={<SetPasswordPage />} />+ <Route+ path={ForgotPasswordPage.path}+ element={<ForgotPasswordPage />}+ />+ <Route path={OAuthConsentPage.path} element={<OAuthConsentPage />} />+ </CustomRoutes>+ <Resource+ name="contacts"+ list={ContactList}+ show={ContactShow}+ recordRepresentation={contacts.recordRepresentation}+ />+ <Resource name="tasks" list={MobileTasksList} />+ </Admin>+ );+};