feat(contacts): add showServices prop to ContactRow for conditional rendering
- Updated ContactsList to pass showServices prop to ContactRow. - Modified ContactRow to conditionally render services based on the showServices prop, enhancing the display of contact information.
This commit is contained in:
parent
4e37146214
commit
92035a4ff8
@ -15,7 +15,7 @@ export function ContactsList() {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{contacts.map((contact) => (
|
||||
<ContactRow key={contact.documentId} {...contact} />
|
||||
<ContactRow key={contact.documentId} showServices {...contact} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -7,9 +7,10 @@ import { memo } from 'react';
|
||||
|
||||
type ContactRowProps = GQL.CustomerFieldsFragment & {
|
||||
readonly className?: string;
|
||||
readonly showServices?: boolean;
|
||||
};
|
||||
|
||||
export const ContactRow = memo(function ({ className, ...contact }: ContactRowProps) {
|
||||
export const ContactRow = memo(function ({ className, showServices, ...contact }: ContactRowProps) {
|
||||
return (
|
||||
<Link
|
||||
className="block"
|
||||
@ -30,9 +31,11 @@ export const ContactRow = memo(function ({ className, ...contact }: ContactRowPr
|
||||
</Avatar>
|
||||
<div>
|
||||
<p className="font-medium">{contact.name}</p>
|
||||
<p className="max-w-52 truncate text-xs text-muted-foreground">
|
||||
{contact.services.map((service) => service?.name).join(', ')}
|
||||
</p>
|
||||
{showServices && (
|
||||
<p className="max-w-52 truncate text-xs text-muted-foreground">
|
||||
{contact.services.map((service) => service?.name).join(', ')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{contact.active ? <div /> : <Badge variant="destructive">Неактивен</Badge>}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user