Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(crm): Apply suggestions from code review #10099

Merged
merged 4 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/crm/src/companies/CompanyInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const CompanyContactInputs = () => {
<Stack gap={1} flex={1}>
<Typography variant="h6">Contact</Typography>
<TextInput source="phone_number" helperText={false} />
<TextInput source="website" helperText={false} />
<TextInput source="website" helperText={false} validate={isUrl} />
<TextInput
source="linkedin_url"
helperText={false}
Expand Down
7 changes: 5 additions & 2 deletions examples/crm/src/dataGenerator/contactNotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import { defaultNoteStatuses } from '../root/defaultConfiguration';
export const generateContactNotes = (db: Db): ContactNote[] => {
return Array.from(Array(1200).keys()).map(id => {
const contact = random.arrayElement(db.contacts);
const date = randomDate(new Date(contact.first_seen)).toISOString();
const date = randomDate(new Date(contact.first_seen));
contact.nb_notes++;
contact.last_seen = date > contact.last_seen ? date : contact.last_seen;
contact.last_seen =
date > new Date(contact.last_seen)
? date.toISOString()
: contact.last_seen;
return {
id,
contact_id: contact.id,
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/dataGenerator/dealNotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const generateDealNotes = (db: Db) => {
text: lorem.paragraphs(random.number({ min: 1, max: 4 })),
date: randomDate(
new Date(db.companies[deal.company_id as number].created_at)
).toISOString(),
),
sales_id: deal.sales_id,
};
});
Expand Down
1 change: 1 addition & 0 deletions examples/crm/src/deals/DealCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const DealCardContent = ({
source="company_id"
record={deal}
reference="companies"
link={false}
>
<CompanyAvatar width={20} height={20} />
</ReferenceField>
Expand Down
4 changes: 2 additions & 2 deletions examples/crm/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export interface Contact extends RaRecord {
export interface ContactNote extends RaRecord {
contact_id: Identifier;
text: string;
date: string;
jonathanarnault marked this conversation as resolved.
Show resolved Hide resolved
date: Date;
sales_id: Identifier;
status: string;
attachments?: AttachmentNote[];
Expand All @@ -89,7 +89,7 @@ export interface Deal extends RaRecord {
export interface DealNote extends RaRecord {
deal_id: Identifier;
text: string;
date: string;
date: Date;
sales_id: Identifier;
attachments?: AttachmentNote[];
}
Expand Down
Loading