'use client'; import { OrderCard } from '../shared/order-card'; import { type ProfileProps } from './types'; import { useCustomerQuery, useIsMaster } from '@/hooks/api/customers'; import { useOrdersQuery } from '@/hooks/api/orders'; export function ProfileOrdersList({ telegramId }: Readonly) { const { data: { customer } = {} } = useCustomerQuery(); const isMaster = useIsMaster(); const { data: { customer: profile } = {} } = useCustomerQuery({ telegramId }); const { data: { orders } = {}, isLoading } = useOrdersQuery( { filters: { client: { documentId: { eq: isMaster ? profile?.documentId : customer?.documentId, }, }, slot: { master: { documentId: { eq: isMaster ? customer?.documentId : profile?.documentId, }, }, }, }, pagination: { limit: 5, }, }, Boolean(profile?.documentId) && Boolean(customer?.documentId), ); if (!orders?.length || isLoading) return null; return (

Общие записи

{orders?.map((order) => order && )}
); }