@@ -22,7 +28,7 @@ export const PromotionsSection = () => {
{t('home.promotions.description')}
-
+
);
diff --git a/src/widgets/vacancies-section.tsx b/src/widgets/vacancies-section.tsx
index 7888fa8..db2fd6e 100644
--- a/src/widgets/vacancies-section.tsx
+++ b/src/widgets/vacancies-section.tsx
@@ -2,6 +2,8 @@
import { Briefcase } from 'lucide-react';
+import { Jobs } from '@/app/api-utlities/@types/main';
+
import { useLanguage } from '@/shared/language';
import { cn } from '@/shared/lib/utils';
import { Badge } from '@/shared/shadcn-ui/badge';
@@ -14,9 +16,24 @@ import {
TabsTrigger,
} from '@/shared/shadcn-ui/tabs';
-export const VacanciesSection = () => {
+interface VacanciesSectionProps {
+ jobs: Jobs;
+}
+
+export const VacanciesSection = ({ jobs }: VacanciesSectionProps) => {
const { t } = useLanguage();
+ const jobsByType = new Map();
+
+ jobs.forEach((job) => {
+ const existing = jobsByType.get(job.type) || [];
+ jobsByType.set(job.type, [...existing, job]);
+ });
+
+ const allVacancies = t('home.vacancies.all');
+
+ const jobsTabsTitle = [allVacancies, ...Array.from(jobsByType.keys())];
+
return (
@@ -32,53 +49,38 @@ export const VacanciesSection = () => {
-
+
- {t('home.vacancies.all')}
- {t('home.vacancies.office')}
- {t('home.vacancies.stations')}
+ {jobsTabsTitle.map((type) => (
+
+ {type}
+
+ ))}
-
- {[
- 'Оператор АЗС',
- 'Менеджер по продажам',
- 'Бухгалтер',
- 'Специалист по логистике',
- ].map((job, index) => (
+
+
+ {jobs.map((job, index) => (
))}
-
- {[
- 'Менеджер по продажам',
- 'Бухгалтер',
- 'Специалист по логистике',
- ].map((job, index) => (
-
- ))}
-
-
- {['Оператор АЗС', 'Заправщик', 'Менеджер станции'].map(
- (job, index) => (
+
+ {Array.from(jobsByType.entries()).map(([type, jobs]) => (
+
+ {jobs.map((job: Jobs[number], index: number) => (
- ),
- )}
-
+ ))}
+
+ ))}