Skip to content

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

Polish CRM translation usage

Anibal Svarcasecc676aecb69
diff --git a/src/components/atomic-crm/companies/CompanyAside.tsx b/src/components/atomic-crm/companies/CompanyAside.tsx
index b8d6da22..0ae75499 100644
--- a/src/components/atomic-crm/companies/CompanyAside.tsx
+++ b/src/components/atomic-crm/companies/CompanyAside.tsx
@@ -1,13 +1,18 @@
import { Globe, Linkedin, Phone } from "lucide-react";
-import { useGetIdentity, useRecordContext, useTranslate } from "ra-core";
+import {
+ useGetIdentity,
+ useLocaleState,
+ useRecordContext,
+ useTranslate,
+} from "ra-core";
import { EditButton } from "@/components/admin/edit-button";
import { DeleteButton } from "@/components/admin/delete-button";
import { ShowButton } from "@/components/admin/show-button";
import { TextField } from "@/components/admin/text-field";
-import { DateField } from "@/components/admin/date-field";
import { UrlField } from "@/components/admin/url-field";
import { SelectField } from "@/components/admin/select-field";
+import { formatLocalizedDate } from "../misc/RelativeDate";
import { AsideSection } from "../misc/AsideSection";
import { useConfigurationContext } from "../root/ConfigurationContext";
import type { Company } from "../types";
@@ -28,17 +33,9 @@ export const CompanyAside = ({ link = "edit" }: CompanyAsideProps) => {
<div className="hidden sm:block w-92 min-w-92 space-y-4">
<div className="flex flex-row space-x-1">
{link === "edit" ? (
- <EditButton
- label={translate("resources.companies.action.edit", {
- _: "Edit company",
- })}
- />
+ <EditButton label={translate("resources.companies.action.edit")} />
) : (
- <ShowButton
- label={translate("resources.companies.action.show", {
- _: "Show company",
- })}
- />
+ <ShowButton label={translate("resources.companies.action.show")} />
)}
</div>
@@ -70,9 +67,7 @@ export const CompanyInfo = ({ record }: { record: Company }) => {
return (
<AsideSection
- title={translate("resources.companies.field_categories.contact", {
- _: "Company info",
- })}
+ title={translate("resources.companies.field_categories.contact")}
>
{record.website && (
<div className="flex flex-row items-center gap-1 min-h-[24px]">
@@ -127,9 +122,7 @@ export const ContextInfo = ({ record }: { record: Company }) => {
return (
<AsideSection
- title={translate("resources.companies.field_categories.context", {
- _: "Context",
- })}
+ title={translate("resources.companies.field_categories.context")}
>
{sectorLabel && (
<span>
@@ -150,9 +143,7 @@ export const ContextInfo = ({ record }: { record: Company }) => {
)}
{record.tax_identifier && (
<span>
- {translate("resources.companies.fields.tax_identifier", {
- _: "Tax Identifier",
- })}
+ {translate("resources.companies.fields.tax_identifier", {})}
: <TextField source="tax_identifier" />
</span>
)}
@@ -173,9 +164,7 @@ export const AddressInfo = ({ record }: { record: Company }) => {
return (
<AsideSection
- title={translate("resources.companies.field_categories.address", {
- _: "Main address",
- })}
+ title={translate("resources.companies.field_categories.address")}
noGap
>
<TextField source="address" />
@@ -189,6 +178,7 @@ export const AddressInfo = ({ record }: { record: Company }) => {
export const AdditionalInfo = ({ record }: { record: Company }) => {
const translate = useTranslate();
+ const [locale = "en"] = useLocaleState();
const { identity } = useGetIdentity();
const isCurrentUser = record.sales_id === identity?.id;
const salesName = useGetSalesName(record.sales_id, {
@@ -209,9 +199,7 @@ export const AdditionalInfo = ({ record }: { record: Company }) => {
return (
<AsideSection
- title={translate("resources.companies.field_categories.additional_info", {
- _: "Additional info",
- })}
+ title={translate("resources.companies.field_categories.additional_info")}
>
{record.description && (
<p className="text-sm mb-1">{record.description}</p>
@@ -238,26 +226,17 @@ export const AdditionalInfo = ({ record }: { record: Company }) => {
<div className="inline-flex text-sm text-muted-foreground mb-1">
{translate(
isCurrentUser
- ? "resources.contacts.background.followed_by_you"
- : "resources.contacts.background.followed_by",
+ ? "resources.companies.followed_by_you"
+ : "resources.companies.followed_by",
{ name: salesName },
)}
</div>
)}
{record.created_at && (
<p className="text-sm text-muted-foreground mb-1">
- {translate("resources.contacts.background.added_on", {
- _: "Added on",
+ {translate("resources.companies.added_on", {
+ date: formatLocalizedDate(record.created_at, locale),
})}{" "}
- <DateField
- source="created_at"
- record={record}
- options={{
- year: "numeric",
- month: "long",
- day: "numeric",
- }}
- />
</p>
)}
</AsideSection>
diff --git a/src/components/atomic-crm/companies/CompanyShow.tsx b/src/components/atomic-crm/companies/CompanyShow.tsx
index 1105f0d4..5af84594 100644
--- a/src/components/atomic-crm/companies/CompanyShow.tsx
+++ b/src/components/atomic-crm/companies/CompanyShow.tsx
@@ -25,11 +25,11 @@ import { useIsMobile } from "@/hooks/use-mobile";
import { ActivityLog } from "../activity/ActivityLog";
import { Avatar } from "../contacts/Avatar";
import { TagsList } from "../contacts/TagsList";
-import { findDealLabel } from "../deals/deal";
+import { findDealLabel } from "../deals/dealUtils";
import { MobileContent } from "../layout/MobileContent";
-import { formatRelativeTime } from "../misc/formatRelativeTime";
import MobileHeader from "../layout/MobileHeader";
import { MobileBackButton } from "../misc/MobileBackButton";
+import { formatRelativeDate } from "../misc/RelativeDate";
import { Status } from "../misc/Status";
import { useConfigurationContext } from "../root/ConfigurationContext";
import type { Company, Contact, Deal } from "../types";
@@ -215,12 +215,9 @@ const ContactsIterator = () => {
<div className="text-sm text-muted-foreground">
{contact.title}
{contact.nb_tasks
- ? ` - ${contact.nb_tasks} ${translate(
- "crm.common.task_count",
- {
- smart_count: contact.nb_tasks,
- },
- )}`
+ ? ` - ${translate("crm.common.task_count", {
+ smart_count: contact.nb_tasks,
+ })}`
: ""}
&nbsp; &nbsp;
<TagsList />
@@ -229,8 +226,9 @@ const ContactsIterator = () => {
{contact.last_seen && (
<div className="text-right">
<div className="text-sm text-muted-foreground">
- {translate("crm.common.last_activity")}{" "}
- {formatRelativeTime(contact.last_seen, locale)}{" "}
+ {translate("crm.common.last_activity_with_date", {
+ date: formatRelativeDate(contact.last_seen, locale),
+ })}{" "}
<Status status={contact.status} />
</div>
</div>
@@ -278,7 +276,7 @@ const DealsIterator = () => {
<div className="flex-1 min-w-0">
<div className="font-medium">{deal.name}</div>
<div className="text-sm text-muted-foreground">
- {findDealLabel(dealStages, deal.stage, translate)},{" "}
+ {findDealLabel(dealStages, deal.stage)},{" "}
{deal.amount.toLocaleString("en-US", {
notation: "compact",
style: "currency",
@@ -293,8 +291,9 @@ const DealsIterator = () => {
</div>
<div className="text-right">
<div className="text-sm text-muted-foreground">
- {translate("crm.common.last_activity")}{" "}
- {formatRelativeTime(deal.updated_at, locale)}{" "}
+ {translate("crm.common.last_activity_with_date", {
+ date: formatRelativeDate(deal.updated_at, locale),
+ })}{" "}
</div>
</div>
</RouterLink>
diff --git a/src/components/atomic-crm/contacts/ContactBackgroundInfo.tsx b/src/components/atomic-crm/contacts/ContactBackgroundInfo.tsx
index be5632f9..0105d200 100644
--- a/src/components/atomic-crm/contacts/ContactBackgroundInfo.tsx
+++ b/src/components/atomic-crm/contacts/ContactBackgroundInfo.tsx
@@ -6,7 +6,7 @@ import {
WithRecord,
} from "ra-core";
import { TextField } from "@/components/admin/text-field";
-import { DateField } from "@/components/admin/date-field";
+import { formatLocalizedDate } from "../misc/RelativeDate";
import { useGetSalesName } from "../sales/useGetSalesName";
import type { Contact } from "../types";
@@ -23,12 +23,9 @@ export const ContactBackgroundInfo = () => {
if (!record) return null;
const formattedLastSeen = record.last_seen
- ? new Intl.DateTimeFormat(locale, {
- year: "numeric",
- month: "long",
- day: "numeric",
- }).format(new Date(record.last_seen))
+ ? formatLocalizedDate(record.last_seen, locale)
: "";
+ const formattedFirstSeen = formatLocalizedDate(record.first_seen, locale);
return (
<div>
@@ -44,21 +41,15 @@ export const ContactBackgroundInfo = () => {
<div className="text-muted-foreground md:py-0.5">
<span className="text-sm">
{translate("resources.contacts.background.added_on", {
- _: "Added on",
+ date: formattedFirstSeen,
})}
</span>{" "}
- <DateField
- source="first_seen"
- options={{ year: "numeric", month: "long", day: "numeric" }}
- className="text-sm"
- />
</div>
<div className="text-muted-foreground md:py-0.5">
<span className="text-sm">
{translate("resources.contacts.background.last_activity_on", {
date: formattedLastSeen,
- _: `Last activity on ${formattedLastSeen}`,
})}
</span>
</div>
diff --git a/src/components/atomic-crm/contacts/ContactImportButton.tsx b/src/components/atomic-crm/contacts/ContactImportButton.tsx
index 224781d0..ce6e5d65 100644
--- a/src/components/atomic-crm/contacts/ContactImportButton.tsx
+++ b/src/components/atomic-crm/contacts/ContactImportButton.tsx
@@ -99,7 +99,9 @@ export function ContactImportDialog({
<DialogContent className="max-w-2xl">
<Form className="flex flex-col gap-4">
<DialogHeader>
- <DialogTitle>{translate("crm.import.action.import")}</DialogTitle>
+ <DialogTitle>
+ {translate("resources.contacts.import.title")}
+ </DialogTitle>
</DialogHeader>
<div className="flex flex-col space-y-2">
@@ -108,32 +110,22 @@ export function ContactImportDialog({
<Alert>
<AlertDescription className="flex flex-row gap-4">
<Loader2 className="h-5 w-5 animate-spin" />
- {translate("resources.contacts.import.running", {
- _: "The import is running, please do not close this tab.",
- })}
+ {translate("resources.contacts.import.running")}
</AlertDescription>
</Alert>
<div className="text-sm">
- {translate("resources.contacts.import.imported", {
- _: "Imported",
- })}{" "}
- <strong>
- {importer.importCount} / {importer.rowCount}
- </strong>{" "}
- {translate("resources.contacts.import.contacts_label", {
- smart_count: 2,
- _: "contacts",
+ {translate("resources.contacts.import.progress", {
+ importCount: importer.importCount,
+ rowCount: importer.rowCount,
+ errorCount: importer.errorCount,
})}
- , {translate("crm.common.with")}{" "}
- <strong>{importer.errorCount}</strong>{" "}
- {translate("crm.common.errors")}.
{importer.remainingTime !== null && (
<>
{" "}
- {translate("resources.contacts.import.remaining_time", {
- _: "Estimated remaining time:",
- })}{" "}
+ {translate(
+ "resources.contacts.import.remaining_time",
+ )}{" "}
<strong>
{millisecondsToTime(importer.remainingTime)}
</strong>
@@ -142,9 +134,7 @@ export function ContactImportDialog({
onClick={handleReset}
className="text-red-600 underline hover:text-red-800"
>
- {translate("resources.contacts.import.stop", {
- _: "Stop import",
- })}
+ {translate("resources.contacts.import.stop")}
</button>
</>
)}
@@ -155,9 +145,7 @@ export function ContactImportDialog({
{importer.state === "error" && (
<Alert variant="destructive">
<AlertDescription>
- {translate("resources.contacts.import.error", {
- _: "Failed to import this file, please make sure your provided a valid CSV file.",
- })}
+ {translate("resources.contacts.import.error")}
</AlertDescription>
</Alert>
)}
@@ -168,7 +156,6 @@ export function ContactImportDialog({
{translate("resources.contacts.import.complete", {
importCount: importer.importCount,
errorCount: importer.errorCount,
- _: `Contacts import complete. Imported ${importer.importCount} contacts, with ${importer.errorCount} errors`,
})}
</AlertDescription>
</Alert>
@@ -178,20 +165,13 @@ export function ContactImportDialog({
<>
<Alert>
<AlertDescription className="flex flex-col gap-4">
- {translate("resources.contacts.import.sample_hint", {
- _: "Here is a sample CSV file you can use as a template",
- })}
+ {translate("resources.contacts.import.sample_hint")}
<Button asChild variant="outline" size="sm">
<Link
to={SAMPLE_URL}
download={"crm_contacts_sample.csv"}
>
- {translate(
- "resources.contacts.import.sample_download",
- {
- _: "Download CSV sample",
- },
- )}
+ {translate("resources.contacts.import.sample_download")}
</Link>
</Button>{" "}
</AlertDescription>
@@ -214,7 +194,7 @@ export function ContactImportDialog({
<FormToolbar>
{importer.state === "idle" ? (
<Button onClick={startImport} disabled={!file}>
- {translate("crm.import.action.import")}
+ {translate("resources.contacts.import.button")}
</Button>
) : (
<Button
diff --git a/src/components/atomic-crm/contacts/ContactInputs.tsx b/src/components/atomic-crm/contacts/ContactInputs.tsx
index 2c8c7635..87c330f5 100644
--- a/src/components/atomic-crm/contacts/ContactInputs.tsx
+++ b/src/components/atomic-crm/contacts/ContactInputs.tsx
@@ -12,12 +12,14 @@ import { ArrayInput } from "@/components/admin/array-input";
import { SimpleFormIterator } from "@/components/admin/simple-form-iterator";
import { isLinkedinUrl } from "../misc/isLinkedInUrl";
-import { contactGender } from "./contactGender";
+import {
+ contactGender,
+ translateContactGenderLabel,
+ translatePersonalInfoTypeLabel,
+} from "./contactGender";
import type { Sale } from "../types";
import { Avatar } from "./Avatar";
import { AutocompleteCompanyInput } from "../companies/AutocompleteCompanyInput.tsx";
-import { getTranslatedContactGenderLabel } from "./getTranslatedContactGenderLabel";
-import { getTranslatedPersonalInfoTypeLabel } from "./getTranslatedPersonalInfoTypeLabel";
export const ContactInputs = () => {
const isMobile = useIsMobile();
@@ -57,9 +59,7 @@ const ContactIdentityInputs = () => {
source="gender"
choices={contactGender}
helperText={false}
- optionText={(choice) =>
- getTranslatedContactGenderLabel(choice, translate)
- }
+ optionText={(choice) => translateContactGenderLabel(choice, translate)}
translateChoice={false}
optionValue="value"
defaultValue={contactGender[0].value}
@@ -91,15 +91,15 @@ const ContactPersonalInformationInputs = () => {
const personalInfoTypes = [
{
id: "Work",
- name: getTranslatedPersonalInfoTypeLabel("Work", translate),
+ name: translatePersonalInfoTypeLabel("Work", translate),
},
{
id: "Home",
- name: getTranslatedPersonalInfoTypeLabel("Home", translate),
+ name: translatePersonalInfoTypeLabel("Home", translate),
},
{
id: "Other",
- name: getTranslatedPersonalInfoTypeLabel("Other", translate),
+ name: translatePersonalInfoTypeLabel("Other", translate),
},
];
@@ -200,7 +200,9 @@ const ContactMiscInputs = () => {
const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">{translate("crm.common.misc")}</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("resources.contacts.field_categories.misc")}
+ </h6>
<TextInput source="background" multiline helperText={false} />
<BooleanInput source="has_newsletter" helperText={false} />
<ReferenceInput
diff --git a/src/components/atomic-crm/contacts/ContactListContent.tsx b/src/components/atomic-crm/contacts/ContactListContent.tsx
index f0dca135..3d2d23d0 100644
--- a/src/components/atomic-crm/contacts/ContactListContent.tsx
+++ b/src/components/atomic-crm/contacts/ContactListContent.tsx
@@ -4,6 +4,7 @@ import {
RecordContextProvider,
RecordRepresentation,
useListContext,
+ useLocaleState,
useTimeout,
useTranslate,
} from "ra-core";
@@ -17,7 +18,7 @@ import { Button } from "@/components/ui/button";
import { RotateCcw } from "lucide-react";
import { Status } from "../misc/Status";
-import { RelativeDate } from "../misc/RelativeDate";
+import { formatRelativeDate } from "../misc/RelativeDate";
import type { Contact } from "../types";
import { Avatar } from "./Avatar";
import { TagsList } from "./TagsList";
@@ -88,9 +89,7 @@ export const ContactListContent = () => {
{contacts.length === 0 && (
<div className="p-4">
<div className="text-muted-foreground">
- {translate("resources.contacts.empty.title", {
- _: "No contacts found",
- })}
+ {translate("resources.contacts.empty.title", {})}
</div>
</div>
)}
@@ -106,7 +105,11 @@ const ContactItemContent = ({
handleToggleItem: (id: Identifier, event: MouseEvent) => void;
}) => {
const translate = useTranslate();
+ const [locale = "en"] = useLocaleState();
const { selectedIds } = useListContext<Contact>();
+ const lastActivity = contact.last_seen
+ ? formatRelativeDate(contact.last_seen, locale)
+ : null;
return (
<div className="flex flex-row items-center pl-2 pr-4 py-2 hover:bg-muted transition-colors first:rounded-t-xl last:rounded-b-xl">
@@ -145,7 +148,7 @@ const ContactItemContent = ({
</ReferenceField>
)}
{contact.nb_tasks
- ? ` - ${contact.nb_tasks} ${translate("crm.common.task_count", {
+ ? ` - ${translate("crm.common.task_count", {
smart_count: contact.nb_tasks,
})}`
: ""}
@@ -160,8 +163,9 @@ const ContactItemContent = ({
className="text-sm text-muted-foreground"
title={contact.last_seen}
>
- {`${translate("crm.common.last_activity")} `}
- <RelativeDate date={contact.last_seen} />{" "}
+ {translate("crm.common.last_activity_with_date", {
+ date: lastActivity,
+ })}{" "}
<Status status={contact.status} />
</div>
</div>
@@ -279,7 +283,6 @@ const ContactItemContentMobile = ({ contact }: { contact: Contact }) => {
</span>
{contact.nb_tasks ? (
<span>
- {contact.nb_tasks}{" "}
{translate("crm.common.task_count", {
smart_count: contact.nb_tasks,
})}
diff --git a/src/components/atomic-crm/contacts/ContactListFilter.tsx b/src/components/atomic-crm/contacts/ContactListFilter.tsx
index ba7dbbe0..57f17720 100644
--- a/src/components/atomic-crm/contacts/ContactListFilter.tsx
+++ b/src/components/atomic-crm/contacts/ContactListFilter.tsx
@@ -33,12 +33,12 @@ export const ContactListFilter = () => {
}}
>
<FilterCategory
- label={translate("resources.contacts.fields.last_seen")}
+ label="resources.contacts.fields.last_seen"
icon={<Clock />}
>
<ToggleFilterButton
className="w-auto md:w-full justify-between h-10 md:h-8"
- label={translate("resources.contacts.filters.today")}
+ label="resources.contacts.filters.today"
value={{
"last_seen@gte": endOfYesterday().toISOString(),
"last_seen@lte": undefined,
@@ -47,7 +47,7 @@ export const ContactListFilter = () => {
/>
<ToggleFilterButton
className="w-auto md:w-full justify-between h-10 md:h-8"
- label={translate("resources.contacts.filters.this_week")}
+ label="resources.contacts.filters.this_week"
value={{
"last_seen@gte": startOfWeek(new Date()).toISOString(),
"last_seen@lte": undefined,
@@ -56,7 +56,7 @@ export const ContactListFilter = () => {
/>
<ToggleFilterButton
className="w-auto md:w-full justify-between h-10 md:h-8"
- label={translate("resources.contacts.filters.before_this_week")}
+ label="resources.contacts.filters.before_this_week"
value={{
"last_seen@gte": undefined,
"last_seen@lte": startOfWeek(new Date()).toISOString(),
@@ -65,7 +65,7 @@ export const ContactListFilter = () => {
/>
<ToggleFilterButton
className="w-auto md:w-full justify-between h-10 md:h-8"
- label={translate("resources.contacts.filters.before_this_month")}
+ label="resources.contacts.filters.before_this_month"
value={{
"last_seen@gte": undefined,
"last_seen@lte": startOfMonth(new Date()).toISOString(),
@@ -74,7 +74,7 @@ export const ContactListFilter = () => {
/>
<ToggleFilterButton
className="w-auto md:w-full justify-between h-10 md:h-8"
- label={translate("resources.contacts.filters.before_last_month")}
+ label="resources.contacts.filters.before_last_month"
value={{
"last_seen@gte": undefined,
"last_seen@lte": subMonths(
@@ -87,7 +87,7 @@ export const ContactListFilter = () => {
</FilterCategory>
<FilterCategory
- label={translate("resources.notes.fields.status")}
+ label="resources.notes.fields.status"
icon={<TrendingUp />}
>
{noteStatuses.map((status) => (
@@ -105,10 +105,7 @@ export const ContactListFilter = () => {
))}
</FilterCategory>
- <FilterCategory
- label={translate("resources.tags.name", { smart_count: 2 })}
- icon={<Tag />}
- >
+ <FilterCategory label="resources.tags.name" icon={<Tag />}>
{data &&
data.map((record) => (
<ToggleFilterButton
@@ -131,13 +128,10 @@ export const ContactListFilter = () => {
))}
</FilterCategory>
- <FilterCategory
- icon={<CheckSquare />}
- label={translate("resources.tasks.name", { smart_count: 2 })}
- >
+ <FilterCategory icon={<CheckSquare />} label="resources.tasks.name">
<ToggleFilterButton
className="w-full justify-between h-10 md:h-8"
- label={translate("resources.tasks.filters.with_pending")}
+ label="resources.tasks.filters.with_pending"
value={{ "nb_tasks@gt": 0 }}
size={isMobile ? "lg" : undefined}
/>
@@ -149,7 +143,7 @@ export const ContactListFilter = () => {
>
<ToggleFilterButton
className="w-full justify-between h-10 md:h-8"
- label={translate("crm.common.me")}
+ label="crm.common.me"
value={{ sales_id: identity?.id }}
size={isMobile ? "lg" : undefined}
/>
@@ -161,7 +155,6 @@ export const ContactListFilter = () => {
export const ContactListFilterSummary = () => {
const { noteStatuses } = useConfigurationContext();
const { identity } = useGetIdentity();
- const translate = useTranslate();
const { data } = useGetList("tags", {
pagination: { page: 1, perPage: 10 },
sort: { field: "name", order: "ASC" },
@@ -179,7 +172,7 @@ export const ContactListFilterSummary = () => {
<div className="flex flex-wrap items-start mb-4 gap-1">
<ActiveFilterButton
className="w-auto justify-between h-8"
- label={translate("resources.contacts.filters.today")}
+ label="resources.contacts.filters.today"
value={{
"last_seen@gte": endOfYesterday().toISOString(),
"last_seen@lte": undefined,
@@ -187,7 +180,7 @@ export const ContactListFilterSummary = () => {
/>
<ActiveFilterButton
className="w-auto justify-between h-8"
- label={translate("resources.contacts.filters.this_week")}
+ label="resources.contacts.filters.this_week"
value={{
"last_seen@gte": startOfWeek(new Date()).toISOString(),
"last_seen@lte": undefined,
@@ -195,7 +188,7 @@ export const ContactListFilterSummary = () => {
/>
<ActiveFilterButton
className="w-auto justify-between h-8"
- label={translate("resources.contacts.filters.before_this_week")}
+ label="resources.contacts.filters.before_this_week"
value={{
"last_seen@gte": undefined,
"last_seen@lte": startOfWeek(new Date()).toISOString(),
@@ -203,7 +196,7 @@ export const ContactListFilterSummary = () => {
/>
<ActiveFilterButton
className="w-auto justify-between h-8"
- label={translate("resources.contacts.filters.before_this_month")}
+ label="resources.contacts.filters.before_this_month"
value={{
"last_seen@gte": undefined,
"last_seen@lte": startOfMonth(new Date()).toISOString(),
@@ -211,7 +204,7 @@ export const ContactListFilterSummary = () => {
/>
<ActiveFilterButton
className="w-auto justify-between h-8"
- label={translate("resources.contacts.filters.before_last_month")}
+ label="resources.contacts.filters.before_last_month"
value={{
"last_seen@gte": undefined,
"last_seen@lte": subMonths(startOfMonth(new Date()), 1).toISOString(),
@@ -253,13 +246,13 @@ export const ContactListFilterSummary = () => {
<ActiveFilterButton
className="w-auto justify-between h-8"
- label={translate("resources.tasks.filters.with_pending")}
+ label="resources.tasks.filters.with_pending"
value={{ "nb_tasks@gt": 0 }}
/>
<ActiveFilterButton
className="w-auto justify-between h-8"
- label={translate("resources.contacts.filters.managed_by_me")}
+ label="resources.contacts.filters.managed_by_me"
value={{ sales_id: identity?.id }}
/>
</div>
diff --git a/src/components/atomic-crm/contacts/ContactPersonalInfo.tsx b/src/components/atomic-crm/contacts/ContactPersonalInfo.tsx
index 7c58f7cb..df2c87f0 100644
--- a/src/components/atomic-crm/contacts/ContactPersonalInfo.tsx
+++ b/src/components/atomic-crm/contacts/ContactPersonalInfo.tsx
@@ -5,9 +5,11 @@ import { TextField } from "@/components/admin/text-field";
import { EmailField } from "@/components/admin/email-field";
import { Mail, Phone, Linkedin } from "lucide-react";
import type { ReactNode } from "react";
-import { contactGender } from "./contactGender";
-import { getTranslatedContactGenderLabel } from "./getTranslatedContactGenderLabel";
-import { getTranslatedPersonalInfoTypeLabel } from "./getTranslatedPersonalInfoTypeLabel";
+import {
+ contactGender,
+ translateContactGenderLabel,
+ translatePersonalInfoTypeLabel,
+} from "./contactGender";
import type { Contact } from "../types";
export const ContactPersonalInfo = () => {
@@ -69,7 +71,7 @@ export const ContactPersonalInfo = () => {
}
primary={
<div>
- {getTranslatedContactGenderLabel(genderOption, translate)}
+ {translateContactGenderLabel(genderOption, translate)}
</div>
}
/>
@@ -103,7 +105,7 @@ const PersonalInfoRow = ({
render={(row) =>
row.type !== "Other" && (
<span className="text-muted-foreground">
- {getTranslatedPersonalInfoTypeLabel(row.type, translate)}
+ {translatePersonalInfoTypeLabel(row.type, translate)}
</span>
)
}
diff --git a/src/components/atomic-crm/contacts/ContactShow.tsx b/src/components/atomic-crm/contacts/ContactShow.tsx
index c7c20845..4d3c3d68 100644
--- a/src/components/atomic-crm/contacts/ContactShow.tsx
+++ b/src/components/atomic-crm/contacts/ContactShow.tsx
@@ -2,11 +2,11 @@ import { useState } from "react";
import {
RecordRepresentation,
ShowBase,
+ useReferenceManyFieldController,
useShowContext,
useTranslate,
} from "ra-core";
import { useIsMobile } from "@/hooks/use-mobile";
-import { ReferenceManyCount } from "@/components/admin/reference-many-count";
import { ReferenceField } from "@/components/admin/reference-field";
import { ReferenceManyField } from "@/components/admin/reference-many-field";
import { TextField } from "@/components/admin/text-field";
@@ -54,7 +54,7 @@ export const ContactShow = () => {
const ContactShowContentMobile = () => {
const translate = useTranslate();
- const { record, isPending } = useShowContext<Contact>();
+ const { defaultTitle, record, isPending } = useShowContext<Contact>();
const [noteCreateOpen, setNoteCreateOpen] = useState(false);
const [editOpen, setEditOpen] = useState(false);
if (isPending || !record) return null;
@@ -77,9 +77,7 @@ const ContactShowContentMobile = () => {
<MobileBackButton />
<div className="flex flex-1 min-w-0">
<Link to="/contacts" className="flex-1 min-w-0">
- <h1 className="truncate text-xl font-semibold">
- <RecordRepresentation />
- </h1>
+ <h1 className="truncate text-xl font-semibold">{defaultTitle}</h1>
</Link>
</div>
<Button
@@ -137,12 +135,7 @@ const ContactShowContentMobile = () => {
{translate("resources.notes.name", { smart_count: 2 })}
</TabsTrigger>
<TabsTrigger value="tasks">
- <ReferenceManyCount
- target="contact_id"
- reference="tasks"
- filter={{ "done_date@is": null }}
- />{" "}
- {translate("resources.tasks.name", { smart_count: 2 })}
+ <PendingTasksTabLabel />
</TabsTrigger>
<TabsTrigger value="details">
{translate("crm.common.details")}
@@ -228,6 +221,20 @@ const ContactShowContentMobile = () => {
);
};
+const PendingTasksTabLabel = () => {
+ const translate = useTranslate();
+ const { total = 0 } = useReferenceManyFieldController<Contact>({
+ filter: { "done_date@is": null },
+ page: 1,
+ perPage: 1,
+ reference: "tasks",
+ source: "id",
+ target: "contact_id",
+ });
+
+ return translate("crm.common.task_count", { smart_count: total });
+};
+
const ContactShowContent = () => {
const translate = useTranslate();
const { record, isPending } = useShowContext<Contact>();
diff --git a/src/components/atomic-crm/contacts/TagsListEdit.tsx b/src/components/atomic-crm/contacts/TagsListEdit.tsx
index 0e8b4817..d6c1ddf2 100644
--- a/src/components/atomic-crm/contacts/TagsListEdit.tsx
+++ b/src/components/atomic-crm/contacts/TagsListEdit.tsx
@@ -146,9 +146,7 @@ export const TagsListEdit = () => {
className="w-full justify-start p-0 cursor-pointer text-base md:text-sm"
>
<Edit className="w-4 h-4 md:w-3 md:h-3 mr-2" />
- {translate("resources.tags.action.create_new", {
- _: "Create new tag",
- })}
+ {translate("resources.tags.action.create")}
</Button>
</DropdownMenuItem>
</DropdownMenuContent>
diff --git a/src/components/atomic-crm/dashboard/DealsChart.tsx b/src/components/atomic-crm/dashboard/DealsChart.tsx
index f5bf2e10..dbd3bcde 100644
--- a/src/components/atomic-crm/dashboard/DealsChart.tsx
+++ b/src/components/atomic-crm/dashboard/DealsChart.tsx
@@ -4,7 +4,7 @@ import { DollarSign } from "lucide-react";
import { useGetList, useTranslate } from "ra-core";
import { memo, useMemo } from "react";
-import { findDealLabel } from "../deals/deal";
+import { findDealLabel } from "../deals/dealUtils";
import { useConfigurationContext } from "../root/ConfigurationContext";
import type { Deal } from "../types";
@@ -96,9 +96,7 @@ export const DealsChart = memo(() => {
<DollarSign className="text-muted-foreground w-6 h-6" />
</div>
<h2 className="text-xl font-semibold text-muted-foreground">
- {translate("crm.dashboard.deals_chart", {
- _: "Upcoming Deal Revenue",
- })}
+ {translate("crm.dashboard.deals_chart")}
</h2>
</div>
<div className="h-[400px]">
diff --git a/src/components/atomic-crm/dashboard/DealsPipeline.tsx b/src/components/atomic-crm/dashboard/DealsPipeline.tsx
index 14fd1541..c41fed92 100644
--- a/src/components/atomic-crm/dashboard/DealsPipeline.tsx
+++ b/src/components/atomic-crm/dashboard/DealsPipeline.tsx
@@ -6,7 +6,7 @@ import { Card } from "@/components/ui/card";
import { SimpleList } from "../simple-list/SimpleList";
import { CompanyAvatar } from "../companies/CompanyAvatar";
-import { findDealLabel } from "../deals/deal";
+import { findDealLabel } from "../deals/dealUtils";
import { useConfigurationContext } from "../root/ConfigurationContext";
import type { Deal } from "../types";
@@ -71,7 +71,7 @@ export const DealsPipeline = () => {
currency: "USD",
currencyDisplay: "narrowSymbol",
minimumSignificantDigits: 3,
- })} , ${findDealLabel(dealStages, deal.stage, translate)}`
+ })} , ${findDealLabel(dealStages, deal.stage)}`
}
leftAvatar={(deal) => (
<ReferenceField
diff --git a/src/components/atomic-crm/dashboard/HotContacts.tsx b/src/components/atomic-crm/dashboard/HotContacts.tsx
index 1124e5ae..84327384 100644
--- a/src/components/atomic-crm/dashboard/HotContacts.tsx
+++ b/src/components/atomic-crm/dashboard/HotContacts.tsx
@@ -55,9 +55,7 @@ export const HotContacts = () => {
</Button>
</TooltipTrigger>
<TooltipContent>
- {translate("resources.contacts.hot.create", {
- _: "Create contact",
- })}
+ {translate("resources.contacts.action.create")}
</TooltipContent>
</Tooltip>
</TooltipProvider>
@@ -87,14 +85,10 @@ export const HotContacts = () => {
empty={
<div className="p-4">
<p className="text-sm mb-4">
- {translate("resources.contacts.hot.empty_hint", {
- _: 'Contacts with a "hot" status will appear here.',
- })}
+ {translate("resources.contacts.hot.empty_hint")}
</p>
<p className="text-sm">
- {translate("resources.contacts.hot.empty_change_status", {
- _: 'Change the status of a contact by adding a note to that contact and clicking on "show options".',
- })}
+ {translate("resources.contacts.hot.empty_change_status")}
</p>
</div>
}
diff --git a/src/components/atomic-crm/dashboard/Welcome.tsx b/src/components/atomic-crm/dashboard/Welcome.tsx
index f05215ad..416e4e8d 100644
--- a/src/components/atomic-crm/dashboard/Welcome.tsx
+++ b/src/components/atomic-crm/dashboard/Welcome.tsx
@@ -1,10 +1,13 @@
+import { useTranslate } from "ra-core";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
export const Welcome = () => {
+ const translate = useTranslate();
+
return (
<Card>
<CardHeader className="px-4">
- <CardTitle>Your CRM Starter Kit</CardTitle>
+ <CardTitle>{translate("crm.dashboard.welcome.title")}</CardTitle>
</CardHeader>
<CardContent className="px-4">
<p className="text-sm mb-4">
@@ -14,21 +17,20 @@ export const Welcome = () => {
>
Atomic CRM
</a>{" "}
- is a template designed to help you quickly build your own CRM.
+ {translate("crm.dashboard.welcome.paragraph_1")}
</p>
<p className="text-sm mb-4">
- This demo runs on a mock API, so you can explore and modify the data.
- It resets on reload. The full version uses Supabase for the backend.
+ {translate("crm.dashboard.welcome.paragraph_2")}
</p>
<p className="text-sm">
- Powered by
+ {translate("crm.dashboard.welcome.powered_by")}{" "}
<a
href="https://marmelab.com/shadcn-admin-kit"
className="underline hover:no-underline"
>
shadcn-admin-kit
- </a>
- Atomic CRM is fully open-source. You can find the code at{" "}
+ </a>{" "}
+ {translate("crm.dashboard.welcome.paragraph_3")}{" "}
<a
href="https://github.com/marmelab/atomic-crm"
className="underline hover:no-underline"
diff --git a/src/components/atomic-crm/deals/DealArchivedList.tsx b/src/components/atomic-crm/deals/DealArchivedList.tsx
index 4950dae5..788c9a41 100644
--- a/src/components/atomic-crm/deals/DealArchivedList.tsx
+++ b/src/components/atomic-crm/deals/DealArchivedList.tsx
@@ -1,14 +1,20 @@
-/* eslint-disable react-refresh/only-export-components */
-import { useGetIdentity, useGetList, useTranslate } from "ra-core";
+import {
+ useGetIdentity,
+ useGetList,
+ useLocaleState,
+ useTranslate,
+} from "ra-core";
import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
import type { Deal } from "../types";
import { DealCardContent } from "./DealCard";
+import { getRelativeTimeString } from "./dealUtils";
export const DealArchivedList = () => {
const translate = useTranslate();
+ const [locale = "en"] = useLocaleState();
const { identity } = useGetIdentity();
const {
data: archivedLists,
@@ -53,21 +59,19 @@ export const DealArchivedList = () => {
onClick={() => setOpenDialog(true)}
className="my-4"
>
- {translate("resources.deals.archived.view", {
- _: "View archived deals",
- })}
+ {translate("resources.deals.archived.view")}
</Button>
<Dialog open={openDialog} onOpenChange={() => setOpenDialog(false)}>
<DialogContent className="lg:max-w-4xl overflow-y-auto max-h-9/10 top-1/20 translate-y-0">
<DialogTitle>
- {translate("resources.deals.archived.list_title", {
- _: "Archived Deals",
- })}
+ {translate("resources.deals.archived.list_title")}
</DialogTitle>
<div className="flex flex-col gap-8">
{Object.entries(archivedListsByDate).map(([date, deals]) => (
<div key={date} className="flex flex-col gap-4">
- <h4 className="font-bold">{getRelativeTimeString(date)}</h4>
+ <h4 className="font-bold">
+ {getRelativeTimeString(date, locale)}
+ </h4>
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-8">
{deals.map((deal: Deal) => (
<div key={deal.id}>
@@ -83,30 +87,3 @@ export const DealArchivedList = () => {
</div>
);
};
-
-export function getRelativeTimeString(dateString: string): string {
- const date = new Date(dateString);
- date.setHours(0, 0, 0, 0);
-
- const today = new Date();
- today.setHours(0, 0, 0, 0);
-
- const diff = date.getTime() - today.getTime();
- const unitDiff = Math.round(diff / (1000 * 60 * 60 * 24));
-
- // Check if the date is more than one week old
- if (Math.abs(unitDiff) > 7) {
- return new Intl.DateTimeFormat(undefined, {
- day: "numeric",
- month: "long",
- }).format(date);
- }
-
- // Intl.RelativeTimeFormat for dates within the last week
- const rtf = new Intl.RelativeTimeFormat(undefined, { numeric: "auto" });
- return ucFirst(rtf.format(unitDiff, "day"));
-}
-
-function ucFirst(str: string): string {
- return str.charAt(0).toUpperCase() + str.slice(1);
-}
diff --git a/src/components/atomic-crm/deals/DealColumn.tsx b/src/components/atomic-crm/deals/DealColumn.tsx
index ab925b44..ee21240b 100644
--- a/src/components/atomic-crm/deals/DealColumn.tsx
+++ b/src/components/atomic-crm/deals/DealColumn.tsx
@@ -1,9 +1,8 @@
import { Droppable } from "@hello-pangea/dnd";
-import { useTranslate } from "ra-core";
import { useConfigurationContext } from "../root/ConfigurationContext";
import type { Deal } from "../types";
-import { findDealLabel } from "./deal";
+import { findDealLabel } from "./dealUtils";
import { DealCard } from "./DealCard";
export const DealColumn = ({
@@ -14,14 +13,12 @@ export const DealColumn = ({
deals: Deal[];
}) => {
const totalAmount = deals.reduce((sum, deal) => sum + deal.amount, 0);
- const translate = useTranslate();
-
const { dealStages } = useConfigurationContext();
return (
<div className="flex-1 pb-8">
<div className="flex flex-col items-center">
<h3 className="text-base font-medium">
- {findDealLabel(dealStages, stage, translate)}
+ {findDealLabel(dealStages, stage)}
</h3>
<p className="text-sm text-muted-foreground">
{totalAmount.toLocaleString("en-US", {
diff --git a/src/components/atomic-crm/deals/DealEdit.tsx b/src/components/atomic-crm/deals/DealEdit.tsx
index c7bca0d8..daeb4d1c 100644
--- a/src/components/atomic-crm/deals/DealEdit.tsx
+++ b/src/components/atomic-crm/deals/DealEdit.tsx
@@ -1,6 +1,7 @@
import {
EditBase,
Form,
+ useEditContext,
useNotify,
useRecordContext,
useRedirect,
@@ -36,9 +37,7 @@ export const DealEdit = ({ open, id }: { open: boolean; id?: string }) => {
mutationMode="pessimistic"
mutationOptions={{
onSuccess: () => {
- notify("resources.deals.updated", {
- messageArgs: { _: "Deal updated" },
- });
+ notify("resources.deals.updated", {});
redirect(`/deals/${id}/show`, undefined, undefined, undefined, {
_scrollToTop: false,
});
@@ -59,6 +58,7 @@ export const DealEdit = ({ open, id }: { open: boolean; id?: string }) => {
function EditHeader() {
const translate = useTranslate();
+ const { defaultTitle } = useEditContext<Deal>();
const deal = useRecordContext<Deal>();
if (!deal) {
return null;
@@ -71,20 +71,13 @@ function EditHeader() {
<ReferenceField source="company_id" reference="companies" link="show">
<CompanyAvatar />
</ReferenceField>
- <h2 className="text-2xl font-semibold">
- {translate("resources.deals.edit.title", {
- _: `Edit ${deal.name} deal`,
- name: deal.name,
- })}
- </h2>
+ <h2 className="text-2xl font-semibold">{defaultTitle}</h2>
</div>
<div className="flex gap-2 pr-12">
<DeleteButton />
<Button asChild variant="outline" className="h-9">
<Link to={`/deals/${deal.id}/show`}>
- {translate("resources.deals.action.back_to_deal", {
- _: "Back to deal",
- })}
+ {translate("resources.deals.action.back_to_deal")}
</Link>
</Button>
</div>
diff --git a/src/components/atomic-crm/deals/DealInputs.tsx b/src/components/atomic-crm/deals/DealInputs.tsx
index 76f6045d..76d35541 100644
--- a/src/components/atomic-crm/deals/DealInputs.tsx
+++ b/src/components/atomic-crm/deals/DealInputs.tsx
@@ -67,7 +67,9 @@ const DealMiscInputs = () => {
const translate = useTranslate();
return (
<div className="flex flex-col gap-4 flex-1">
- <h3 className="text-base font-medium">{translate("crm.common.misc")}</h3>
+ <h3 className="text-base font-medium">
+ {translate("resources.deals.field_categories.misc")}
+ </h3>
<SelectInput
source="category"
diff --git a/src/components/atomic-crm/deals/DealShow.tsx b/src/components/atomic-crm/deals/DealShow.tsx
index 34232e04..01325d86 100644
--- a/src/components/atomic-crm/deals/DealShow.tsx
+++ b/src/components/atomic-crm/deals/DealShow.tsx
@@ -27,8 +27,7 @@ import { NotesIterator } from "../notes/NotesIterator";
import { useConfigurationContext } from "../root/ConfigurationContext";
import type { Deal } from "../types";
import { ContactList } from "./ContactList";
-import { findDealLabel } from "./deal";
-import { formatISODateString } from "./dealUtils";
+import { findDealLabel, formatISODateString } from "./dealUtils";
export const DealShow = ({ open, id }: { open: boolean; id?: string }) => {
const redirect = useRedirect();
@@ -95,7 +94,7 @@ const DealShowContent = () => {
<span className="text-sm">
{isValid(new Date(record.expected_closing_date))
? formatISODateString(record.expected_closing_date)
- : translate("crm.common.invalid_date")}
+ : translate("resources.deals.invalid_date")}
</span>
{new Date(record.expected_closing_date) < new Date() ? (
<Badge variant="destructive">
@@ -137,7 +136,7 @@ const DealShowContent = () => {
{translate("resources.deals.fields.stage")}
</span>
<span className="text-sm">
- {findDealLabel(dealStages, record.stage, translate)}
+ {findDealLabel(dealStages, record.stage)}
</span>
</div>
</div>
@@ -215,14 +214,12 @@ const ArchiveButton = ({ record }: { record: Deal }) => {
notify("resources.deals.archived.success", {
type: "info",
undoable: false,
- messageArgs: { _: "Deal archived" },
});
refresh();
},
onError: () => {
notify("resources.deals.archived.error", {
type: "error",
- messageArgs: { _: "Error: deal not archived" },
});
},
},
@@ -256,14 +253,12 @@ const UnarchiveButton = ({ record }: { record: Deal }) => {
notify("resources.deals.unarchived.success", {
type: "info",
undoable: false,
- messageArgs: { _: "Deal unarchived" },
});
refresh();
},
onError: () => {
notify("resources.deals.unarchived.error", {
type: "error",
- messageArgs: { _: "Error: deal not unarchived" },
});
},
});
diff --git a/src/components/atomic-crm/notes/NoteShowPage.tsx b/src/components/atomic-crm/notes/NoteShowPage.tsx
index 1efffac2..0a064161 100644
--- a/src/components/atomic-crm/notes/NoteShowPage.tsx
+++ b/src/components/atomic-crm/notes/NoteShowPage.tsx
@@ -1,5 +1,6 @@
import { Pencil } from "lucide-react";
import {
+ useGetRecordRepresentation,
RecordRepresentation,
useGetIdentity,
useGetOne,
@@ -28,6 +29,7 @@ export const NoteShowPage = () => {
noteId: string;
}>();
const [editOpen, setEditOpen] = useState(false);
+ const getContactRepresentation = useGetRecordRepresentation("contacts");
const { data: note, isPending } = useGetOne<ContactNote>("contact_notes", {
id: noteId!,
@@ -52,13 +54,19 @@ export const NoteShowPage = () => {
<div className="flex flex-1 min-w-0">
<Link to={`/contacts/${contactId}/show`} className="flex-1 min-w-0">
<h1 className="truncate text-xl font-semibold">
- {translate("resources.notes.note_for")}{" "}
<ReferenceField
record={note}
resource="contact_notes"
source="contact_id"
reference="contacts"
link={false}
+ render={({ referenceRecord }) =>
+ referenceRecord
+ ? translate("resources.notes.note_for_contact", {
+ name: getContactRepresentation(referenceRecord),
+ })
+ : null
+ }
>
<RecordRepresentation resource="contacts" />
</ReferenceField>
diff --git a/src/components/atomic-crm/providers/commons/englishCrmMessages.ts b/src/components/atomic-crm/providers/commons/englishCrmMessages.ts
index 790fbff5..678eaf88 100644
--- a/src/components/atomic-crm/providers/commons/englishCrmMessages.ts
+++ b/src/components/atomic-crm/providers/commons/englishCrmMessages.ts
@@ -39,6 +39,9 @@ export const englishCrmMessages = {
new: "New Company",
show: "Show company",
},
+ added_on: "Added on %{date}",
+ followed_by: "Followed by %{name}",
+ followed_by_you: "Followed by you",
no_contacts: "No contact",
nb_contacts: "%{smart_count} contact |||| %{smart_count} contacts",
nb_deals: "%{smart_count} deal |||| %{smart_count} deals",
@@ -61,6 +64,7 @@ export const englishCrmMessages = {
field_categories: {
background_info: "Background info",
identity: "Identity",
+ misc: "Misc",
personal_info: "Personal info",
position: "Position",
},
@@ -82,6 +86,7 @@ export const englishCrmMessages = {
action: {
add: "Add contact",
add_first: "Add your first contact",
+ create: "Create contact",
edit: "Edit contact",
export_vcard: "Export to vCard",
new: "New Contact",
@@ -89,7 +94,7 @@ export const englishCrmMessages = {
},
background: {
last_activity_on: "Last activity on %{date}",
- added_on: "Added on",
+ added_on: "Added on %{date}",
followed_by: "Followed by %{name}",
followed_by_you: "Followed by you",
},
@@ -100,9 +105,12 @@ export const englishCrmMessages = {
title: "No contacts found",
},
import: {
+ title: "Import contacts",
button: "Import CSV",
complete:
"Contacts import complete. Imported %{importCount} contacts, with %{errorCount} errors",
+ progress:
+ "Imported %{importCount} / %{rowCount} contacts, with %{errorCount} errors.",
error:
"Failed to import this file, please make sure your provided a valid CSV file.",
imported: "Imported",
@@ -156,7 +164,6 @@ export const englishCrmMessages = {
today: "Today",
},
hot: {
- create: "Create contact",
empty_change_status:
'Change the status of a contact by adding a note to that contact and clicking on "show options".',
empty_hint: 'Contacts with a "hot" status will appear here.',
@@ -180,6 +187,9 @@ export const englishCrmMessages = {
create: "Create deal",
new: "New Deal",
},
+ field_categories: {
+ misc: "Misc",
+ },
archived: {
action: "Archive",
error: "Error: deal not archived",
@@ -188,9 +198,6 @@ export const englishCrmMessages = {
title: "Archived Deal",
view: "View archived deals",
},
- edit: {
- title: "Edit %{name} deal",
- },
inputs: {
linked_to: "Linked to",
},
@@ -205,6 +212,7 @@ export const englishCrmMessages = {
description: "It seems your deal list is empty.",
title: "No deals found",
},
+ invalid_date: "Invalid date",
},
notes: {
name: "Note |||| Notes",
@@ -237,7 +245,7 @@ export const englishCrmMessages = {
list: {
error_loading: "Error loading notes",
},
- note_for: "Note for",
+ note_for_contact: "Note for %{name}",
stepper: {
hint: "Go to a contact page and add a note",
},
@@ -313,13 +321,14 @@ export const englishCrmMessages = {
tomorrow: "Tomorrow",
with_pending: "With pending tasks",
},
+ regarding_contact: "(Re: %{name})",
updated: "Task updated",
},
tags: {
name: "Tag |||| Tags",
action: {
add: "Add tag",
- create_new: "Create new tag",
+ create: "Create new tag",
},
dialog: {
color: "Color",
@@ -351,22 +360,18 @@ export const englishCrmMessages = {
activity: "Activity",
added: "added",
details: "Details",
- errors: "errors",
- invalid_date: "Invalid date",
- last_activity: "last activity",
+ last_activity_with_date: "last activity %{date}",
load_more: "Load more",
misc: "Misc",
past: "Past",
read_more: "Read more",
- regarding: "Re:",
retry: "Retry",
show_less: "Show less",
- with: "with",
copied: "Copied!",
copy: "Copy",
loading: "Loading...",
me: "Me",
- task_count: "task |||| tasks",
+ task_count: "%{smart_count} task |||| %{smart_count} tasks",
},
activity: {
added_company: "%{name} added company",
@@ -390,6 +395,16 @@ export const englishCrmMessages = {
latest_activity_error: "Error loading latest activity",
latest_notes: "My Latest Notes",
latest_notes_added_ago: "added %{timeAgo}",
+ welcome: {
+ paragraph_1:
+ "is a template designed to help you quickly build your own CRM.",
+ paragraph_2:
+ "This demo runs on a mock API, so you can explore and modify the data. It resets on reload. The full version uses Supabase for the backend.",
+ paragraph_3:
+ "Atomic CRM is fully open-source. You can find the code at",
+ powered_by: "Powered by",
+ title: "Your CRM Starter Kit",
+ },
stepper: {
install: "Install Atomic CRM",
progress: "%{step}/3 done",
diff --git a/src/components/atomic-crm/providers/commons/frenchCrmMessages.ts b/src/components/atomic-crm/providers/commons/frenchCrmMessages.ts
index e527461f..ad6e4636 100644
--- a/src/components/atomic-crm/providers/commons/frenchCrmMessages.ts
+++ b/src/components/atomic-crm/providers/commons/frenchCrmMessages.ts
@@ -41,6 +41,9 @@ export const frenchCrmMessages = {
new: "Nouvelle entreprise",
show: "Afficher l'entreprise",
},
+ added_on: "Ajoutée le %{date}",
+ followed_by: "Suivie par %{name}",
+ followed_by_you: "Suivie par vous",
no_contacts: "Aucun contact",
nb_contacts: "%{smart_count} contact |||| %{smart_count} contacts",
nb_deals: "%{smart_count} affaire |||| %{smart_count} affaires",
@@ -64,6 +67,7 @@ export const frenchCrmMessages = {
field_categories: {
background_info: "Informations complémentaires",
identity: "Identité",
+ misc: "Divers",
personal_info: "Informations personnelles",
position: "Poste",
},
@@ -85,6 +89,7 @@ export const frenchCrmMessages = {
action: {
add: "Ajouter un contact",
add_first: "Ajoutez votre premier contact",
+ create: "Créer un contact",
edit: "Modifier le contact",
export_vcard: "Exporter en vCard",
new: "Nouveau contact",
@@ -92,7 +97,7 @@ export const frenchCrmMessages = {
},
background: {
last_activity_on: "Dernière activité le %{date}",
- added_on: "Ajouté le",
+ added_on: "Ajouté le %{date}",
followed_by: "Suivi par %{name}",
followed_by_you: "Suivi par vous",
},
@@ -103,9 +108,12 @@ export const frenchCrmMessages = {
title: "Aucun contact trouvé",
},
import: {
+ title: "Importer des contacts",
button: "Importer un fichier CSV",
complete:
"Import des contacts terminé. %{importCount} contacts importés, %{errorCount} erreurs",
+ progress:
+ "%{importCount} / %{rowCount} contacts importés, avec %{errorCount} erreurs.",
error:
"Échec de l'importation de ce fichier. Veuillez vous assurer que vous avez fourni un fichier CSV valide.",
imported: "Importé",
@@ -160,7 +168,6 @@ export const frenchCrmMessages = {
today: "Aujourd'hui",
},
hot: {
- create: "Créer un contact",
empty_change_status:
'Changez le statut d\'un contact en ajoutant une note à ce contact et en cliquant sur "afficher les options".',
empty_hint: 'Les contacts avec un statut "chaud" apparaîtront ici.',
@@ -184,6 +191,9 @@ export const frenchCrmMessages = {
create: "Créer une affaire",
new: "Nouvelle affaire",
},
+ field_categories: {
+ misc: "Divers",
+ },
archived: {
action: "Archiver",
error: "Erreur : affaire non archivée",
@@ -192,9 +202,6 @@ export const frenchCrmMessages = {
title: "Affaire archivée",
view: "Afficher les affaires archivées",
},
- edit: {
- title: "Modifier l'affaire %{name}",
- },
inputs: {
linked_to: "Lié à",
},
@@ -209,6 +216,7 @@ export const frenchCrmMessages = {
description: "Il semble que votre liste d'affaires soit vide.",
title: "Aucune affaire trouvée",
},
+ invalid_date: "Date invalide",
},
notes: {
name: "Note |||| Notes",
@@ -241,7 +249,7 @@ export const frenchCrmMessages = {
list: {
error_loading: "Erreur lors du chargement des notes",
},
- note_for: "Note pour",
+ note_for_contact: "Note pour %{name}",
stepper: {
hint: "Accédez à une page de contact et ajoutez une note",
},
@@ -318,13 +326,14 @@ export const frenchCrmMessages = {
tomorrow: "Demain",
with_pending: "Avec des tâches en attente",
},
+ regarding_contact: "(Concernant : %{name})",
updated: "Tâche mise à jour",
},
tags: {
name: "Étiquette |||| Étiquettes",
action: {
add: "Ajouter une étiquette",
- create_new: "Créer une nouvelle étiquette",
+ create: "Créer une nouvelle étiquette",
},
dialog: {
color: "Couleur",
@@ -356,18 +365,14 @@ export const frenchCrmMessages = {
activity: "Activité",
added: "ajoutée",
details: "Détails",
- errors: "erreurs",
- invalid_date: "Date invalide",
- last_activity: "dernière activité",
+ last_activity_with_date: "dernière activité %{date}",
load_more: "Charger plus",
misc: "Divers",
past: "Passé",
read_more: "En savoir plus",
- regarding: "Concernant:",
retry: "Réessayer",
show_less: "Afficher moins",
- task_count: "tâche |||| tâches",
- with: "avec",
+ task_count: "%{smart_count} tâche |||| %{smart_count} tâches",
copied: "Copié !",
copy: "Copier",
loading: "Chargement...",
@@ -396,6 +401,16 @@ export const frenchCrmMessages = {
"Erreur lors du chargement de la dernière activité",
latest_notes: "Mes dernières notes",
latest_notes_added_ago: "ajouté %{timeAgo}",
+ welcome: {
+ paragraph_1:
+ "est un template conçu pour vous aider à créer rapidement votre propre CRM.",
+ paragraph_2:
+ "Cette démo fonctionne avec une API mockée, afin que vous puissiez explorer et modifier les données. Elle se réinitialise au rechargement. La version complète utilise Supabase comme backend.",
+ paragraph_3:
+ "Atomic CRM est entièrement open source. Vous pouvez retrouver le code sur",
+ powered_by: "Propulsé par",
+ title: "Votre kit de démarrage CRM",
+ },
stepper: {
install: "Installer Atomic CRM",
progress: "%{step}/3 terminé",
diff --git a/src/components/atomic-crm/tasks/Task.tsx b/src/components/atomic-crm/tasks/Task.tsx
index 8ea1c4a5..f44bfa62 100644
--- a/src/components/atomic-crm/tasks/Task.tsx
+++ b/src/components/atomic-crm/tasks/Task.tsx
@@ -52,9 +52,6 @@ export const Task = ({
onSuccess() {
notify("resources.tasks.deleted", {
undoable: true,
- messageArgs: {
- _: "Task deleted successfully",
- },
});
},
},
@@ -135,12 +132,13 @@ export const Task = ({
className="inline text-sm text-muted-foreground"
render={({ referenceRecord }) => {
if (!referenceRecord) return null;
+ const name = `${referenceRecord.first_name} ${referenceRecord.last_name}`;
return (
<>
{" "}
- ({translate("crm.common.regarding")}&nbsp;
- {referenceRecord?.first_name}{" "}
- {referenceRecord?.last_name})
+ {translate("resources.tasks.regarding_contact", {
+ name,
+ })}
</>
);
}}