diff --git a/.env b/.env index 2f3436c1..b6d37d99 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ NEXT_PUBLIC_API=http://192.168.1.250:3001/ +NEXT_PUBLIC_OLD_API=https://graff.estate/api NEXT_PUBLIC_S3_BUCKET=https://storage.yandexcloud.net/dult-faib-knac-fint NEXT_PUBLIC_TINYMCE_API_KEY=2vf68779upg45y46o6g5gaxldy9gzr399eyaaqa0ki3mj2h2 \ No newline at end of file diff --git a/public/img/components/datamining/2k.png b/public/img/components/datamining/2k.png new file mode 100644 index 00000000..97aacaf6 Binary files /dev/null and b/public/img/components/datamining/2k.png differ diff --git a/public/img/components/datamining/room1.png b/public/img/components/datamining/room1.png new file mode 100644 index 00000000..016dce6b Binary files /dev/null and b/public/img/components/datamining/room1.png differ diff --git a/public/img/components/datamining/room2.png b/public/img/components/datamining/room2.png new file mode 100644 index 00000000..fa944017 Binary files /dev/null and b/public/img/components/datamining/room2.png differ diff --git a/public/img/components/datamining/vova.png b/public/img/components/datamining/vova.png new file mode 100644 index 00000000..94e613f8 Binary files /dev/null and b/public/img/components/datamining/vova.png differ diff --git a/public/img/components/products/prime.png b/public/img/components/products/prime.png index 6c17668a..18c0c09e 100644 Binary files a/public/img/components/products/prime.png and b/public/img/components/products/prime.png differ diff --git a/src/api/index.ts b/src/api/index.ts index 15864f46..67be8e63 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,6 +1,10 @@ import ky from 'ky'; +export const oldApi = ky.extend({ + prefixUrl: process.env.NEXT_PUBLIC_OLD_API, +}); + export const api = ky.extend({ - prefixUrl: process.env.NEXT_PUBLIC_API, + prefixUrl: process.env.NEXT_PUBLIC_OLD_API, credentials: 'include', }); diff --git a/src/app/(main)/page.tsx b/src/app/(main)/page.tsx index 8b412451..a4277e35 100644 --- a/src/app/(main)/page.tsx +++ b/src/app/(main)/page.tsx @@ -1,4 +1,5 @@ import { AvailablesSlider } from '@/components/pages/MainPage/Availables/AvailablesSlider'; +import { Calculator } from '@/components/pages/MainPage/Calculator/Calculator'; import { Clients } from '@/components/pages/MainPage/Clients'; import { Datamining } from '@/components/pages/MainPage/Datamining'; import { IntegrationsSlider } from '@/components/pages/MainPage/Integrations/IntegrationsSlider'; @@ -6,6 +7,7 @@ import { Motivation } from '@/components/pages/MainPage/Motivation'; import { Projects } from '@/components/pages/MainPage/Projects'; import { Reviews } from '@/components/pages/MainPage/Reviews'; import { Showreel } from '@/components/pages/MainPage/Showreel'; +import { Statistics } from '@/components/pages/MainPage/Statistics'; import { Streaming } from '@/components/pages/MainPage/Streaming'; import { Winners } from '@/components/pages/MainPage/Winners'; import { integrations } from '@/consts/integrations'; @@ -24,7 +26,7 @@ export default function HomePage() { - {/* */} + - {/* */} + diff --git a/src/components/Layout/Feedback.tsx b/src/components/Layout/Feedback.tsx index 106fef7e..9eaf5e3c 100644 --- a/src/components/Layout/Feedback.tsx +++ b/src/components/Layout/Feedback.tsx @@ -20,8 +20,7 @@ export function Feedback() { className="lg:px-6 px-4 sm:grid lg:grid-cols-12 sm:grid-cols-2 lg:gap-x-4 sm:gap-x-14 lg:gap-y-[68px] pb-20 pt-[70px]" >

- Хотите использовать интерактивные тренажеры в обучении? -
+ Хотите увеличить конверсию?
Давайте обсудим детали.

