From 6885e39017570da5ce605b193a37271413c5a9a6 Mon Sep 17 00:00:00 2001 From: "@kirill.komarov" Date: Sun, 3 May 2026 20:30:21 +0500 Subject: [PATCH] base commit --- client/src/app/layout/AppHeader.tsx | 86 +++++++++++------- .../pages/admin-layout/ui/AdminLayoutPage.tsx | 49 ++++++++-- .../pages/admin-orders/ui/AdminOrdersPage.tsx | 23 ++++- .../admin-reviews/ui/AdminReviewsPage.tsx | 3 +- client/src/pages/home/ui/HomePage.tsx | 14 ++- client/src/pages/me/ui/MeLayoutPage.tsx | 52 +++++++++-- .../src/pages/me/ui/sections/MessagesPage.tsx | 9 +- .../pages/me/ui/sections/OrderDetailPage.tsx | 9 +- client/src/pages/product/ui/ProductPage.tsx | 13 ++- .../src/shared/ui/RichTextMessageContent.tsx | 46 ++++++++++ .../src/shared/ui/RichTextMessageEditor.tsx | 14 ++- .../widgets/reviews-block/ui/ReviewsBlock.tsx | 7 +- .../b184d112-8321-49a6-8d22-6bfad4f77dd3.webp | Bin 0 -> 48052 bytes 13 files changed, 253 insertions(+), 72 deletions(-) create mode 100644 client/src/shared/ui/RichTextMessageContent.tsx create mode 100644 server/uploads/b184d112-8321-49a6-8d22-6bfad4f77dd3.webp diff --git a/client/src/app/layout/AppHeader.tsx b/client/src/app/layout/AppHeader.tsx index de9ffc8..48ce77b 100644 --- a/client/src/app/layout/AppHeader.tsx +++ b/client/src/app/layout/AppHeader.tsx @@ -171,6 +171,7 @@ export function AppHeader() { const user = useUnit($user) const navigate = useNavigate() const isAdmin = Boolean(user?.isAdmin) + const headerNavItems = isAdmin ? [...navItems, { label: 'Админка', to: '/admin' }] : navItems const cartQuery = useQuery({ queryKey: ['me', 'cart'], @@ -256,7 +257,7 @@ export function AppHeader() { {!isMobile && - navItems.map((i) => ( + headerNavItems.map((i) => ( @@ -292,36 +293,46 @@ export function AppHeader() { )} - - - - - + {!isAdmin && ( + <> + + + + + - - {user ? ( - <> - go('/me')}> - - - Выход - - ) : ( - go('/auth')}>Войти / регистрация - )} - + + {user ? ( + <> + go('/me')}> + + + Выход + + ) : ( + go('/auth')}>Войти / регистрация + )} + + + )} + + {isAdmin && user && !isMobile && ( + + )} {!isMobile && ( - {navItems.map((i) => ( + {headerNavItems.map((i) => ( @@ -364,9 +375,16 @@ export function AppHeader() { Заказы )} - + {!isAdmin && ( + + )} + {!user && isAdmin && ( + + )} {user && ( diff --git a/client/src/pages/me/ui/sections/OrderDetailPage.tsx b/client/src/pages/me/ui/sections/OrderDetailPage.tsx index c4aaf97..5f5c3a0 100644 --- a/client/src/pages/me/ui/sections/OrderDetailPage.tsx +++ b/client/src/pages/me/ui/sections/OrderDetailPage.tsx @@ -24,6 +24,7 @@ import { postProductReview, uploadReviewImage } from '@/entities/product/api/rev import { markOrderMessagesRead } from '@/entities/user/api/messages-api' import { formatPriceRub } from '@/shared/lib/format-price' import { orderStatusLabelRu } from '@/shared/lib/order-status-labels' +import { RichTextMessageContent } from '@/shared/ui/RichTextMessageContent' import { RichTextMessageEditor } from '@/shared/ui/RichTextMessageEditor' function reviewSubmitErrorMessage(err: unknown): string { @@ -95,6 +96,7 @@ export function OrderDetailPage() { }) const order = orderQuery.data?.item + const canSendMessage = text.replace(/<[^>]*>/g, ' ').trim().length > 0 const eligibilityQuery = useQuery({ queryKey: ['me', 'orders', id, 'review-eligibility'], @@ -322,12 +324,15 @@ export function OrderDetailPage() { bgcolor: m.authorType === 'admin' ? 'grey.100' : 'primary.50', border: 1, borderColor: 'divider', + alignSelf: m.authorType === 'admin' ? 'flex-start' : 'flex-end', + width: 'fit-content', + maxWidth: '85%', }} > {m.authorType === 'admin' ? 'Админ' : 'Вы'} · {new Date(m.createdAt).toLocaleString()} - {m.text} + ))} {order.messages.length === 0 && Пока сообщений нет.} @@ -340,7 +345,7 @@ export function OrderDetailPage() {