diff --git a/FrontEnd/src/components/Footer/FooterComponents/FooterNavigation.jsx b/FrontEnd/src/components/Footer/FooterComponents/FooterNavigation.jsx
index ae64cf63..851860d9 100644
--- a/FrontEnd/src/components/Footer/FooterComponents/FooterNavigation.jsx
+++ b/FrontEnd/src/components/Footer/FooterComponents/FooterNavigation.jsx
@@ -1,77 +1,76 @@
-import { HashLink } from 'react-router-hash-link';
import { Link } from 'react-router-dom';
-
import css from './FooterNavigation.module.css';
-
const PAGE_NAVIGATION_LINKS = [
{
title: 'Компанії',
- link: '/profiles/companies',
+ params: { companyType: 'companies' },
},
{
title: 'Стартапи',
- link: '/profiles/startups',
+ params: { companyType: 'startups' },
},
];
+
const SERVICES_LINKS = [
{
title: 'Виробники',
- link: '/profiles/producers',
+ params: { activity: 'producers' },
},
{
title: 'Імпортери',
- link: '/profiles/importers',
+ params: { activity: 'importers' },
},
{
title: 'Роздрібні мережі',
- link: '/profiles/retailers',
+ params: { activity: 'retailers' },
},
{
title: 'HORECA',
- link: '/profiles/horeca',
+ params: { activity: 'horeca' },
},
{
title: 'Інші послуги',
- link: '/profiles/other-services',
+ params: { activity: 'other-services' },
},
];
function FooterNavigation() {
-
+ const generateQueryString = (params) =>
+ new URLSearchParams(params).toString();
return (
Підприємства
- {PAGE_NAVIGATION_LINKS.map((element) => (
-
- {element.title}
-
- ))}
+ {PAGE_NAVIGATION_LINKS.map((element) => (
+
+ {element.title}
+
+ ))}
Сектори
-
- {SERVICES_LINKS.map((element) => (
-
- {element.title}
-
- ))}
+
+ {SERVICES_LINKS.map((element) => (
+
+ {element.title}
+
+ ))}
);
}
-export default FooterNavigation;
\ No newline at end of file
+export default FooterNavigation;
diff --git a/FrontEnd/src/pages/ProfileList/ProfileListPage.jsx b/FrontEnd/src/pages/ProfileList/ProfileListPage.jsx
index 8f1596f4..032a247f 100644
--- a/FrontEnd/src/pages/ProfileList/ProfileListPage.jsx
+++ b/FrontEnd/src/pages/ProfileList/ProfileListPage.jsx
@@ -126,6 +126,11 @@ export default function ProfileListPage({ isAuthorized, isSaved }) {
}
}, [fetchedProfiles, pageSize, currentPage, isSaved]);
+ useEffect(() => {
+ setActiveTab(searchParams.get('companyType') || 'all');
+ setActiveBtn(searchParams.get('activity') || 'all');
+ }, [searchParams]);
+
const changeCompanies = (companyId, saved) => {
setProfiles((prevProfiles) =>
prevProfiles.map((profile) =>
@@ -160,14 +165,6 @@ export default function ProfileListPage({ isAuthorized, isSaved }) {
updateQueryParams(page);
};
- const handleActiveTab = (activeTab) => {
- setActiveTab(activeTab);
- };
-
- const handleActiveBtn = (activeBtn) => {
- setActiveBtn(activeBtn);
- };
-
return (
{error && error.response.status !==401 ? (
@@ -188,7 +185,7 @@ export default function ProfileListPage({ isAuthorized, isSaved }) {
className={activeTab === item.key ?
css['company-list__tabs--element--active'] :
css['company-list__tabs--element']}
- onClick={() => (handleFilters(item.value, activity), handleActiveTab(item.key))}
+ onClick={() => (handleFilters(item.value, activity))}
>
{item.title === 'Усі підприємства' ? linkText : item.title}
@@ -208,7 +205,7 @@ export default function ProfileListPage({ isAuthorized, isSaved }) {
className={activeBtn === item.key ?
css['company-list__btns--element--active'] :
css['company-list__btns--element']}
- onClick={() => (handleFilters(companyType, item.value), handleActiveBtn(item.key))}
+ onClick={() => (handleFilters(companyType, item.value))}
>
{item.title}