Skip to content

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

Remove custom labels that are repeating the default ones

François Zaninottob1a68854b655
diff --git a/src/components/atomic-crm/companies/CompanyInputs.tsx b/src/components/atomic-crm/companies/CompanyInputs.tsx
index aab64f55..1dc0b85d 100644
--- a/src/components/atomic-crm/companies/CompanyInputs.tsx
+++ b/src/components/atomic-crm/companies/CompanyInputs.tsx
@@ -67,7 +67,6 @@ const CompanyDisplayInputs = () => {
className="w-full h-fit"
validate={required()}
helperText={false}
- label="resources.companies.fields.name"
placeholder={translate("resources.companies.fields.name", {
_: "Company name",
})}
@@ -83,23 +82,13 @@ const CompanyContactInputs = () => {
<h6 className="text-lg font-semibold">
{translate("crm.companies.inputs.contact", { _: "Contact" })}
</h6>
- <TextInput
- source="website"
- label="resources.companies.fields.website"
- helperText={false}
- validate={isUrl}
- />
+ <TextInput source="website" helperText={false} validate={isUrl} />
<TextInput
source="linkedin_url"
- label="resources.companies.fields.linkedin_url"
helperText={false}
validate={isLinkedinUrl}
/>
- <TextInput
- source="phone_number"
- label="resources.companies.fields.phone_number"
- helperText={false}
- />
+ <TextInput source="phone_number" helperText={false} />
</div>
);
};
@@ -118,28 +107,14 @@ const CompanyContextInputs = () => {
</h6>
<SelectInput
source="sector"
- label="resources.companies.fields.sector"
choices={companySectors}
optionText="label"
optionValue="value"
helperText={false}
/>
- <SelectInput
- source="size"
- label="resources.companies.fields.size"
- choices={translatedSizes}
- helperText={false}
- />
- <TextInput
- source="revenue"
- label="resources.companies.fields.revenue"
- helperText={false}
- />
- <TextInput
- source="tax_identifier"
- label="resources.companies.fields.tax_identifier"
- helperText={false}
- />
+ <SelectInput source="size" choices={translatedSizes} helperText={false} />
+ <TextInput source="revenue" helperText={false} />
+ <TextInput source="tax_identifier" helperText={false} />
</div>
);
};
@@ -151,31 +126,11 @@ const CompanyAddressInputs = () => {
<h6 className="text-lg font-semibold">
{translate("crm.companies.inputs.address", { _: "Address" })}
</h6>
- <TextInput
- source="address"
- label="resources.companies.fields.address"
- helperText={false}
- />
- <TextInput
- source="city"
- label="resources.companies.fields.city"
- helperText={false}
- />
- <TextInput
- source="zipcode"
- label="resources.companies.fields.zipcode"
- helperText={false}
- />
- <TextInput
- source="state_abbr"
- label="resources.companies.fields.state_abbr"
- helperText={false}
- />
- <TextInput
- source="country"
- label="resources.companies.fields.country"
- helperText={false}
- />
+ <TextInput source="address" helperText={false} />
+ <TextInput source="city" helperText={false} />
+ <TextInput source="zipcode" helperText={false} />
+ <TextInput source="state_abbr" helperText={false} />
+ <TextInput source="country" helperText={false} />
</div>
);
};
@@ -189,17 +144,8 @@ const CompanyAdditionalInformationInputs = () => {
_: "Additional information",
})}
</h6>
- <TextInput
- source="description"
- label="resources.companies.fields.description"
- multiline
- helperText={false}
- />
- <ArrayInput
- source="context_links"
- label="resources.companies.fields.context_links"
- helperText={false}
- >
+ <TextInput source="description" multiline helperText={false} />
+ <ArrayInput source="context_links" helperText={false}>
<SimpleFormIterator disableReordering fullWidth getItemLabel={false}>
<TextInput
source=""
@@ -227,11 +173,7 @@ const CompanyAccountManagerInput = () => {
"disabled@neq": true,
}}
>
- <SelectInput
- label="resources.companies.fields.sales_id"
- helperText={false}
- optionText={saleOptionRenderer}
- />
+ <SelectInput helperText={false} optionText={saleOptionRenderer} />
</ReferenceInput>
</div>
);
diff --git a/src/components/atomic-crm/contacts/ContactInputs.tsx b/src/components/atomic-crm/contacts/ContactInputs.tsx
index 5004abc5..9db40884 100644
--- a/src/components/atomic-crm/contacts/ContactInputs.tsx
+++ b/src/components/atomic-crm/contacts/ContactInputs.tsx
@@ -64,18 +64,8 @@ const ContactIdentityInputs = () => {
optionValue="value"
defaultValue={contactGender[0].value}
/>
- <TextInput
- source="first_name"
- label="resources.contacts.fields.first_name"
- validate={required()}
- helperText={false}
- />
- <TextInput
- source="last_name"
- label="resources.contacts.fields.last_name"
- validate={required()}
- helperText={false}
- />
+ <TextInput source="first_name" validate={required()} helperText={false} />
+ <TextInput source="last_name" validate={required()} helperText={false} />
</div>
);
};
@@ -87,11 +77,7 @@ const ContactPositionInputs = () => {
<h6 className="text-lg font-semibold">
{translate("crm.contacts.inputs.position", { _: "Position" })}
</h6>
- <TextInput
- source="title"
- label="resources.contacts.fields.title"
- helperText={false}
- />
+ <TextInput source="title" helperText={false} />
<ReferenceInput source="company_id" reference="companies" perPage={10}>
<AutocompleteCompanyInput label="resources.contacts.fields.company_id" />
</ReferenceInput>
@@ -148,11 +134,7 @@ const ContactPersonalInformationInputs = () => {
<h6 className="text-lg font-semibold">
{translate("crm.contacts.inputs.personal_info", { _: "Personal info" })}
</h6>
- <ArrayInput
- source="email_jsonb"
- label="resources.contacts.fields.email_jsonb"
- helperText={false}
- >
+ <ArrayInput source="email_jsonb" helperText={false}>
<SimpleFormIterator
inline
disableReordering
@@ -182,11 +164,7 @@ const ContactPersonalInformationInputs = () => {
/>
</SimpleFormIterator>
</ArrayInput>
- <ArrayInput
- source="phone_jsonb"
- label="resources.contacts.fields.phone_jsonb"
- helperText={false}
- >
+ <ArrayInput source="phone_jsonb" helperText={false}>
<SimpleFormIterator
inline
disableReordering
@@ -215,7 +193,6 @@ const ContactPersonalInformationInputs = () => {
</ArrayInput>
<TextInput
source="linkedin_url"
- label="resources.contacts.fields.linkedin_url"
helperText={false}
validate={isLinkedinUrl}
/>
@@ -230,17 +207,8 @@ const ContactMiscInputs = () => {
<h6 className="text-lg font-semibold">
{translate("crm.common.misc", { _: "Misc" })}
</h6>
- <TextInput
- source="background"
- label="resources.contacts.fields.background"
- multiline
- helperText={false}
- />
- <BooleanInput
- source="has_newsletter"
- label="resources.contacts.fields.has_newsletter"
- helperText={false}
- />
+ <TextInput source="background" multiline helperText={false} />
+ <BooleanInput source="has_newsletter" helperText={false} />
<ReferenceInput
reference="sales"
source="sales_id"
@@ -251,7 +219,6 @@ const ContactMiscInputs = () => {
>
<SelectInput
helperText={false}
- label="resources.contacts.fields.sales_id"
optionText={saleOptionRenderer}
validate={required()}
/>
diff --git a/src/components/atomic-crm/deals/DealInputs.tsx b/src/components/atomic-crm/deals/DealInputs.tsx
index 25361dc6..b01e9b4b 100644
--- a/src/components/atomic-crm/deals/DealInputs.tsx
+++ b/src/components/atomic-crm/deals/DealInputs.tsx
@@ -31,19 +31,8 @@ export const DealInputs = () => {
const DealInfoInputs = () => {
return (
<div className="flex flex-col gap-4 flex-1">
- <TextInput
- source="name"
- label="resources.deals.fields.name"
- validate={required()}
- helperText={false}
- />
- <TextInput
- source="description"
- label="resources.deals.fields.description"
- multiline
- rows={3}
- helperText={false}
- />
+ <TextInput source="name" validate={required()} helperText={false} />
+ <TextInput source="description" multiline rows={3} helperText={false} />
</div>
);
};
@@ -84,7 +73,6 @@ const DealMiscInputs = () => {
<SelectInput
source="category"
- label="resources.deals.fields.category"
choices={dealCategories}
optionText="label"
optionValue="value"
@@ -92,7 +80,6 @@ const DealMiscInputs = () => {
/>
<NumberInput
source="amount"
- label="resources.deals.fields.amount"
defaultValue={0}
helperText={false}
validate={required()}
@@ -100,13 +87,11 @@ const DealMiscInputs = () => {
<DateInput
validate={required()}
source="expected_closing_date"
- label="resources.deals.fields.expected_closing_date"
helperText={false}
defaultValue={new Date().toISOString().split("T")[0]}
/>
<SelectInput
source="stage"
- label="resources.deals.fields.stage"
choices={dealStages}
optionText="label"
optionValue="value"
diff --git a/src/components/atomic-crm/notes/NoteInputs.tsx b/src/components/atomic-crm/notes/NoteInputs.tsx
index 3d9a36fe..b61bd105 100644
--- a/src/components/atomic-crm/notes/NoteInputs.tsx
+++ b/src/components/atomic-crm/notes/NoteInputs.tsx
@@ -32,6 +32,9 @@ export const NoteInputs = ({
const translate = useTranslate();
const [displayMore, setDisplayMore] = useState(false);
+ // We manually define the input labels because the default ones
+ // would use the resource from the context, which is either "contact_notes" or "deal_notes",
+ // but we want it to be "notes" regardless of the context
return (
<div className="space-y-2">
<TextInput
@@ -53,12 +56,8 @@ export const NoteInputs = ({
<AutocompleteInput
label={
reference === "contacts"
- ? translate("resources.notes.fields.contact_id", {
- _: "Contact",
- })
- : translate("resources.notes.fields.deal_id", {
- _: "Deal",
- })
+ ? "resources.notes.fields.contact_id"
+ : "resources.notes.fields.deal_id"
}
optionText={
reference === "contacts" ? contactOptionText : undefined
diff --git a/src/components/atomic-crm/sales/SalesInputs.tsx b/src/components/atomic-crm/sales/SalesInputs.tsx
index b7766996..0a01cb37 100644
--- a/src/components/atomic-crm/sales/SalesInputs.tsx
+++ b/src/components/atomic-crm/sales/SalesInputs.tsx
@@ -9,33 +9,20 @@ export function SalesInputs() {
const record = useRecordContext<Sale>();
return (
<div className="space-y-4 w-full">
- <TextInput
- source="first_name"
- label="resources.sales.fields.first_name"
- validate={required()}
- helperText={false}
- />
- <TextInput
- source="last_name"
- label="resources.sales.fields.last_name"
- validate={required()}
- helperText={false}
- />
+ <TextInput source="first_name" validate={required()} helperText={false} />
+ <TextInput source="last_name" validate={required()} helperText={false} />
<TextInput
source="email"
- label="resources.sales.fields.email"
validate={[required(), email()]}
helperText={false}
/>
<BooleanInput
source="administrator"
- label="resources.sales.fields.administrator"
readOnly={record?.id === identity?.id}
helperText={false}
/>
<BooleanInput
source="disabled"
- label="resources.sales.fields.disabled"
readOnly={record?.id === identity?.id}
helperText={false}
/>
diff --git a/src/components/atomic-crm/tasks/TaskFormContent.tsx b/src/components/atomic-crm/tasks/TaskFormContent.tsx
index eb19164c..32df2df1 100644
--- a/src/components/atomic-crm/tasks/TaskFormContent.tsx
+++ b/src/components/atomic-crm/tasks/TaskFormContent.tsx
@@ -2,7 +2,7 @@ import { AutocompleteInput } from "@/components/admin/autocomplete-input";
import { ReferenceInput } from "@/components/admin/reference-input";
import { SelectInput } from "@/components/admin/select-input";
import { TextInput } from "@/components/admin/text-input";
-import { required, useTranslate } from "ra-core";
+import { required } from "ra-core";
import { DateTimeInput } from "@/components/admin";
import { contactOptionText } from "../misc/ContactOption";
@@ -14,13 +14,11 @@ export const TaskFormContent = ({
selectContact?: boolean;
}) => {
const { taskTypes } = useConfigurationContext();
- const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
<TextInput
autoFocus
source="text"
- label={translate("resources.tasks.fields.text", { _: "Description" })}
validate={required()}
multiline
className="m-0"
@@ -29,9 +27,6 @@ export const TaskFormContent = ({
{selectContact && (
<ReferenceInput source="contact_id" reference="contacts_summary">
<AutocompleteInput
- label={translate("resources.tasks.fields.contact_id", {
- _: "Contact",
- })}
optionText={contactOptionText}
helperText={false}
validate={required()}
@@ -43,13 +38,11 @@ export const TaskFormContent = ({
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<DateTimeInput
source="due_date"
- label="resources.tasks.fields.due_date"
helperText={false}
validate={required()}
/>
<SelectInput
source="type"
- label="resources.tasks.fields.type"
validate={required()}
choices={taskTypes}
optionText="label"