Добавлены новые компоненты Header и MobileMenuBottomSection, улучшено отображение информации о производителях. Упрощены классы и улучшена читаемость кода. Обновлены заголовки и сообщения об ошибках для лучшего пользовательского опыта.
This commit is contained in:
@ -2,7 +2,9 @@ import React, { useState, useEffect } from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useQuery } from '@apollo/client';
|
||||
import Head from 'next/head';
|
||||
import Header from '@/components/Header';
|
||||
import Footer from '@/components/Footer';
|
||||
import MobileMenuBottomSection from '@/components/MobileMenuBottomSection';
|
||||
import { GET_BRANDS_BY_CODE, GET_LAXIMO_CATALOG_INFO } from '@/lib/graphql';
|
||||
import { LaximoCatalogInfo } from '@/types/laximo';
|
||||
|
||||
@ -19,29 +21,25 @@ const InfoBrandSelection = ({
|
||||
<div className="w-layout-blockcontainer container info w-container">
|
||||
<div className="w-layout-vflex flex-block-9">
|
||||
<div className="w-layout-hflex flex-block-7">
|
||||
<a href="/" className="link-block w-inline-block text-[#000814] hover:text-[#EC1C24] transition-colors">
|
||||
<a href="/" className="link-block w-inline-block">
|
||||
<div>Главная</div>
|
||||
</a>
|
||||
<div className="text-block-3">→</div>
|
||||
<a href="#" className="link-block-2 w-inline-block text-[#000814] hover:text-[#EC1C24] transition-colors">
|
||||
<a href="#" className="link-block-2 w-inline-block">
|
||||
<div>Каталог</div>
|
||||
</a>
|
||||
<div className="text-block-3">→</div>
|
||||
<div className="font-semibold text-gray-900">{brandName}</div>
|
||||
<div>{brandName}</div>
|
||||
<div className="text-block-3">→</div>
|
||||
<div className="font-semibold text-gray-900">Деталь {oemNumber}</div>
|
||||
<div>Деталь {oemNumber}</div>
|
||||
<div className="text-block-3">→</div>
|
||||
<div className="font-semibold text-gray-900">Выбор производителя</div>
|
||||
<div>Выбор производителя</div>
|
||||
</div>
|
||||
<div className="w-layout-hflex flex-block-8 mt-4">
|
||||
<div className="w-layout-hflex flex-block-10 items-center gap-4">
|
||||
<h1 className="heading text-2xl font-bold text-gray-900">Выберите производителя</h1>
|
||||
<div className="w-layout-hflex flex-block-8">
|
||||
<div className="w-layout-hflex flex-block-10">
|
||||
<h1 className="heading">Выберите производителя для {oemNumber}</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-lg text-gray-600 mt-2">
|
||||
{detailName && <span>Деталь: {detailName} • </span>}
|
||||
Артикул: {oemNumber}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@ -122,16 +120,16 @@ const BrandSelectionPage = () => {
|
||||
<Head>
|
||||
<title>Выбор производителя для {oemNumber} - {catalogInfo?.name || 'Каталог запчастей'}</title>
|
||||
<meta name="description" content={`Выберите производителя для детали ${oemNumber} в каталоге ${catalogInfo?.name}`} />
|
||||
<link href="images/favicon.png" rel="shortcut icon" type="image/x-icon" />
|
||||
<link href="images/webclip.png" rel="apple-touch-icon" />
|
||||
</Head>
|
||||
<div className="bg-[#F5F8FB] min-h-screen w-full">
|
||||
<InfoBrandSelection
|
||||
brandName={catalogInfo?.name || String(brand)}
|
||||
oemNumber={String(oemNumber)}
|
||||
detailName={String(detailName || '')}
|
||||
/>
|
||||
<div className="flex flex-col px-32 pt-10 pb-16 max-md:px-5">
|
||||
<div className="flex flex-col items-center w-full">
|
||||
<div className="w-full max-w-[1200px]">
|
||||
<div className="page-wrapper bg-[#F5F8FB] min-h-screen">
|
||||
<div className="w-full max-w-[1580px] mx-auto px-8 max-md:px-5 pt-10 pb-16">
|
||||
|
||||
{/* Кнопка назад */}
|
||||
<div className="mb-6">
|
||||
@ -146,13 +144,7 @@ const BrandSelectionPage = () => {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{(catalogLoading || loading) && (
|
||||
<div className="bg-white rounded-2xl shadow p-10 flex flex-col items-center justify-center min-h-[300px]">
|
||||
<div className="animate-spin rounded-full h-24 w-24 border-b-2 border-red-600 mb-6"></div>
|
||||
<p className="text-lg text-gray-600">Загружаем производителей...</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Обработка ошибок */}
|
||||
{hasError && !loading && (
|
||||
<div className="bg-red-50 border border-red-200 rounded-2xl shadow p-10 mb-6">
|
||||
<div className="flex items-center">
|
||||
@ -169,89 +161,73 @@ const BrandSelectionPage = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{hasNoBrands && !loading && (
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-2xl shadow p-10">
|
||||
<div className="text-center">
|
||||
<div className="text-yellow-500 mb-3">
|
||||
<svg className="w-12 h-12 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 15.5c-.77.833.192 2.5 1.732 2.5z" />
|
||||
</svg>
|
||||
</div>
|
||||
<h4 className="text-lg font-medium text-yellow-800 mb-2">Производители не найдены</h4>
|
||||
<p className="text-yellow-700 mb-4">
|
||||
К сожалению, по данному артикулу производители не найдены
|
||||
</p>
|
||||
<p className="text-sm text-yellow-600 mb-4">
|
||||
Попробуйте изменить параметры поиска или обратитесь к нашим менеджерам
|
||||
</p>
|
||||
<div className="space-y-2 text-sm text-yellow-700">
|
||||
<p>Телефон: <span className="font-medium">+7 (495) 123-45-67</span></p>
|
||||
<p>Email: <span className="font-medium">info@protek.ru</span></p>
|
||||
</div>
|
||||
</div>
|
||||
{/* Загрузка */}
|
||||
{(catalogLoading || loading) && (
|
||||
<div className="bg-white rounded-2xl shadow p-10 flex flex-col items-center justify-center min-h-[300px]">
|
||||
<div className="animate-spin rounded-full h-24 w-24 border-b-2 border-red-600 mb-6"></div>
|
||||
<p className="text-lg text-gray-600">Загружаем производителей...</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!loading && !hasError && brands.length > 0 && (
|
||||
{/* Результаты */}
|
||||
{!loading && !hasError && (
|
||||
<div className="space-y-6">
|
||||
{hasNoBrands ? (
|
||||
<div className="bg-[#eaf0fa] border border-[#b3c6e6] rounded-2xl shadow p-10 text-center">
|
||||
<svg className="w-16 h-16 mx-auto mb-4" style={{ color: '#0d336c' }} fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 15.5c-.77.833.192 2.5 1.732 2.5z" />
|
||||
</svg>
|
||||
<h3 className="text-xl font-semibold mb-2" style={{ color: '#0d336c' }}>
|
||||
Производители не найдены
|
||||
</h3>
|
||||
<p className="mb-4" style={{ color: '#0d336c' }}>
|
||||
По артикулу <span className="font-mono font-semibold">{oemNumber}</span> производители не найдены.
|
||||
</p>
|
||||
<p className="text-sm" style={{ color: '#3b5a99' }}>
|
||||
Попробуйте изменить запрос или обратитесь к нашим менеджерам.
|
||||
</p>
|
||||
</div>
|
||||
) : brands.length > 0 && (
|
||||
<div className="bg-white rounded-2xl shadow p-10">
|
||||
<div className="border-b border-gray-200 pb-4 mb-6">
|
||||
<h2 className="text-xl font-semibold text-gray-900">Выберите производителя</h2>
|
||||
<div className="border-b border-gray-200 pb-4">
|
||||
<h2 className="text-xl font-semibold text-gray-900">
|
||||
Выбор производителя для артикула: {oemNumber}
|
||||
</h2>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
{detailName && <span>Деталь: {detailName} • </span>}
|
||||
Найдено производителей: <span className="font-medium">{brands.length}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
<div className="divide-y divide-gray-200">
|
||||
{brands.map((brandItem: any, index: number) => (
|
||||
<div key={index}>
|
||||
<button
|
||||
key={index}
|
||||
onClick={() => handleBrandSelect(brandItem.brand)}
|
||||
className="text-left p-6 rounded-lg border border-gray-200 hover:border-red-500 hover:bg-red-50 transition-all duration-200 group hover:shadow-md"
|
||||
className="w-full text-left p-4 hover:bg-gray-50 transition-colors block group"
|
||||
>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex-1">
|
||||
<div className="font-medium text-gray-900 group-hover:text-red-700 text-lg mb-1">
|
||||
<div className="flex w-full items-center gap-2">
|
||||
<div className="w-1/5 max-md:w-1/3 font-bold text-left truncate" style={{ color: 'rgb(77, 180, 94)' }}>
|
||||
{brandItem.brand}
|
||||
</div>
|
||||
{brandItem.name && brandItem.name !== brandItem.brand && (
|
||||
<div className="text-sm text-gray-600 group-hover:text-red-600 mb-2">
|
||||
{brandItem.name}
|
||||
<div className="w-1/5 max-md:text-center max-md:w-1/3 font-bold text-left truncate group-hover:text-[#EC1C24] transition-colors">
|
||||
{oemNumber}
|
||||
</div>
|
||||
)}
|
||||
<div className="text-xs text-gray-500 group-hover:text-red-500">
|
||||
Код: {brandItem.code}
|
||||
<div className="w-3/5 max-md:w-1/3 text-left truncate">
|
||||
{brandItem.name && brandItem.name !== brandItem.brand ? brandItem.name : detailName || 'Запчасть'}
|
||||
</div>
|
||||
</div>
|
||||
<svg
|
||||
className="w-6 h-6 text-gray-400 group-hover:text-red-500 transition-colors flex-shrink-0 ml-4"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-8 pt-6 border-t border-gray-200">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="text-sm text-gray-600">
|
||||
Не нашли нужного производителя?
|
||||
</div>
|
||||
<div className="text-sm text-gray-500">
|
||||
Обратитесь к менеджеру: <span className="font-medium text-gray-700">+7 (495) 123-45-67</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<MobileMenuBottomSection />
|
||||
<Footer />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user