Skip to content

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

Merge origin/main into i18n-user-menu

Anibal Svarcasdc7da74f2210
diff --cc src/components/atomic-crm/contacts/ContactPersonalInfo.tsx
index df2c87f0,f9b0bb2f..802c2e3c
--- a/src/components/atomic-crm/contacts/ContactPersonalInfo.tsx
+++ b/src/components/atomic-crm/contacts/ContactPersonalInfo.tsx
@@@ -1,15 -1,12 +1,16 @@@
+ import { useState } from "react";
-import { useRecordContext, WithRecord } from "ra-core";
+import { useRecordContext, useTranslate, WithRecord } from "ra-core";
import { ArrayField } from "@/components/admin/array-field";
import { SingleFieldList } from "@/components/admin/single-field-list";
import { TextField } from "@/components/admin/text-field";
import { EmailField } from "@/components/admin/email-field";
- import { Mail, Phone, Linkedin } from "lucide-react";
+ import { Mail, Phone, Linkedin, Check } from "lucide-react";
import type { ReactNode } from "react";
-import { contactGender } from "./contactGender";
+import {
+ contactGender,
+ translateContactGenderLabel,
+ translatePersonalInfoTypeLabel,
+} from "./contactGender";
import type { Contact } from "../types";
export const ContactPersonalInfo = () => {
@@@ -84,6 -73,40 +82,41 @@@
);
};
+ const EmailRow = () => {
+ const record = useRecordContext<{ email: string }>();
++ const translate = useTranslate();
+ const [copied, setCopied] = useState(false);
+
+ if (!record) return null;
+
+ const handleCopy = () => {
+ navigator.clipboard.writeText(record.email).then(() => {
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ });
+ };
+
+ return (
+ <PersonalInfoRow
+ icon={
+ <button
+ type="button"
+ onClick={handleCopy}
- title="Copy email address"
++ title={translate("crm.common.copy")}
+ className="text-muted-foreground hover:text-foreground transition-colors cursor-pointer"
+ >
+ {copied ? (
+ <Check className="w-4 h-4 text-green-500" />
+ ) : (
+ <Mail className="w-4 h-4" />
+ )}
+ </button>
+ }
+ primary={<EmailField source="email" />}
+ />
+ );
+ };
+
const PersonalInfoRow = ({
icon,
primary,