refactor(contact-row): replace role display logic with useIsMaster hook for improved clarity
This commit is contained in:
parent
a64d974832
commit
f3446840e6
@ -1,4 +1,5 @@
|
||||
import * as GQL from '@repo/graphql/types';
|
||||
import { useIsMaster } from '@/hooks/api/customers';
|
||||
import type * as GQL from '@repo/graphql/types';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@repo/ui/components/ui/avatar';
|
||||
import { Badge } from '@repo/ui/components/ui/badge';
|
||||
import { cn } from '@repo/ui/lib/utils';
|
||||
@ -10,6 +11,8 @@ type ContactRowProps = GQL.CustomerFieldsFragment & {
|
||||
};
|
||||
|
||||
export const ContactRow = memo(function ({ className, ...contact }: ContactRowProps) {
|
||||
const isMaster = useIsMaster();
|
||||
|
||||
return (
|
||||
<Link
|
||||
className="block"
|
||||
@ -30,9 +33,7 @@ export const ContactRow = memo(function ({ className, ...contact }: ContactRowPr
|
||||
</Avatar>
|
||||
<div>
|
||||
<p className="font-medium">{contact.name}</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{contact.role === GQL.Enum_Customer_Role.Client ? 'Клиент' : 'Мастер'}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">{isMaster ? 'Мастер' : 'Клиент'}</p>
|
||||
</div>
|
||||
</div>
|
||||
{contact.active ? <div /> : <Badge variant="destructive">Неактивен</Badge>}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user