vchikalkin c7648e8bf9 Enhance contact management by adding surname input and updating customer handling
- Introduced a new input for capturing the surname of the user during contact addition.
- Updated the contact parsing logic to include surname alongside name and phone number.
- Modified the customer creation and update processes to accommodate surname, ensuring full name is used in confirmation messages.
- Adjusted localization files to reflect the new surname input prompt and updated confirmation messages.
- Refactored components to utilize a unified method for retrieving full customer names, improving consistency across the application.
2025-10-07 12:36:03 +03:00

43 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { UserAvatar } from './user-avatar';
import type * as GQL from '@repo/graphql/types';
import { Badge } from '@repo/ui/components/ui/badge';
import { cn } from '@repo/ui/lib/utils';
import { getCustomerFullName } from '@repo/utils/customer';
import Link from 'next/link';
import { memo } from 'react';
type ContactRowProps = GQL.CustomerFieldsFragment & {
readonly className?: string;
readonly description?: string;
readonly showServices?: boolean;
};
export const ContactRow = memo(function ({ className, description, ...contact }: ContactRowProps) {
return (
<Link
className="block"
href={contact.active ? `/profile/${contact.telegramId}` : ''}
key={contact.telegramId}
>
<div
className={cn(
'flex items-center justify-between',
contact.active ? 'hover:bg-accent' : 'opacity-50',
className,
)}
>
<div className={cn('flex items-center space-x-4 rounded-lg transition-colors')}>
<UserAvatar {...contact} size="sm" />
<div>
<p className="font-medium">{getCustomerFullName(contact)}</p>
{description && (
<p className="max-w-52 truncate text-xs text-muted-foreground">{description}</p>
)}
</div>
</div>
{contact.active ? <div /> : <Badge variant="destructive">Неактивен</Badge>}
</div>
</Link>
);
});