From b0b2872cf81967f63c4b4c7be51e91ef5947b24d Mon Sep 17 00:00:00 2001 From: Kirill Date: Wed, 27 May 2026 21:54:53 +0500 Subject: [PATCH] refactor: remove duplicate order status labels, use ORDER_STATUS_DATA as single source --- .../order-detail/ui/OrderDetailContent.tsx | 6 +++--- .../order-payment/ui/OrderPaymentSection.tsx | 4 ++-- .../pages/admin-orders/ui/AdminOrdersPage.tsx | 6 +++--- .../src/pages/me/ui/sections/MessagesPage.tsx | 6 +++--- .../src/pages/me/ui/sections/OrdersPage.tsx | 4 ++-- client/src/shared/lib/order-status-data.ts | 4 ++++ client/src/shared/lib/order-status-labels.ts | 14 -------------- server/prisma/prisma/dev.db | Bin 352256 -> 352256 bytes 8 files changed, 17 insertions(+), 27 deletions(-) delete mode 100644 client/src/shared/lib/order-status-labels.ts diff --git a/client/src/features/order-detail/ui/OrderDetailContent.tsx b/client/src/features/order-detail/ui/OrderDetailContent.tsx index 34cd886..50dbe65 100644 --- a/client/src/features/order-detail/ui/OrderDetailContent.tsx +++ b/client/src/features/order-detail/ui/OrderDetailContent.tsx @@ -19,7 +19,7 @@ import { getAdminNextOrderStatuses } from '@/shared/constants/order' import { formatPriceRub } from '@/shared/lib/format-price' import { invalidateQueryKeys } from '@/shared/lib/invalidate-query-keys' import { parseOrderAddressSnapshot } from '@/shared/lib/order-address-snapshot' -import { orderStatusLabelRu } from '@/shared/lib/order-status-labels' +import { ORDER_STATUS_MAP } from '@/shared/lib/order-status-data' import { $user } from '@/shared/model/auth' import { ChatMessageBubble } from '@/shared/ui/ChatMessageBubble' import { OrderMessageBody } from '@/shared/ui/OrderMessageBody' @@ -66,7 +66,7 @@ export function OrderDetailContent({ detail, orderId }: { detail: AdminOrderDeta return ( - #{detail.id.slice(-8)} · {detail.user.email} · {orderStatusLabelRu(detail.status)} ·{' '} + #{detail.id.slice(-8)} · {detail.user.email} · {ORDER_STATUS_MAP[detail.status] ?? detail.status} ·{' '} {formatPriceRub(detail.totalCents)} @@ -184,7 +184,7 @@ export function OrderDetailContent({ detail, orderId }: { detail: AdminOrderDeta {nextStatuses.map((s) => ( - {orderStatusLabelRu(s)} + {ORDER_STATUS_MAP[s] ?? s} ))} diff --git a/client/src/features/order-payment/ui/OrderPaymentSection.tsx b/client/src/features/order-payment/ui/OrderPaymentSection.tsx index cfacf9b..72b0adb 100644 --- a/client/src/features/order-payment/ui/OrderPaymentSection.tsx +++ b/client/src/features/order-payment/ui/OrderPaymentSection.tsx @@ -1,7 +1,7 @@ import Box from '@mui/material/Box' import Button from '@mui/material/Button' import Typography from '@mui/material/Typography' -import { orderStatusLabelRu } from '@/shared/lib/order-status-labels' +import { ORDER_STATUS_MAP } from '@/shared/lib/order-status-data' type Props = { status: string @@ -43,7 +43,7 @@ export function OrderPaymentSection({ status, deliveryFeeLocked, paymentMethod, <> Вы будете перенаправлены на защищённую платёжную страницу ЮKassa. После оплаты заказ получит статус « - {orderStatusLabelRu('PAID')}». + {ORDER_STATUS_MAP['PAID'] ?? 'PAID'}».