изменение хэдера и исправление ключеых багов

This commit is contained in:
egortriston
2025-07-08 17:27:26 +03:00
parent 8055886082
commit 96e11b0220
10 changed files with 117 additions and 52 deletions

View File

@ -23,6 +23,7 @@ interface VinLeftbarProps {
activeTab?: 'uzly' | 'manufacturer';
openedPath?: string[];
setOpenedPath?: (path: string[]) => void;
onCloseQuickGroup?: () => void;
}
interface QuickGroup {
@ -32,7 +33,7 @@ interface QuickGroup {
children?: QuickGroup[];
}
const VinLeftbar: React.FC<VinLeftbarProps> = ({ vehicleInfo, onSearchResults, onNodeSelect, onActiveTabChange, onQuickGroupSelect, activeTab: activeTabProp, openedPath = [], setOpenedPath = () => {} }) => {
const VinLeftbar: React.FC<VinLeftbarProps> = ({ vehicleInfo, onSearchResults, onNodeSelect, onActiveTabChange, onQuickGroupSelect, activeTab: activeTabProp, openedPath = [], setOpenedPath = () => {}, onCloseQuickGroup }) => {
const router = useRouter();
const catalogCode = vehicleInfo?.catalog || '';
const vehicleId = vehicleInfo?.vehicleid || '';
@ -65,6 +66,7 @@ const VinLeftbar: React.FC<VinLeftbarProps> = ({ vehicleInfo, onSearchResults, o
// Обновляем openedPath и URL
const setOpenedPathAndUrl = (newPath: string[]) => {
setOpenedPath(newPath);
if (onCloseQuickGroup) onCloseQuickGroup();
const params = new URLSearchParams(router.query as any);
if (newPath.length > 0) {
params.set('catpath', newPath.join(','));
@ -320,6 +322,7 @@ const VinLeftbar: React.FC<VinLeftbarProps> = ({ vehicleInfo, onSearchResults, o
if (searchQuery) setSearchQuery('');
if (onActiveTabChange) onActiveTabChange('uzly');
if (onQuickGroupSelect) onQuickGroupSelect(null);
if (onCloseQuickGroup) onCloseQuickGroup();
}}
>
Узлы
@ -337,8 +340,8 @@ const VinLeftbar: React.FC<VinLeftbarProps> = ({ vehicleInfo, onSearchResults, o
e.preventDefault();
if (searchQuery) setSearchQuery('');
if (onActiveTabChange) onActiveTabChange('manufacturer');
// Не вызываем onQuickGroupSelect с null - это вызывает ошибку
// Просто переключаем вкладку, а обработка отображения происходит через activeTab
if (onQuickGroupSelect) onQuickGroupSelect(null);
if (onCloseQuickGroup) onCloseQuickGroup();
}}
>
От производителя