Skip to content

Commit

Permalink
Merge branch 'master' into fix/graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-ivanovvv committed Jan 14, 2025
2 parents 7b02531 + 976cc93 commit eb68a84
Show file tree
Hide file tree
Showing 37 changed files with 1,407 additions and 1,147 deletions.
32 changes: 16 additions & 16 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,299 changes: 1,260 additions & 1,039 deletions .yarn/releases/yarn-remote.mjs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion blog/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"main": "src/index.ts",
"scripts": {
"build": "yarn next build src --no-lint ; cp -r ./src/.next/standalone ./dist && cp -r ./src/.next/static ./dist/src/.next/static && mv ./dist/src/server.js ./dist/src/index.cjs",
"build": "yarn next build src --no-lint && rm ./src/.next/standalone/package.json ; cp -r ./src/.next/standalone ./dist && cp -r ./src/.next/static ./dist/src/.next/static && mv ./dist/src/server.js ./dist/src/index.cjs",
"cleanup": "rm -rf dist",
"dev": "yarn next dev src",
"prepack": "run build",
Expand Down Expand Up @@ -36,6 +36,7 @@
"@fragments/root-layout-fragment": "workspace:*",
"@globals/config": "workspace:*",
"@globals/data": "workspace:*",
"@shared/api-routes": "workspace:*",
"@types/node": "22.1.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
Expand Down
1 change: 1 addition & 0 deletions blog/app/src/app/api/yandex-turbo/[[...slug]]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { yandexTurboApiHandle as GET } from '@shared/api-routes'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"prettier": "3.3.3",
"typescript": "5.4.2"
},
"packageManager": "yarn@4.5.3",
"packageManager": "yarn@4.6.0",
"typecheckSkipLibCheck": true
}
10 changes: 10 additions & 0 deletions shared/api-routes/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@shared/api-routes",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts"
}
1 change: 1 addition & 0 deletions shared/api-routes/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './yandex-turbo/index.js'
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ const getResponseOrigin = (): string => {
export const getResponseUrl = (pathname: string): string => {
const responseOrigin = getResponseOrigin()
const responseUrl = new URL(pathname, responseOrigin)
responseUrl.searchParams.append('yandex-turbo', 'true')
return responseUrl.href
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const yandexTurboApiHandle = async (

const responseUrl = getResponseUrl(pathname)

const response = await fetch(responseUrl)
const response = await fetch(responseUrl, {
cache: 'no-store',
})
const responseText = await response.text()

const bodyHtmlString = getBodyHtmlString(responseText)
Expand Down
13 changes: 0 additions & 13 deletions site/api/yandex-turbo/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion site/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"@fragments/root-layout-fragment": "workspace:*",
"@globals/config": "workspace:*",
"@globals/data": "workspace:*",
"@shared/api-routes": "workspace:*",
"@site/booking-api": "workspace:*",
"@site/contacts-page": "workspace:*",
"@site/index-page": "workspace:*",
"@site/service-page": "workspace:*",
"@site/services-page": "workspace:*",
"@site/yandex-turbo-api": "workspace:*",
"@types/node": "22.1.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
Expand Down
2 changes: 1 addition & 1 deletion site/app/src/app/api/yandex-turbo/[[...slug]]/route.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { yandexTurboApiHandle as GET } from '@site/yandex-turbo-api'
export { yandexTurboApiHandle as GET } from '@shared/api-routes'
11 changes: 8 additions & 3 deletions site/fragments/contacts-fragment/src/contacts.component.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { FC } from 'react'
'use client'

import type { ContactsProps } from './contacts.interface.js'
import type { FC } from 'react'

import { memo } from 'react'
import React from 'react'
import { memo } from 'react'

import { Condition } from '@ui/condition'
import { Box } from '@ui/layout'
import { Column } from '@ui/layout'
import { Row } from '@ui/layout'
Expand All @@ -17,6 +19,7 @@ import { MapComponent } from './map/index.js'
import { useContacts } from './hooks/index.js'

const Contacts: FC<ContactsProps> = memo((props) => {
const { isYandexTurbo } = props
const contactsInformationData = useContacts(props)
const { contactsTitle } = contactsInformationData

Expand All @@ -39,7 +42,9 @@ const Contacts: FC<ContactsProps> = memo((props) => {
justifyContent='space-between'
>
<ContactsInformation contactsData={contactsInformationData} />
<MapComponent />
<Condition match={!Boolean(isYandexTurbo)}>
<MapComponent />
</Condition>
</Row>
<Layout flexBasis={[24, 24, 0]} />
<Box width='100%' height={270} display={['flex', 'flex', 'none']}>
Expand Down
1 change: 1 addition & 0 deletions site/fragments/contacts-fragment/src/contacts.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ContactsDataType as GlobalContactsDataType } from '@globals/data'
import type { FragmentsDataType } from '@globals/data'

export interface ContactsProps {
isYandexTurbo?: boolean
contactsData: GlobalContactsDataType
fragmentsData: FragmentsDataType
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { FC } from 'react'

import type { SliderPartProps } from './slider-part.interface.js'
import type { FC } from 'react'

import React from 'react'

Expand All @@ -15,6 +14,7 @@ export const SliderPart: FC<SliderPartProps> = ({
priceTitle,
timeTitle,
setActiveIndex,
isYandexTurbo,
}) => {
return (
<Row justifyContent='center' alignItems='center' width='$fill' maxWidth={1440}>
Expand All @@ -33,6 +33,7 @@ export const SliderPart: FC<SliderPartProps> = ({
priceTitle={priceTitle}
timeTitle={timeTitle}
setActiveIndex={setActiveIndex}
isYandexTurbo={isYandexTurbo}
/>
</SwiperSlide>
))}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Swiper } from 'swiper'

import type { SlidesType } from '../works-examples.interface.js'
import type { Swiper } from 'swiper'

export interface SliderPartProps {
slides: Array<SlidesType>
setControlsSwiper: React.Dispatch<React.SetStateAction<Swiper | null>>
priceTitle: string
timeTitle: string
setActiveIndex: React.Dispatch<React.SetStateAction<number>>
isYandexTurbo?: boolean
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { FC } from 'react'

import type { WorksExamplesProps } from './works-examples.interface.js'
import type { FC } from 'react'

import { forwardRef } from 'react'
import React from 'react'
import { forwardRef } from 'react'

import { Box } from '@ui/layout'
import { Row } from '@ui/layout'
Expand All @@ -16,7 +15,7 @@ import { TitlePart } from './title-part/index.js'
import { useWorkExamplesFragment } from './hooks/index.js'

export const WorksExamples: FC<WorksExamplesProps> = forwardRef((
{ fragmentsData, workResultsData },
{ fragmentsData, workResultsData, isYandexTurbo },
ref: any
) => {
const {
Expand Down Expand Up @@ -49,6 +48,7 @@ export const WorksExamples: FC<WorksExamplesProps> = forwardRef((
priceTitle={priceTitle}
timeTitle={timeTitle}
setActiveIndex={setActiveIndex}
isYandexTurbo={isYandexTurbo}
/>

<PaginationPart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ export type SlidesType = {
export interface WorksExamplesProps {
fragmentsData: FragmentsDataType
workResultsData: WorkResultsDataType
isYandexTurbo?: boolean
}
7 changes: 3 additions & 4 deletions site/pages/contacts-page/src/contacts-page.client.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use client'

import type { FC } from 'react'

import type { ContactsPageClientProps } from './contacts-page.interfaces.js'
import type { FC } from 'react'

import React from 'react'

Expand All @@ -17,7 +16,7 @@ import { getAvailableRadiiData } from '@globals/data'
import { getCarBodiesData } from '@globals/data'
import { getServicesData } from '@globals/data'

export const ContactsPageClient: FC<ContactsPageClientProps> = () => {
export const ContactsPageClient: FC<ContactsPageClientProps> = ({ isYandexTurbo }) => {
const { fragments } = getFragmentsData()
const { contacts } = getContactsData()
const { navigation } = getNavigationData()
Expand All @@ -35,7 +34,7 @@ export const ContactsPageClient: FC<ContactsPageClientProps> = () => {
carBodiesData={carBodies}
servicesData={services}
/>
<Contacts fragmentsData={fragments} contactsData={contacts} />
<Contacts fragmentsData={fragments} contactsData={contacts} isYandexTurbo={isYandexTurbo} />
<Footer fragmentsData={fragments} contactsData={contacts} />
</Column>
)
Expand Down
7 changes: 5 additions & 2 deletions site/pages/contacts-page/src/contacts-page.component.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import type { ContactsPageProps } from './contacts-page.interfaces.js'
import type { FC } from 'react'

import React from 'react'

import { ContactsPageClient } from './contacts-page.client.js'
import { runContactsPageServerQueries } from './hooks/index.js'

const ContactsPage: ContactsPageProps = async () => {
const ContactsPage: FC<ContactsPageProps> = async ({ searchParams }) => {
const isYandexTurbo = Boolean(searchParams['yandex-turbo'])

await runContactsPageServerQueries()
// @ts-expect-error not assignable
return <ContactsPageClient />
return <ContactsPageClient isYandexTurbo={isYandexTurbo} />
}

export default ContactsPage
7 changes: 6 additions & 1 deletion site/pages/contacts-page/src/contacts-page.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ export interface ContactsPageClientProps {
ogCover: string
SEO: SEOInt
data: DataInt
isYandexTurbo?: boolean
}

export type ContactsPageProps = () => Promise<JSX.Element>
export interface ContactsPageProps {
searchParams: { [key: string]: string | string[] | undefined }
}

export type ContactsPageInt = () => Promise<JSX.Element>

export type ContactsPageServerProps = () => Promise<ContactsPageClientProps>
11 changes: 7 additions & 4 deletions site/pages/index-page/src/index-page.client.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
'use client'

import type { FC } from 'react'

import type { IndexPageClientProps } from './index-page.interfaces.js'
import type { FC } from 'react'

import React from 'react'
import { useRef } from 'react'
import { useState } from 'react'
import React from 'react'

import { Footer } from '@fragments/footer-fragment'
import { Navigation } from '@fragments/navigation-fragment'
Expand All @@ -20,7 +19,10 @@ import { Column } from '@ui/layout'

import { useIndexPageClient } from './hooks/index.js'

export const IndexPageClient: FC<IndexPageClientProps> = ({ servicesDataToReplace }) => {
export const IndexPageClient: FC<IndexPageClientProps> = ({
servicesDataToReplace,
isYandexTurbo,
}) => {
const headerRef = useRef<HTMLDivElement | null>(null)
const isLoaded = useRef<boolean>(false)

Expand Down Expand Up @@ -91,6 +93,7 @@ export const IndexPageClient: FC<IndexPageClientProps> = ({ servicesDataToReplac
<WorksExamples
workResultsData={workResults}
fragmentsData={fragments}
isYandexTurbo={isYandexTurbo}
{...getObserverOptions('works-examples')}
/>
<Footer fragmentsData={fragments} contactsData={contacts} />
Expand Down
Loading

0 comments on commit eb68a84

Please sign in to comment.