A full-featured CRM built with React, shadcn/ui, and Supabase.
disable links to deals on mobile
Jean-Baptiste Kaiser39d20c0c7e63
diff --git a/src/components/atomic-crm/activity/ActivityLogDealCreated.tsx b/src/components/atomic-crm/activity/ActivityLogDealCreated.tsxindex c8f44335..d859e957 100644--- a/src/components/atomic-crm/activity/ActivityLogDealCreated.tsx+++ b/src/components/atomic-crm/activity/ActivityLogDealCreated.tsx@@ -6,6 +6,7 @@ import { RelativeDate } from "../misc/RelativeDate";import { SaleName } from "../sales/SaleName";import type { ActivityDealCreated } from "../types";import { useActivityLogContext } from "./ActivityLogContext";+import { useIsMobile } from "@/hooks/use-mobile";type ActivityLogDealCreatedProps = {activity: RaRecord & ActivityDealCreated;@@ -15,6 +16,7 @@ export function ActivityLogDealCreated({activity,}: ActivityLogDealCreatedProps) {const context = useActivityLogContext();+ const isMobile = useIsMobile();const { deal } = activity;return (<div className="p-0">@@ -25,7 +27,11 @@ export function ActivityLogDealCreated({<SaleName /></ReferenceField> added deal - <Link to={`/deals/${deal.id}/show`}>{deal.name}</Link>+ {isMobile ? (+ deal.name+ ) : (+ <Link to={`/deals/${deal.id}/show`}>{deal.name}</Link>+ )} {context !== "company" && (<>diff --git a/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx b/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsxindex e4d3a96f..c92bd1a0 100644--- a/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx+++ b/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx@@ -7,6 +7,7 @@ import { SaleName } from "../sales/SaleName";import type { ActivityDealNoteCreated } from "../types";import { useActivityLogContext } from "./ActivityLogContext";import { ActivityLogNote } from "./ActivityLogNote";+import { useIsMobile } from "@/hooks/use-mobile";type ActivityLogDealNoteCreatedProps = {activity: RaRecord & ActivityDealNoteCreated;@@ -16,6 +17,7 @@ export function ActivityLogDealNoteCreated({activity,}: ActivityLogDealNoteCreatedProps) {const context = useActivityLogContext();+ const isMobile = useIsMobile();const { dealNote } = activity;return (<ActivityLogNote@@ -50,7 +52,7 @@ export function ActivityLogDealNoteCreated({source="deal_id"reference="deals"record={dealNote}- link="show"+ link={isMobile ? false : "show"}/>{context !== "company" && (<>@@ -81,7 +83,7 @@ export function ActivityLogDealNoteCreated({</div>}text={dealNote.text}- link={`/deals/${dealNote.deal_id}/show`}+ link={isMobile ? false : `/deals/${dealNote.deal_id}/show`}/>);}diff --git a/src/components/atomic-crm/activity/ActivityLogNote.tsx b/src/components/atomic-crm/activity/ActivityLogNote.tsxindex 03ff4ee1..204175a0 100644--- a/src/components/atomic-crm/activity/ActivityLogNote.tsx+++ b/src/components/atomic-crm/activity/ActivityLogNote.tsx@@ -6,7 +6,7 @@ import { Markdown } from "../misc/Markdown";type ActivityLogNoteProps = {header: ReactNode;text: string;- link: string;+ link: string | false;};export function ActivityLogNote({ header, text, link }: ActivityLogNoteProps) {@@ -14,17 +14,25 @@ export function ActivityLogNote({ header, text, link }: ActivityLogNoteProps) {return null;}+ const markdownElement = (+ <Markdown className="text-sm line-clamp-3 overflow-hidden [&_p]:my-1 [&_p:first-child]:mt-0 [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_blockquote]:my-1 [&_blockquote]:text-muted-foreground [&_a]:text-primary [&_a]:underline [&_a:hover]:no-underline">+ {text}+ </Markdown>+ );+return (<div className="p-0"><div className="flex flex-col space-y-2 w-full"><div className="flex flex-row space-x-1 items-center w-full">{header}</div>- <Link to={link} className="hover:bg-muted rounded transition-colors">- <Markdown className="text-sm line-clamp-3 overflow-hidden [&_p]:my-1 [&_p:first-child]:mt-0 [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_blockquote]:my-1 [&_blockquote]:text-muted-foreground [&_a]:text-primary [&_a]:underline [&_a:hover]:no-underline">- {text}- </Markdown>- </Link>+ {link !== false ? (+ <Link to={link} className="hover:bg-muted rounded transition-colors">+ {markdownElement}+ </Link>+ ) : (+ markdownElement+ )}</div></div>);