- Converted several async components to synchronous functions, including `Layout`, `AddOrdersPage`, `ProfilePage`, `SlotPage`, and `ServicePage`, enhancing rendering efficiency. - Removed unnecessary prefetching logic and hydration boundaries, simplifying component structure and improving maintainability. - Updated the `TelegramProvider` to return null during the initial mount instead of a loading message, streamlining the loading state handling. - Enhanced loading state management in order-related components by adding loading spinners and data not found alerts, improving user experience during data fetching.
19 lines
550 B
TypeScript
19 lines
550 B
TypeScript
'use client';
|
|
|
|
import { type OrderComponentProps } from './types';
|
|
import { getAlert } from '@/components/shared/status';
|
|
import { useOrderQuery } from '@/hooks/api/orders';
|
|
|
|
export function OrderStatus({ documentId }: Readonly<OrderComponentProps>) {
|
|
const { data: { order } = {}, isLoading } = useOrderQuery({ documentId });
|
|
|
|
if (isLoading)
|
|
return (
|
|
<div className="flex animate-pulse flex-col space-y-1">
|
|
<div className="h-10 w-full rounded bg-muted" />
|
|
</div>
|
|
);
|
|
|
|
return order?.state && getAlert(order.state);
|
|
}
|