From e8f1fecb47d4f382c83a2d0eb41ad983fc37d4ed Mon Sep 17 00:00:00 2001 From: egortriston Date: Sun, 29 Jun 2025 12:36:49 +0300 Subject: [PATCH] pravkiend cart --- src/components/CartInfo.tsx | 2 + src/components/CartItem.tsx | 71 ++++++++- src/components/CartList.tsx | 19 ++- src/components/CartSummary.tsx | 30 ++-- src/components/FavoriteList.tsx | 10 +- src/components/index/AvailableParts.tsx | 88 +++++------ src/components/vin/VinLeftbar.tsx | 145 +++++++++++++++++- src/pages/search-result.tsx | 10 +- .../vehicle-search/[brand]/[vehicleId].tsx | 14 +- 9 files changed, 299 insertions(+), 90 deletions(-) diff --git a/src/components/CartInfo.tsx b/src/components/CartInfo.tsx index e044461..93a8e63 100644 --- a/src/components/CartInfo.tsx +++ b/src/components/CartInfo.tsx @@ -11,6 +11,7 @@ const CartInfo: React.FC = () => { }; return ( +
@@ -44,6 +45,7 @@ const CartInfo: React.FC = () => {
+
); }; diff --git a/src/components/CartItem.tsx b/src/components/CartItem.tsx index c449f58..dacaebb 100644 --- a/src/components/CartItem.tsx +++ b/src/components/CartItem.tsx @@ -80,14 +80,49 @@ const CartItem: React.FC = ({
{deliveryDate}
-
onCountChange && onCountChange(count - 1)} style={{ cursor: 'pointer' }}> - - +
onCountChange && onCountChange(count - 1)} + style={{ cursor: 'pointer' }} + aria-label="Уменьшить количество" + tabIndex={0} + onKeyDown={e => (e.key === 'Enter' || e.key === ' ') && onCountChange && onCountChange(count - 1)} + role="button" + > +
+ + + +
-
{count}
+ { + const value = Math.max(1, parseInt(e.target.value, 10) || 1); + onCountChange && onCountChange(value); + }} + className="text-block-26 w-full text-center outline-none" + aria-label="Количество" + style={{ width: 40 }} + />
-
onCountChange && onCountChange(count + 1)} style={{ cursor: 'pointer' }}> - + +
onCountChange && onCountChange(count + 1)} + style={{ cursor: 'pointer' }} + aria-label="Увеличить количество" + tabIndex={0} + onKeyDown={e => (e.key === 'Enter' || e.key === ' ') && onCountChange && onCountChange(count + 1)} + role="button" + > +
+ + + +
@@ -100,7 +135,31 @@ const CartItem: React.FC = ({
- +
(e.key === 'Enter' || e.key === ' ') && onRemove && onRemove()} + style={{ display: 'inline-flex', cursor: 'pointer', transition: 'color 0.2s' }} + onMouseEnter={e => { + const path = e.currentTarget.querySelector('path'); + if (path) path.setAttribute('fill', '#ec1c24'); + }} + onMouseLeave={e => { + const path = e.currentTarget.querySelector('path'); + if (path) path.setAttribute('fill', '#D0D0D0'); + }} + > + + + +
diff --git a/src/components/CartList.tsx b/src/components/CartList.tsx index a128919..4627a36 100644 --- a/src/components/CartList.tsx +++ b/src/components/CartList.tsx @@ -90,9 +90,24 @@ const CartList: React.FC = () => {
Выделить всё
-
+
{ + const path = (e.currentTarget.querySelector('path')); + if (path) path.setAttribute('fill', '#ec1c24'); + }} + onMouseLeave={e => { + const path = (e.currentTarget.querySelector('path')); + if (path) path.setAttribute('fill', '#D0D0D0'); + }} + >
Удалить выбранные
- + + +
{items.length === 0 ? ( diff --git a/src/components/CartSummary.tsx b/src/components/CartSummary.tsx index 5004a75..fc74eca 100644 --- a/src/components/CartSummary.tsx +++ b/src/components/CartSummary.tsx @@ -667,10 +667,10 @@ const CartSummary: React.FC = () => { + */}
setConsent((v) => !v)}>
= ({
Комментарий
-
+ {/*
Действия
-
+
*/} {favorites.length > 0 && (
= ({
+

{selectedQuickGroup.name}

+ {quickDetailLoading ? ( +
Загружаем детали...
+ ) : quickDetailError ? ( +
Ошибка загрузки деталей: {quickDetailError.message}
+ ) : quickDetail && quickDetail.units && quickDetail.units.length > 0 ? ( +
+ {quickDetail.units.map((unit: any) => ( +
+
{unit.name}
+ {unit.details && unit.details.length > 0 && ( +
    + {unit.details.map((detail: any) => ( +
  • + {detail.name} OEM: {detail.oem} +
  • + ))} +
+ )} +
+ ))} +
+ ) : ( +
Нет деталей для этой группы
+ )} +
+ ) : quickGroups.length > 0 ? ( + renderQuickGroupTree(quickGroups) + ) : ( +
Нет доступных групп быстрого поиска
+ )} +
)} {/* Tab content end */} diff --git a/src/pages/search-result.tsx b/src/pages/search-result.tsx index 3d9246f..7fac644 100644 --- a/src/pages/search-result.tsx +++ b/src/pages/search-result.tsx @@ -424,12 +424,12 @@ export default function SearchResult() { Поиск предложений {searchQuery} - Protek -
-
-
-

Поиск предложений...

+
+
+
+

Поиск предложений...

-
+