diff --git a/bun.lockb b/bun.lockb index 80aeab94..d5b2658f 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 74950340..c385d691 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@tinymce/tinymce-react": "^5.1.1", "countries-phone-masks": "^1.1.0", "date-fns": "^3.6.0", + "decline-word": "^1.4.0", "framer-motion": "^11.17.0", "html-react-parser": "^5.1.18", "jose": "^5.9.3", diff --git a/src/app/(main)/page.tsx b/src/app/(main)/page.tsx index 67612c32..1e92024d 100644 --- a/src/app/(main)/page.tsx +++ b/src/app/(main)/page.tsx @@ -16,7 +16,6 @@ import { HydrationBoundary, QueryClient, } from '@tanstack/react-query'; -import { Suspense } from 'react'; export default async function HomePage() { const queryClient = new QueryClient(); @@ -42,9 +41,9 @@ export default async function HomePage() { }); await queryClient.prefetchQuery({ - queryKey: ['projects', 'Удаленная дмонстрация'], + queryKey: ['projects', 'Удаленная демонстрация'], queryFn: async ({ queryKey: [, tag] }) => - await api.get('projects/tags=' + tag).json(), + await api.get('projects?tags=' + tag).json(), }); return ( @@ -52,15 +51,12 @@ export default async function HomePage() { - {/* */} - - - + ); diff --git a/src/components/pages/MainPage/Awards.tsx b/src/components/pages/MainPage/Awards.tsx index 58e79145..dc398f50 100644 --- a/src/components/pages/MainPage/Awards.tsx +++ b/src/components/pages/MainPage/Awards.tsx @@ -57,7 +57,7 @@ export function AwardItem({ : 'lg:self-start' }`} > -
+
(); - const [consultations, setConsultations] = useState(100); + const [consultations, setConsultations] = useState(10); const [implementationPeriod, setImplementationPeriod] = useState( null! ); @@ -145,7 +145,7 @@ export function Calculator() { /> )}
-
+

Ежемесячный доход

