Compare commits

..

No commits in common. "2810c6b9fb30a8f99238feaddefa6fc761b075da" and "82018cea2cb417cb4a43a864759b1f98e487b07f" have entirely different histories.

15 changed files with 93 additions and 244 deletions

View File

@ -1,15 +1,7 @@
import type { NextConfig } from 'next'; import type { NextConfig } from "next";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
images: { /* config options here */
remotePatterns: [
{
protocol: 'https',
hostname: 'media.bambooapp.ai',
pathname: '/files/**',
},
],
},
}; };
export default nextConfig; export default nextConfig;

View File

@ -11,7 +11,6 @@
}, },
"dependencies": { "dependencies": {
"@hookform/resolvers": "^5.0.1", "@hookform/resolvers": "^5.0.1",
"@pbe/react-yandex-maps": "^1.2.5",
"@radix-ui/react-collapsible": "^1.1.8", "@radix-ui/react-collapsible": "^1.1.8",
"@radix-ui/react-dialog": "^1.1.11", "@radix-ui/react-dialog": "^1.1.11",
"@radix-ui/react-dropdown-menu": "^2.1.11", "@radix-ui/react-dropdown-menu": "^2.1.11",

23
pnpm-lock.yaml generated
View File

@ -11,9 +11,6 @@ importers:
'@hookform/resolvers': '@hookform/resolvers':
specifier: ^5.0.1 specifier: ^5.0.1
version: 5.0.1(react-hook-form@7.56.1(react@19.1.0)) version: 5.0.1(react-hook-form@7.56.1(react@19.1.0))
'@pbe/react-yandex-maps':
specifier: ^1.2.5
version: 1.2.5(react@19.1.0)
'@radix-ui/react-collapsible': '@radix-ui/react-collapsible':
specifier: ^1.1.8 specifier: ^1.1.8
version: 1.1.8(@types/react-dom@19.1.2(@types/react@19.1.2))(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) version: 1.1.8(@types/react-dom@19.1.2(@types/react@19.1.2))(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
@ -520,12 +517,6 @@ packages:
resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==} resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==}
engines: {node: '>=12.4.0'} engines: {node: '>=12.4.0'}
'@pbe/react-yandex-maps@1.2.5':
resolution: {integrity: sha512-cBojin5e1fPx9XVCAqHQJsCnHGMeBNsP0TrNfpWCrPFfxb30ye+JgcGr2mn767Gbr1d+RufBLRiUcX2kaiAwjQ==}
engines: {node: '>=16'}
peerDependencies:
react: ^16.x || ^17.x || ^18.x
'@pkgr/core@0.2.4': '@pkgr/core@0.2.4':
resolution: {integrity: sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw==} resolution: {integrity: sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw==}
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
@ -1115,9 +1106,6 @@ packages:
'@types/use-sync-external-store@0.0.6': '@types/use-sync-external-store@0.0.6':
resolution: {integrity: sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==} resolution: {integrity: sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==}
'@types/yandex-maps@2.1.29':
resolution: {integrity: sha512-nuibRWj3RU/9KXlCzTrRtDE+n6V9l7NbT9JakicqZ5OXIdwyb6blvV2Uwn6lB58WYm3DSUDP2I2AWlnWMc8z2w==}
'@typescript-eslint/eslint-plugin@8.30.1': '@typescript-eslint/eslint-plugin@8.30.1':
resolution: {integrity: sha512-v+VWphxMjn+1t48/jO4t950D6KR8JaJuNXzi33Ve6P8sEmPr5k6CEXjdGwT6+LodVnEa91EQCtwjWNUCPweo+Q==} resolution: {integrity: sha512-v+VWphxMjn+1t48/jO4t950D6KR8JaJuNXzi33Ve6P8sEmPr5k6CEXjdGwT6+LodVnEa91EQCtwjWNUCPweo+Q==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@ -2995,11 +2983,6 @@ snapshots:
'@nolyfill/is-core-module@1.0.39': {} '@nolyfill/is-core-module@1.0.39': {}
'@pbe/react-yandex-maps@1.2.5(react@19.1.0)':
dependencies:
'@types/yandex-maps': 2.1.29
react: 19.1.0
'@pkgr/core@0.2.4': {} '@pkgr/core@0.2.4': {}
'@radix-ui/number@1.1.1': {} '@radix-ui/number@1.1.1': {}
@ -3572,8 +3555,6 @@ snapshots:
'@types/use-sync-external-store@0.0.6': {} '@types/use-sync-external-store@0.0.6': {}
'@types/yandex-maps@2.1.29': {}
'@typescript-eslint/eslint-plugin@8.30.1(@typescript-eslint/parser@8.30.1(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3)': '@typescript-eslint/eslint-plugin@8.30.1(@typescript-eslint/parser@8.30.1(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3)':
dependencies: dependencies:
'@eslint-community/regexpp': 4.12.1 '@eslint-community/regexpp': 4.12.1
@ -4125,7 +4106,7 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@8.30.1(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0)(eslint@9.25.0(jiti@2.4.2)): eslint-module-utils@2.12.0(@typescript-eslint/parser@8.30.1(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0(eslint-plugin-import-x@4.10.6(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3))(eslint-plugin-import@2.31.0)(eslint@9.25.0(jiti@2.4.2)))(eslint@9.25.0(jiti@2.4.2)):
dependencies: dependencies:
debug: 3.2.7 debug: 3.2.7
optionalDependencies: optionalDependencies:
@ -4167,7 +4148,7 @@ snapshots:
doctrine: 2.1.0 doctrine: 2.1.0
eslint: 9.25.0(jiti@2.4.2) eslint: 9.25.0(jiti@2.4.2)
eslint-import-resolver-node: 0.3.9 eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.30.1(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0)(eslint@9.25.0(jiti@2.4.2)) eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.30.1(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0(eslint-plugin-import-x@4.10.6(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3))(eslint-plugin-import@2.31.0)(eslint@9.25.0(jiti@2.4.2)))(eslint@9.25.0(jiti@2.4.2))
hasown: 2.0.2 hasown: 2.0.2
is-core-module: 2.16.1 is-core-module: 2.16.1
is-glob: 4.0.3 is-glob: 4.0.3

View File

@ -45,6 +45,6 @@ export type Station = Root<{
_propanCopy: boolean; _propanCopy: boolean;
_zaryadnayaStanci: boolean; _zaryadnayaStanci: boolean;
_miniMarketCop: boolean; _miniMarketCop: boolean;
_region: Select[]; _region: Select;
_foto: Image[]; _foto: Image[];
}>; }>;

View File

@ -1,18 +0,0 @@
import {
presentDiscounts,
presentJobs,
presentPartners,
presentStations,
} from '../presenters';
export type Partners = ReturnType<typeof presentPartners>;
export type Jobs = ReturnType<typeof presentJobs>;
export type Discounts = ReturnType<typeof presentDiscounts>;
export type Stations = ReturnType<typeof presentStations>;
export type MainPageData = {
discounts: Discounts;
jobs: Jobs;
partners: Partners;
stations: Stations;
};

View File

@ -6,15 +6,13 @@ export const presentImage = (images: Image[]) =>
isEmpty(images) ? null : `${process.env.TAYLOR_MEDIA_URL}/${images[0].url}`; isEmpty(images) ? null : `${process.env.TAYLOR_MEDIA_URL}/${images[0].url}`;
export const presentPartners = (partners: Partner) => export const presentPartners = (partners: Partner) =>
partners.records.map((record, index) => ({ partners.records.map((record) => ({
id: index + 1,
name: record._name, name: record._name,
poster: presentImage(record._image), poster: presentImage(record._image),
})); }));
export const presentJobs = (jobs: Job) => export const presentJobs = (jobs: Job) =>
jobs.records.map((job, index) => ({ jobs.records.map((job) => ({
id: index + 1,
name: job._name, name: job._name,
tags: job._tags.map((tag) => tag.name), tags: job._tags.map((tag) => tag.name),
location: !isEmpty(job._localtio) ? job._localtio[0].name : null, location: !isEmpty(job._localtio) ? job._localtio[0].name : null,
@ -22,8 +20,7 @@ export const presentJobs = (jobs: Job) =>
})); }));
export const presentDiscounts = (discounts: Discount) => export const presentDiscounts = (discounts: Discount) =>
discounts.records.map((discount, index) => ({ discounts.records.map((discount) => ({
id: index + 1,
name: discount._name, name: discount._name,
description: discount._opisanie, description: discount._opisanie,
expiresAt: discount._do, expiresAt: discount._do,
@ -31,8 +28,7 @@ export const presentDiscounts = (discounts: Discount) =>
})); }));
export const presentStations = (stations: Station) => export const presentStations = (stations: Station) =>
stations.records.map((station, index) => ({ stations.records.map((station: any) => ({
id: index + 1,
name: station._name, name: station._name,
description: station._opisanie, description: station._opisanie,
address: station._adress, address: station._adress,

View File

@ -8,23 +8,16 @@ import { PromotionsSection } from '@/widgets/promotions-section';
import { StatsSection } from '@/widgets/stats-section'; import { StatsSection } from '@/widgets/stats-section';
import { VacanciesSection } from '@/widgets/vacancies-section'; import { VacanciesSection } from '@/widgets/vacancies-section';
import { MainPageData } from './api-utlities/@types/main'; export default function Home() {
export default async function Home() {
const mainPageData = (await fetch(
`${process.env.NEXT_PUBLIC_BASE_URL}/api/pages/main`,
{ method: 'GET' },
).then((res) => res.json())) as MainPageData;
return ( return (
<main> <main>
<HeroSection /> <HeroSection />
<StatsSection /> <StatsSection />
<MapSection stations={mainPageData.stations} /> <MapSection />
<AboutSection /> <AboutSection />
<PromotionsSection discounts={mainPageData.discounts} /> <PromotionsSection />
<VacanciesSection jobs={mainPageData.jobs} /> <VacanciesSection />
<PartnersSection partners={mainPageData.partners} /> <PartnersSection />
<CharitySection /> <CharitySection />
<CtaSection /> <CtaSection />
</main> </main>

View File

@ -1,4 +0,0 @@
export type Point = {
id: number;
coordinates: [number, number];
};

View File

@ -10,8 +10,6 @@ import {
} from 'lucide-react'; } from 'lucide-react';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { Stations } from '@/app/api-utlities/@types/main';
import { useLanguage } from '@/shared/language'; import { useLanguage } from '@/shared/language';
import { Badge } from '@/shared/shadcn-ui/badge'; import { Badge } from '@/shared/shadcn-ui/badge';
import { Button } from '@/shared/shadcn-ui/button'; import { Button } from '@/shared/shadcn-ui/button';
@ -170,13 +168,7 @@ const allFilters = [
// Extract unique cities from stations // Extract unique cities from stations
const allCities = [...new Set(stations.map((station) => station.city))].sort(); const allCities = [...new Set(stations.map((station) => station.city))].sort();
interface GasStationMapProps { export default function GasStationMap() {
stations: Stations;
}
export default function GasStationMap({
stations: _stations,
}: GasStationMapProps) {
const { t } = useLanguage(); const { t } = useLanguage();
const mapRef = useRef<HTMLDivElement>(null); const mapRef = useRef<HTMLDivElement>(null);
const [activeFilters, setActiveFilters] = useState<string[]>([]); const [activeFilters, setActiveFilters] = useState<string[]>([]);

View File

@ -1,38 +0,0 @@
'use client';
import { Map, Placemark, YMaps } from '@pbe/react-yandex-maps';
import { Point } from '../model';
type YandexMapProps = {
points: Point[];
};
export const YandexMap = ({ points }: YandexMapProps) => {
return (
<YMaps
query={{
apikey: process.env.YANDEX_MAP_API_KEY,
lang: 'ru_RU',
}}
>
<Map
defaultState={{
center: points[0].coordinates || [55.751574, 37.573856], // центр карты,
zoom: 11,
}}
className='rounded-md shadow-lg'
options={{
suppressMapOpenBlock: true,
suppressObsoleteBrowserNotifier: true,
}}
width={'100%'}
height={'500px'}
>
{points.map((point) => (
<Placemark key={point.id} geometry={point.coordinates} />
))}
</Map>
</YMaps>
);
};

View File

@ -1,15 +1,12 @@
'use client'; 'use client';
import { ChevronLeft, ChevronRight } from 'lucide-react'; import { ChevronLeft, ChevronRight} from 'lucide-react';
import Image from 'next/image'; import Image from 'next/image';
import Link from 'next/link';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Discounts } from '@/app/api-utlities/@types/main';
import { Button } from '@/shared/shadcn-ui/button'; import { Button } from '@/shared/shadcn-ui/button';
import { Card, CardContent } from '@/shared/shadcn-ui/card'; import { Card, CardContent } from '@/shared/shadcn-ui/card';
import Link from 'next/link';
import { useLanguage } from '../language'; import { useLanguage } from '../language';
const promotions = [ const promotions = [
@ -44,15 +41,11 @@ const promotions = [
}, },
]; ];
interface PromotionSliderProps { export default function PromotionSlider() {
discounts: Discounts;
}
export default function PromotionSlider({ discounts }: PromotionSliderProps) {
const [currentIndex, setCurrentIndex] = useState(0); const [currentIndex, setCurrentIndex] = useState(0);
const [visibleItems, setVisibleItems] = useState(3); const [visibleItems, setVisibleItems] = useState(3);
const { t } = useLanguage(); const { t } = useLanguage()
useEffect(() => { useEffect(() => {
const handleResize = () => { const handleResize = () => {
@ -92,7 +85,7 @@ export default function PromotionSlider({ discounts }: PromotionSliderProps) {
transform: `translateX(-${currentIndex * (100 / visibleItems)}%)`, transform: `translateX(-${currentIndex * (100 / visibleItems)}%)`,
}} }}
> >
{discounts.map((promo) => ( {promotions.map((promo) => (
<div <div
key={promo.id} key={promo.id}
className='w-full flex-none p-2 sm:w-1/2 lg:w-1/3' className='w-full flex-none p-2 sm:w-1/2 lg:w-1/3'
@ -103,21 +96,19 @@ export default function PromotionSlider({ discounts }: PromotionSliderProps) {
<div className='relative h-48'> <div className='relative h-48'>
<Image <Image
src={promo.image || '/placeholder.svg'} src={promo.image || '/placeholder.svg'}
alt={promo.name} alt={promo.title}
fill fill
className='object-cover' className='object-cover'
/> />
</div> </div>
<CardContent className='p-4'> <CardContent className='p-4'>
<h3 className='mb-2 text-lg font-bold'>{promo.name}</h3> <h3 className='mb-2 text-lg font-bold'>{promo.title}</h3>
<p className='mb-3 text-sm text-gray-600'> <p className='mb-3 text-sm text-gray-600'>
{promo.description} {promo.description}
</p> </p>
<div className='flex items-center justify-between'> <div className='flex items-center justify-between'>
<span className='text-xs text-gray-500'> <span className='text-xs text-gray-500'>
{promo.expiresAt Действует до: {promo.validUntil}
? `Действует до: ${promo.expiresAt}`
: null}
</span> </span>
<Link href='#'> <Link href='#'>
<Button <Button
@ -134,8 +125,6 @@ export default function PromotionSlider({ discounts }: PromotionSliderProps) {
</div> </div>
))} ))}
</div> </div>
{discounts.length > 3 && (
<>
<Button <Button
variant='outline' variant='outline'
size='icon' size='icon'
@ -154,8 +143,6 @@ export default function PromotionSlider({ discounts }: PromotionSliderProps) {
<ChevronRight className='h-4 w-4' /> <ChevronRight className='h-4 w-4' />
<span className='sr-only'>Следующий</span> <span className='sr-only'>Следующий</span>
</Button> </Button>
</>
)}
</div> </div>
); );
} }

View File

@ -2,26 +2,13 @@
import { MapPin } from 'lucide-react'; import { MapPin } from 'lucide-react';
import { Stations } from '@/app/api-utlities/@types/main';
import { GasStationMap } from '@/features/map'; import { GasStationMap } from '@/features/map';
import { Point } from '@/features/map/model';
import { YandexMap } from '@/features/map/ui/yandex-map';
import { useLanguage } from '@/shared/language'; import { useLanguage } from '@/shared/language';
interface MapSectionProps { export const MapSection = () => {
stations: Stations;
}
export const MapSection = ({ stations }: MapSectionProps) => {
const { t } = useLanguage(); const { t } = useLanguage();
const points = stations.map((st) => ({
id: st.id,
coordinates: [st.latitude, st.longitude],
})) as Point[];
return ( return (
<section id='stations' className='bg-gray-50 px-2 py-8 sm:py-16'> <section id='stations' className='bg-gray-50 px-2 py-8 sm:py-16'>
<div className='container mx-auto'> <div className='container mx-auto'>
@ -40,8 +27,7 @@ export const MapSection = ({ stations }: MapSectionProps) => {
className='h-[500px] overflow-hidden rounded-xl border shadow-lg' className='h-[500px] overflow-hidden rounded-xl border shadow-lg'
data-aos='fade-up' data-aos='fade-up'
> >
<GasStationMap stations={stations} /> <GasStationMap />
{/* <YandexMap points={points} /> */}
</div> </div>
</div> </div>
</section> </section>

View File

@ -4,16 +4,10 @@ import { Handshake } from 'lucide-react';
import Image from 'next/image'; import Image from 'next/image';
import Link from 'next/link'; import Link from 'next/link';
import { Partners } from '@/app/api-utlities/@types/main';
import { useLanguage } from '@/shared/language'; import { useLanguage } from '@/shared/language';
import { Button } from '@/shared/shadcn-ui/button'; import { Button } from '@/shared/shadcn-ui/button';
interface PartnersSectionProps { export const PartnersSection = () => {
partners: Partners;
}
export const PartnersSection = ({ partners }: PartnersSectionProps) => {
const { t } = useLanguage(); const { t } = useLanguage();
return ( return (
@ -32,23 +26,20 @@ export const PartnersSection = ({ partners }: PartnersSectionProps) => {
</div> </div>
<div className='grid grid-cols-2 gap-4 sm:gap-8 md:grid-cols-4'> <div className='grid grid-cols-2 gap-4 sm:gap-8 md:grid-cols-4'>
{partners.map(({ id, name, poster }) => ( {[1, 2, 3, 4, 5, 6, 7, 8].map((partner) => (
<div <div
key={id} key={partner}
className='flex h-32 flex-col items-center justify-center gap-0.5 rounded-lg bg-white p-6 shadow-md transition-transform hover:scale-105' className='flex h-32 flex-col items-center justify-center gap-0.5 rounded-lg bg-white p-6 shadow-md transition-transform hover:scale-105'
data-aos='flip-left' data-aos='flip-left'
> >
<Image <Image
src={ src={`/placeholder.svg?height=80&width=160&text=Partner ${partner}`}
poster ?? alt={`Partner ${partner}`}
`/placeholder.svg?height=80&width=160&text=Partner ${id}`
}
alt={`Partner ${id}`}
width={160} width={160}
height={80} height={80}
className='max-h-16 w-auto' className='max-h-16 w-auto'
/> />
<h4 className='font-extralight'>{name}</h4> <h4 className='font-extralight'>Название</h4>
</div> </div>
))} ))}
</div> </div>

View File

@ -2,20 +2,14 @@
import { Gift } from 'lucide-react'; import { Gift } from 'lucide-react';
import { Discounts } from '@/app/api-utlities/@types/main';
import PromotionSlider from '@/shared/components/promotion-slider'; import PromotionSlider from '@/shared/components/promotion-slider';
import { useLanguage } from '@/shared/language'; import { useLanguage } from '@/shared/language';
interface PromotionsSectionProps { export const PromotionsSection = () => {
discounts: Discounts;
}
export const PromotionsSection = ({ discounts }: PromotionsSectionProps) => {
const { t } = useLanguage(); const { t } = useLanguage();
return ( return (
<section id='promotions' className='bg-gray-50 px-2 py-8 sm:py-16'> <section id='promotions' className='bg-gray-50 py-8 px-2 sm:py-16'>
<div className='container mx-auto'> <div className='container mx-auto'>
<div className='mb-12 flex flex-col items-center justify-center text-center'> <div className='mb-12 flex flex-col items-center justify-center text-center'>
<div className='mb-4 inline-flex items-center justify-center rounded-full bg-red-100 p-2'> <div className='mb-4 inline-flex items-center justify-center rounded-full bg-red-100 p-2'>
@ -28,7 +22,7 @@ export const PromotionsSection = ({ discounts }: PromotionsSectionProps) => {
{t('home.promotions.description')} {t('home.promotions.description')}
</p> </p>
</div> </div>
<PromotionSlider discounts={discounts} /> <PromotionSlider />
</div> </div>
</section> </section>
); );

View File

@ -2,8 +2,6 @@
import { Briefcase } from 'lucide-react'; import { Briefcase } from 'lucide-react';
import { Jobs } from '@/app/api-utlities/@types/main';
import { useLanguage } from '@/shared/language'; import { useLanguage } from '@/shared/language';
import { cn } from '@/shared/lib/utils'; import { cn } from '@/shared/lib/utils';
import { Badge } from '@/shared/shadcn-ui/badge'; import { Badge } from '@/shared/shadcn-ui/badge';
@ -16,24 +14,9 @@ import {
TabsTrigger, TabsTrigger,
} from '@/shared/shadcn-ui/tabs'; } from '@/shared/shadcn-ui/tabs';
interface VacanciesSectionProps { export const VacanciesSection = () => {
jobs: Jobs;
}
export const VacanciesSection = ({ jobs }: VacanciesSectionProps) => {
const { t } = useLanguage(); 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 ( return (
<section id='vacancies' className='px-2 py-8 sm:py-16'> <section id='vacancies' className='px-2 py-8 sm:py-16'>
<div className='container mx-auto'> <div className='container mx-auto'>
@ -49,38 +32,53 @@ export const VacanciesSection = ({ jobs }: VacanciesSectionProps) => {
</p> </p>
</div> </div>
<Tabs defaultValue={allVacancies} className='mx-auto w-full max-w-3xl'> <Tabs defaultValue='all' className='mx-auto w-full max-w-3xl'>
<TabsList className='mb-8 grid grid-cols-3'> <TabsList className='mb-8 grid grid-cols-3'>
{jobsTabsTitle.map((type) => ( <TabsTrigger value='all'>{t('home.vacancies.all')}</TabsTrigger>
<TabsTrigger key={type} value={type}> <TabsTrigger value='office'>{t('home.vacancies.office')}</TabsTrigger>
{type} <TabsTrigger value='stations'>{t('home.vacancies.stations')}</TabsTrigger>
</TabsTrigger>
))}
</TabsList> </TabsList>
<TabsContent value='all' className='space-y-4'>
<TabsContent value={allVacancies} className='space-y-4'> {[
{jobs.map((job, index) => ( 'Оператор АЗС',
'Менеджер по продажам',
'Бухгалтер',
'Специалист по логистике',
].map((job, index) => (
<Vacancy <Vacancy
key={index} key={index}
jobTitle={job.name} jobTitle={job}
location={job.location ?? ''} location='Душанбе, Таджикистан'
tags={job.tags} tags={['Полный день', 'Опыт от 1 года']}
/> />
))} ))}
</TabsContent> </TabsContent>
<TabsContent value='office' className='space-y-4'>
{Array.from(jobsByType.entries()).map(([type, jobs]) => ( {[
<TabsContent key={type} value={type} className='space-y-4'> 'Менеджер по продажам',
{jobs.map((job: Jobs[number], index: number) => ( 'Бухгалтер',
'Специалист по логистике',
].map((job, index) => (
<Vacancy <Vacancy
key={index} key={index}
jobTitle={job.name} jobTitle={job}
location={job.location ?? ''} location='Душанбе, Таджикистан'
tags={job.tags} tags={['Полный день', 'Опыт от 1 года']}
/> />
))} ))}
</TabsContent> </TabsContent>
))} <TabsContent value='stations' className='space-y-4'>
{['Оператор АЗС', 'Заправщик', 'Менеджер станции'].map(
(job, index) => (
<Vacancy
key={index}
jobTitle={job}
location='Душанбе, Таджикистан'
tags={['Сменный график', 'Обучение']}
/>
),
)}
</TabsContent>
</Tabs> </Tabs>
</div> </div>
</section> </section>