- */} )} diff --git a/src/components/TagFilterItem.tsx b/src/components/TagFilterItem.tsx index 63b479e4..643328ee 100644 --- a/src/components/TagFilterItem.tsx +++ b/src/components/TagFilterItem.tsx @@ -16,7 +16,9 @@ export function TagFilterItem({ multiple?: boolean; }) { const { push } = useRouter(); + const pathname = usePathname(); + const params = new URLSearchParams(useSearchParams()); function clickHandler() { diff --git a/src/components/icons/PhoneIcon.tsx b/src/components/icons/PhoneIcon.tsx index a5e8e63b..73a3917f 100644 --- a/src/components/icons/PhoneIcon.tsx +++ b/src/components/icons/PhoneIcon.tsx @@ -1,20 +1,24 @@ export function PhoneIcon() { return ( - - - + + + ); } diff --git a/src/components/modals/ModalWithForm.tsx b/src/components/modals/ModalWithForm.tsx index 185cadb9..3c32e55d 100644 --- a/src/components/modals/ModalWithForm.tsx +++ b/src/components/modals/ModalWithForm.tsx @@ -1,6 +1,6 @@ 'use client'; -import { api } from '@/api'; +import { oldApi } from '@/api'; import { ClassNameWrapper } from '@/hocs/ClassNameWrapper'; import { useModalStore } from '@/stores/useModalStore'; import { Button } from '@/ui/Button'; @@ -47,7 +47,7 @@ export function ModalWithForm() { setIsLoading(true); try { - await api + await oldApi .post('mail', { json: { fullname: name, @@ -89,9 +89,9 @@ export function ModalWithForm() { ); return ( -
+
{!isSend ? ( -
+

Оставьте заявку

+ Продукты + {Products.map((product, index) => ( ))} + )} @@ -105,7 +107,7 @@ function ProductItem({ }} transition={{ duration: 0.2, type: 'just', delay: 0.1 }} className={ - 'border border-[#3D425C] -mt-px -ml-px p-6 flex col-span-1 row-span-1 aspect-[517/304] bg-[url(/img/components/products/highlight.svg)] bg-[length:0px_0px] bg-left-top bg-no-repeat cursor-pointer ' + + 'border border-[#3D425C] -mt-px -ml-px p-6 aspect-[588/207] flex bg-[url(/img/components/products/highlight.svg)] bg-[length:0px_0px] bg-left-top bg-no-repeat cursor-pointer ' + className } > diff --git a/src/components/pages/MainPage/Calculator/Calculator.tsx b/src/components/pages/MainPage/Calculator/Calculator.tsx index 938996c3..a2efe697 100644 --- a/src/components/pages/MainPage/Calculator/Calculator.tsx +++ b/src/components/pages/MainPage/Calculator/Calculator.tsx @@ -1,6 +1,6 @@ 'use client'; -import { api } from '@/api'; +import { oldApi } from '@/api'; import regionsData from '@/consts/regionsData.json'; import { useWindowWidth } from '@/hooks/useWindowWidth'; import { Descriptor } from '@/ui/Descriptor'; @@ -41,7 +41,7 @@ export function Calculator() { const [calculated, setCalculated] = useState(true); async function getRegionName() { - const result: any = await api.get('getRegionName').json(); + const result: any = await oldApi.get('getRegionName').json(); if (result.error) { setSelectedRegion(regionsData.find(region => region.id === 11)); @@ -55,6 +55,20 @@ export function Calculator() { setSelectedRegion(foundRegion); } + // useGetRegionNameQuery({ + // onCompleted: data => { + // if (data.regionName.__typename === 'Region') { + // const { regionName } = data.regionName; + // setSelectedRegion( + // regionsData.find(region => region.name === regionName) || + // regionsData.find(region => region.id === 11), + // ); + // return; + // } + // setSelectedRegion(regionsData.find(region => region.id === 11)); + // }, + // }); + useEffect(() => { getRegionName(); }, []); diff --git a/src/components/pages/MainPage/Datamining.tsx b/src/components/pages/MainPage/Datamining.tsx index b912a562..6788ca7e 100644 --- a/src/components/pages/MainPage/Datamining.tsx +++ b/src/components/pages/MainPage/Datamining.tsx @@ -1,5 +1,5 @@ -import { ClientIcon } from '@/components/icons/ClientIcon'; -import { ListIcon } from '@/components/icons/ListIcon'; +import { MailIcon } from '@/components/icons/MailIcon'; +import { PhoneIcon } from '@/components/icons/PhoneIcon'; import { Title } from '@/ui/Title'; import Image from 'next/image'; @@ -19,7 +19,30 @@ export function Datamining() {

- + {/* */} +
+ room2 + room1 + room1 +

Актуальная информация о квартирах @@ -31,7 +54,21 @@ export function Datamining() {

- +
+ vova +
+ +
+
+ +
+

Создание карточки клиента diff --git a/src/components/pages/MainPage/Projects.tsx b/src/components/pages/MainPage/Projects.tsx index 8b012db7..d4d2de22 100644 --- a/src/components/pages/MainPage/Projects.tsx +++ b/src/components/pages/MainPage/Projects.tsx @@ -4,7 +4,6 @@ import { ArrowMoreIcon } from '@/components/icons/ArrowMoreIcon'; import { ClassNameWrapper } from '@/hocs/ClassNameWrapper'; import { useGetProjectsQuery } from '@/queries/projects/getProjects'; import { IProject } from '@/types/IProject'; -import { Button } from '@/ui/Button'; import { Descriptor } from '@/ui/Descriptor'; import { getProjectsCount } from '@/utils/getProjectsCount'; import { getSortedProjects } from '@/utils/getSortedProjects'; @@ -48,9 +47,8 @@ export function Projects() {

За 13 лет работы мы - реализовали + реализовали{' '} - {' '} {getProjectsCount( Array.from(sortedProjects?.values() ?? [])?.flat().length, )} @@ -58,20 +56,16 @@ export function Projects() { в разных городах России и мира

- + Все проекты + } + /> +
-
+
setTab(0)} active={tab === 0} diff --git a/src/components/pages/MainPage/Statistics.tsx b/src/components/pages/MainPage/Statistics.tsx index d4aad4f2..2e40c209 100644 --- a/src/components/pages/MainPage/Statistics.tsx +++ b/src/components/pages/MainPage/Statistics.tsx @@ -1,9 +1,10 @@ 'use client'; -import { api } from '@/api'; +import { useGetProjectsQuery } from '@/queries/projects/getProjects'; import { IProject } from '@/types/IProject'; import { Descriptor } from '@/ui/Descriptor'; import { Title } from '@/ui/Title'; +import { getProjectsCount } from '@/utils/getProjectsCount'; import { motion, useInView, useMotionValue, useSpring } from 'framer-motion'; import { Manrope } from 'next/font/google'; import Image from 'next/image'; @@ -15,20 +16,16 @@ const manrope = Manrope({ subsets: ['latin'] }); export function Statistics() { const [projects, setProjects] = useState([]); - async function getProjects() { - try { - const projects: IProject[] = await api.get('projects').json(); - return projects; - } catch (error) { - if (error instanceof Error) { - alert(`Error: ${error.message}`); + useGetProjectsQuery({ + variables: { devices: [] }, + onCompleted(data) { + if (data.projects.__typename === 'Error') { + alert(data.projects.message); + } else if (data.projects.__typename === 'Projects') { + setProjects(data.projects.projects as IProject[]); } - } - } - - useEffect(() => { - getProjects().then(projects => setProjects(projects!)); - }, []); + }, + }); return (
@@ -44,8 +41,7 @@ export function Statistics() {
Мы собрали статистику за 13 лет работы c застройщиками, - реализовав - {/* {getProjectsCount(projects.length)} */} + реализовав {getProjectsCount(projects.length)}
diff --git a/src/components/pages/MainPage/Streaming.tsx b/src/components/pages/MainPage/Streaming.tsx index cb9d5b24..5a0fa67e 100644 --- a/src/components/pages/MainPage/Streaming.tsx +++ b/src/components/pages/MainPage/Streaming.tsx @@ -25,7 +25,7 @@ export function Streaming() { выбора квартиры

-
+
-
+

Местоположение и устройство не имеют значения. Нужен только интернет

-
+
-
- - -
{' '} + {data?.checkAuth.__typename === 'CheckAuthResponse' && + data.checkAuth.isAuth && ( +
+ + +
+ )}
))}
-
+ {/*
{ProjectYears.map(year => ( ))}
- + */}
); } diff --git a/src/components/pages/ProjectsPage/ProjectsSection.tsx b/src/components/pages/ProjectsPage/ProjectsSection.tsx index 8115642a..0a65cad5 100644 --- a/src/components/pages/ProjectsPage/ProjectsSection.tsx +++ b/src/components/pages/ProjectsPage/ProjectsSection.tsx @@ -22,15 +22,16 @@ export function ProjectsSection({ const [filteredProjects, setFilteredProjects] = useState(projects); useEffect(() => { + console.log(projects); setFilteredProjects( projects.filter( project => - (!params.has('tags') || - (params.getAll('tags') as Device[]).every(tag => - project.devices.includes(tag), - )) && - (!params.has('year') || - params.get('year') === project.releaseDate.split('-')[0]), + !params.has('tags') || + (params.getAll('tags') as Device[]).every(tag => + project.devices.includes(tag), + ), + // &&(!params.has('year') || + // params.get('year') === project.releaseDate.split('-')[0]), ), ); }, [projects, params]); diff --git a/src/consts/ProjectTags.ts b/src/consts/ProjectTags.ts index 8e5827f0..5281677f 100644 --- a/src/consts/ProjectTags.ts +++ b/src/consts/ProjectTags.ts @@ -1,3 +1,3 @@ import { Device } from '@/types/IProject'; -export const ProjectTags: Device[] = ['mobile', 'stream', 'touch', 'vr']; +export const ProjectTags: Device[] = ['Mobile', 'Stream', 'Touch', 'VR']; diff --git a/src/consts/products.json b/src/consts/products.json index afb1c3ea..86336811 100644 --- a/src/consts/products.json +++ b/src/consts/products.json @@ -13,24 +13,18 @@ }, { "id": 2, - "title": "View", - "text": "Интерактивное окно", - "image": "/img/components/products/view.png" - }, - { - "id": 3, "title": "Web", "text": "Создание сайтов", "image": "/img/components/products/web.png" }, { - "id": 4, + "id": 3, "title": "360", "text": "Сферы для сайта", "image": "/img/components/products/360.png" }, { - "id": 5, + "id": 4, "title": "Picture", "text": "Архитектурная визуализация", "image": "/img/components/products/picture.png" diff --git a/src/generated/graphql.ts b/src/generated/graphql.ts index b7a36c13..10582f76 100644 --- a/src/generated/graphql.ts +++ b/src/generated/graphql.ts @@ -186,6 +186,7 @@ export type Query = { logout: LogoutResult; project: ProjectResult; projects: ProjectsResult; + regionName: RegionResult; }; @@ -219,6 +220,13 @@ export type Quote = { type: Scalars['String']['output']; }; +export type Region = { + __typename?: 'Region'; + regionName: Scalars['String']['output']; +}; + +export type RegionResult = Error | Region; + export type Slider = { __typename?: 'Slider'; images: Array; diff --git a/src/queries/region/getRegionName.generated.ts b/src/queries/region/getRegionName.generated.ts new file mode 100644 index 00000000..dd8c2f13 --- /dev/null +++ b/src/queries/region/getRegionName.generated.ts @@ -0,0 +1,55 @@ +import * as Types from '../../generated/graphql'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type GetRegionNameQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type GetRegionNameQuery = { __typename?: 'Query', regionName: { __typename?: 'Error', message: string } | { __typename?: 'Region', regionName: string } }; + + +export const GetRegionNameDocument = gql` + query GetRegionName { + regionName { + ... on Region { + regionName + } + ... on Error { + message + } + } +} + `; + +/** + * __useGetRegionNameQuery__ + * + * To run a query within a React component, call `useGetRegionNameQuery` and pass it any options that fit your needs. + * When your component renders, `useGetRegionNameQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetRegionNameQuery({ + * variables: { + * }, + * }); + */ +export function useGetRegionNameQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(GetRegionNameDocument, options); + } +export function useGetRegionNameLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(GetRegionNameDocument, options); + } +export function useGetRegionNameSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { + const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} + return Apollo.useSuspenseQuery(GetRegionNameDocument, options); + } +export type GetRegionNameQueryHookResult = ReturnType; +export type GetRegionNameLazyQueryHookResult = ReturnType; +export type GetRegionNameSuspenseQueryHookResult = ReturnType; +export type GetRegionNameQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/src/queries/region/getRegionName.gql b/src/queries/region/getRegionName.gql new file mode 100644 index 00000000..1a817263 --- /dev/null +++ b/src/queries/region/getRegionName.gql @@ -0,0 +1,10 @@ +query GetRegionName { + regionName { + ... on Region { + regionName + } + ... on Error { + message + } + } +} diff --git a/src/queries/region/index.ts b/src/queries/region/index.ts new file mode 100644 index 00000000..559835ac --- /dev/null +++ b/src/queries/region/index.ts @@ -0,0 +1 @@ +export * from './getRegionName.generated'; diff --git a/src/types/IProject.ts b/src/types/IProject.ts index 8250453b..fbd65cf5 100644 --- a/src/types/IProject.ts +++ b/src/types/IProject.ts @@ -1,4 +1,4 @@ -export type Device = 'stream' | 'touch' | 'mobile' | 'vr'; +export type Device = 'Stream' | 'Touch' | 'Mobile' | 'VR'; export interface IProject { id: number;