diff --git a/src/components/pages/MainPage/Calculator/ConsultationsRange.tsx b/src/components/pages/MainPage/Calculator/ConsultationsRange.tsx index 5a5f0458..757dd406 100644 --- a/src/components/pages/MainPage/Calculator/ConsultationsRange.tsx +++ b/src/components/pages/MainPage/Calculator/ConsultationsRange.tsx @@ -26,11 +26,9 @@ export function ConsultationRange({ setStart( Math.max( Math.min( - isMouseEvent(e) - ? e.clientX - : e.touches[0].clientX - - root.current!.getBoundingClientRect().x - - offset, + (isMouseEvent(e) ? e.clientX : e.touches[0].clientX) - + root.current!.getBoundingClientRect().x - + offset, root.current!.clientWidth ), root.current!.clientWidth / 35 @@ -43,11 +41,9 @@ export function ConsultationRange({ if (!el || !isMouseDown) return; const dx = Math.max( Math.min( - isMouseEvent(e) - ? (e as MouseEvent).clientX - : e.touches[0].clientX - - root.current!.getBoundingClientRect().x - - start, + (isMouseEvent(e) ? e.clientX : e.touches[0].clientX) - + root.current!.getBoundingClientRect().x - + start, root.current!.clientWidth - 48 ), (root.current!.clientWidth - 48) / 35 diff --git a/src/components/pages/MainPage/Clients.tsx b/src/components/pages/MainPage/Clients.tsx index e6716472..f3c478da 100644 --- a/src/components/pages/MainPage/Clients.tsx +++ b/src/components/pages/MainPage/Clients.tsx @@ -3,6 +3,7 @@ import { ItemActions } from '@/components/ItemActions'; import { CompanyFormModal } from '@/components/modals/CompanyFormModal'; import { OpenFormModalWrapper } from '@/hocs/OpenFormModalWrapper'; +import { useMediaQueries } from '@/hooks/useMediaQueries'; import { useGetCompaniesQuery } from '@/queries/getCompanies'; import { GradientButton } from '@/ui/GradientButton'; import { Icon } from '@/ui/Icon'; @@ -14,38 +15,61 @@ import Link from 'next/link'; export function Clients() { const { data: companies } = useGetCompaniesQuery(); + const { isLg, isSm } = useMediaQueries(); + return (

- + <Title className="mx-auto text-center max-w-3/4"> <span className="text-gradient"> {companies !== undefined && getCompaniesCount(companies.length)} </span>{' '} уже внедрили наш продукт в свою цепочку продаж {companies && ( -
- {companies?.map( - (company) => - company.logo && ( -
- -
- {company.title} -
- - -
- ) - )} +
+ {companies + .filter((company) => company.logo) + .map((company, index, { length }) => ( +
length - 1 - (length % (isLg ? 9 : isSm ? 5 : 3)) + ? { + transform: `translateX(${ + (Math.trunc((isLg ? 9 : isSm ? 5 : 3) / 2) - + Math.trunc( + (length % (isLg ? 9 : isSm ? 5 : 3)) / 2 + )) * + 100 + }%)`, + left: + (Math.trunc((isLg ? 9 : isSm ? 5 : 3) / 2) - + Math.trunc( + (length % (isLg ? 9 : isSm ? 5 : 3)) / 2 + )) * + 8, + } + : undefined + } + > + +
+ {company.title} +
+ + +
+ ))} } modalName="addCompany" diff --git a/src/components/pages/MainPage/Map/CityPoint.tsx b/src/components/pages/MainPage/Map/CityPoint.tsx index 523fedff..c40024d2 100644 --- a/src/components/pages/MainPage/Map/CityPoint.tsx +++ b/src/components/pages/MainPage/Map/CityPoint.tsx @@ -1,90 +1,90 @@ -import { ICityProjects } from '@/types/ICityProjects'; -import { distinctCompanies } from '@/utils/distinctCompanies'; -import Image from 'next/image'; -import { Dispatch, SetStateAction, useEffect, useRef } from 'react'; -import { useHover } from 'usehooks-ts'; +// import { ICityProjects } from '@/types/ICityProjects'; +// import { distinctCompanies } from '@/utils/distinctCompanies'; +// import Image from 'next/image'; +// import { Dispatch, SetStateAction, useEffect, useRef } from 'react'; +// import { useHover } from 'usehooks-ts'; -export function CityPoint({ - title, - companies, - x, - y, - chooseCity, - active, - setCurrentHovered, - index, -}: ICityProjects & { - chooseCity: (_: ICityProjects) => void; - active: boolean; - setCurrentHovered: Dispatch>; - index: number; -}) { - const companiesWithMapIcon = distinctCompanies( - companies.filter((company) => company.mapIcon) - ); +// export function CityPoint({ +// title, +// companies, +// x, +// y, +// chooseCity, +// active, +// setCurrentHovered, +// index, +// }: ICityProjects & { +// chooseCity: (_: ICityProjects) => void; +// active: boolean; +// setCurrentHovered: Dispatch>; +// index: number; +// }) { +// const companiesWithMapIcon = distinctCompanies( +// companies.filter((company) => company.mapIcon) +// ); - const ref = useRef(null); +// const ref = useRef(null); - const hovered = useHover(ref); +// const hovered = useHover(ref); - useEffect(() => { - setCurrentHovered(hovered ? index : undefined); - }, [hovered, index, setCurrentHovered]); +// useEffect(() => { +// setCurrentHovered(hovered ? index : undefined); +// }, [hovered, index, setCurrentHovered]); - return ( -
-
chooseCity({ title, x, y, companies })} - ref={ref} - > -
-
-
-

{title}

-
- {companiesWithMapIcon - .slice(0, 3) - .map(({ mapIcon, title, id }, index) => ( -
- {mapIcon && ( - {title} - )} -
- ))} - {Math.min(companiesWithMapIcon.length, 3) !== companies.length && ( -
- +{companies.length - Math.min(companiesWithMapIcon.length, 3)} -
- )} -
-
-
- ); -} +// return ( +//
+//
chooseCity({ title, x, y, companies })} +// ref={ref} +// > +//
+//
+//
+//

{title}

+//
+// {companiesWithMapIcon +// .slice(0, 3) +// .map(({ mapIcon, title, id }, index) => ( +//
+// {mapIcon && ( +// {title} +// )} +//
+// ))} +// {Math.min(companiesWithMapIcon.length, 3) !== companies.length && ( +//
+// +{companies.length - Math.min(companiesWithMapIcon.length, 3)} +//
+// )} +//
+//
+//
+// ); +// } diff --git a/src/components/pages/MainPage/Map/NewMap.tsx b/src/components/pages/MainPage/Map/NewMap.tsx index 34b230fd..b13fa71d 100644 --- a/src/components/pages/MainPage/Map/NewMap.tsx +++ b/src/components/pages/MainPage/Map/NewMap.tsx @@ -1,40 +1,133 @@ 'use client'; -import { useGetProjectsQuery } from '@/queries/getProjects'; +import { cities } from '@/consts/cities'; +import { mapVideos } from '@/consts/mapVideos'; +import { useGetCompniesByCityQuery } from '@/queries/getCompaniesByCity'; +import { useGetProjectsCountQuery } from '@/queries/getProjectsCount'; import { useCityPointStore } from '@/stores/useCityPointStore'; +import { ICityProjects } from '@/types/ICityProjects'; import { ICompany } from '@/types/ICompany'; -import { useEffect, useState } from 'react'; +import { prepositionCity } from '@/utils/prepositionCity'; +import Image from 'next/image'; +import { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react'; +import { useHover } from 'usehooks-ts'; export function NewMap() { - const { cityPoint, setCityPoint } = useCityPointStore(); + const { cityPoint } = useCityPointStore(); - const [companies, setCompanies] = useState([]); + const [currentHovered, setCurrentHovered] = useState(); - const { data: projects } = useGetProjectsQuery(cityPoint.title); - - useEffect(() => { - setCompanies( - projects!.map(({ company }) => company)?.filter((company) => !!company) - ); - }, []); - - const [currentCompany, setCurrentCompany] = useState('Бруниска'); + const { data: companies } = useGetCompniesByCityQuery(cityPoint.title); return ( -
-
-