diff --git a/globals/data/src/getters/aqsi-data-getter/aqsi-data.getter.ts b/globals/data/src/getters/aqsi-data-getter/aqsi-data.getter.ts index 49df8202..f08195f0 100644 --- a/globals/data/src/getters/aqsi-data-getter/aqsi-data.getter.ts +++ b/globals/data/src/getters/aqsi-data-getter/aqsi-data.getter.ts @@ -1,12 +1,12 @@ -import type { AqsiDataType } from '../../interfaces/index.js' +import type { ServicesDataToReplaceType } from '../../interfaces/index.js' -import { REQUEST_URL } from './aqsi-data.constants.js' -import { NullResponseError } from './error/null-response.error.js' -import { fetchAqsiDataHelper } from './fetch-data/index.js' -import { formatOutputDataHelper } from './format-output-data-helper/index.js' -import { formatPagesDataHelper } from './format-pages-data-helper/index.js' +import { REQUEST_URL } from './aqsi-data.constants.js' +import { NullResponseError } from './error/null-response.error.js' +import { fetchAqsiDataHelper } from './fetch-data/index.js' +import { formatOutputDataHelper } from './format-output-data-helper/index.js' +import { formatPagesDataHelper } from './format-pages-data-helper/index.js' -export const getAqsiData = async (): Promise => { +export const getAqsiData = async (): Promise => { try { const godsListResponse = await fetchAqsiDataHelper(REQUEST_URL) const godsListData = await godsListResponse.json() diff --git a/globals/data/src/getters/aqsi-data-getter/format-output-data-helper/format-output-data.helper.ts b/globals/data/src/getters/aqsi-data-getter/format-output-data-helper/format-output-data.helper.ts index 23740191..4b0e14f8 100644 --- a/globals/data/src/getters/aqsi-data-getter/format-output-data-helper/format-output-data.helper.ts +++ b/globals/data/src/getters/aqsi-data-getter/format-output-data-helper/format-output-data.helper.ts @@ -1,15 +1,17 @@ /* eslint-disable no-continue */ -import type { AqsiDataType } from '../../../interfaces/aqsi-data.interface.js' -import type { FormattedPagesDataType } from '../../../interfaces/index.js' +import type { ServicesDataToReplaceType } from '../../../interfaces/aqsi-data.interface.js' +import type { FormattedPagesDataType } from '../../../interfaces/index.js' -import { DataVariants } from './helpers/get-data-variant.constants.js' -import { serviceTitles } from './format-output-data.constants.js' -import { carBodyTitles } from './format-output-data.constants.js' -import { radiiTitles } from './format-output-data.constants.js' -import { getDataVariantHelper } from './helpers/get-data-variant.helper.js' +import { DataVariants } from './helpers/get-data-variant.constants.js' +import { serviceTitles } from './format-output-data.constants.js' +import { carBodyTitles } from './format-output-data.constants.js' +import { radiiTitles } from './format-output-data.constants.js' +import { getDataVariantHelper } from './helpers/get-data-variant.helper.js' -export const formatOutputDataHelper = (aqsiData: FormattedPagesDataType): AqsiDataType => { +export const formatOutputDataHelper = ( + aqsiData: FormattedPagesDataType +): ServicesDataToReplaceType => { const output = [] for (const aqsiDataItem of aqsiData) { diff --git a/globals/data/src/helpers/replace-service-price.helper.ts b/globals/data/src/helpers/replace-service-price.helper.ts index 649baba0..094e60fe 100644 --- a/globals/data/src/helpers/replace-service-price.helper.ts +++ b/globals/data/src/helpers/replace-service-price.helper.ts @@ -1,14 +1,14 @@ /* eslint-disable no-continue */ -import type { AqsiDataType } from '@globals/data' +import type { ServicesDataToReplaceType } from '@globals/data' import type { RequiredReplaceServicePriceHelperType } from './replace-service-price.interface.js' export const replaceServicePriceHelper = ( service: RequiredReplaceServicePriceHelperType & T, - aqsiSwervicesData: AqsiDataType + servicesDataToReplace: ServicesDataToReplaceType ): T => { - if (!aqsiSwervicesData.length) return service + if (!servicesDataToReplace.length) return service if (!service) return service if (!(typeof service === 'object')) return service @@ -38,7 +38,7 @@ export const replaceServicePriceHelper = ( if (!outputPriceData[radiiKey]) outputPriceData[radiiKey] = {} - const findedAqsiServiceData = aqsiSwervicesData.find((aqsiServiceData) => { + const findedAqsiServiceData = servicesDataToReplace.find((aqsiServiceData) => { const { service: aqsiServiceTitle, radii: aqsiRadiiTitle, diff --git a/globals/data/src/helpers/replace-service-prices.helper.ts b/globals/data/src/helpers/replace-service-prices.helper.ts index d78ed816..cc8a8bc3 100644 --- a/globals/data/src/helpers/replace-service-prices.helper.ts +++ b/globals/data/src/helpers/replace-service-prices.helper.ts @@ -1,13 +1,13 @@ -import type { AqsiDataType } from '@globals/data' -import type { ServicesDataType } from '@globals/data' +import type { ServicesDataToReplaceType } from '@globals/data' +import type { ServicesDataType } from '@globals/data' -import { replaceServicePriceHelper } from '@globals/data' +import { replaceServicePriceHelper } from '@globals/data' export const replaceServicePricesHelper = ( wpServicesData: ServicesDataType, - aqsiSwervicesData: AqsiDataType + servicesDataToReplace: ServicesDataToReplaceType ): ServicesDataType => { - if (!aqsiSwervicesData.length) return wpServicesData + if (!servicesDataToReplace.length) return wpServicesData const replacedServicePrices = [] @@ -18,7 +18,7 @@ export const replaceServicePricesHelper = ( // eslint-disable-next-line no-continue if (!service?.servicesParams) continue - const outputServiceData = replaceServicePriceHelper(service, aqsiSwervicesData) + const outputServiceData = replaceServicePriceHelper(service, servicesDataToReplace) replacedServicePrices.push(outputServiceData) } diff --git a/globals/data/src/interfaces/aqsi-data.interface.ts b/globals/data/src/interfaces/aqsi-data.interface.ts index 9e8a2ef6..d345a2ad 100644 --- a/globals/data/src/interfaces/aqsi-data.interface.ts +++ b/globals/data/src/interfaces/aqsi-data.interface.ts @@ -1,4 +1,4 @@ -export type AqsiDataType = Array<{ +export type ServicesDataToReplaceType = Array<{ service: string carBody: string radii: string diff --git a/site/pages/index-page/src/hooks/run-index-page-server-queries.hook.ts b/site/pages/index-page/src/hooks/run-index-page-server-queries.hook.ts index 1d535d85..910b11db 100644 --- a/site/pages/index-page/src/hooks/run-index-page-server-queries.hook.ts +++ b/site/pages/index-page/src/hooks/run-index-page-server-queries.hook.ts @@ -28,5 +28,5 @@ export const runIndexPageServerQueries = async () => { ]) const aqsiServicesData = await getAqsiData() - return { aqsiServicesData } + return { servicesDataToReplace: aqsiServicesData } } diff --git a/site/pages/index-page/src/index-page.client.tsx b/site/pages/index-page/src/index-page.client.tsx index 1c07a8f0..16ef7c28 100644 --- a/site/pages/index-page/src/index-page.client.tsx +++ b/site/pages/index-page/src/index-page.client.tsx @@ -30,7 +30,7 @@ import { getCarBodiesData } from '@globals/data' import { useIndexPageClient } from './hooks/index.js' -export const IndexPageClient: FC = ({ aqsiServicesData }) => { +export const IndexPageClient: FC = ({ servicesDataToReplace }) => { const { navigation } = getNavigationData() const { fragments } = getFragmentsData() const { contacts } = getContactsData() @@ -41,7 +41,7 @@ export const IndexPageClient: FC = ({ aqsiServicesData }) const { workResults } = getWorkResultsData() const { carBodies } = getCarBodiesData() - const services = replaceServicePricesHelper(baseServices, aqsiServicesData) + const services = replaceServicePricesHelper(baseServices, servicesDataToReplace) const headerRef = useRef(null) const isLoaded = useRef(false) diff --git a/site/pages/index-page/src/index-page.component.tsx b/site/pages/index-page/src/index-page.component.tsx index c4442d67..20741f81 100644 --- a/site/pages/index-page/src/index-page.component.tsx +++ b/site/pages/index-page/src/index-page.component.tsx @@ -7,9 +7,9 @@ import { IndexPageClient } from './index-page.client.js' import { runIndexPageServerQueries } from './hooks/run-index-page-server-queries.hook.js' const IndexPage: FC = async () => { - const { aqsiServicesData } = await runIndexPageServerQueries() + const { servicesDataToReplace } = await runIndexPageServerQueries() // @ts-expect-error not assignable - return + return } export default memo(IndexPage) diff --git a/site/pages/index-page/src/index-page.interfaces.ts b/site/pages/index-page/src/index-page.interfaces.ts index 452b0793..7f6431a3 100644 --- a/site/pages/index-page/src/index-page.interfaces.ts +++ b/site/pages/index-page/src/index-page.interfaces.ts @@ -1,6 +1,6 @@ -import type { SEOInt } from '@globals/data' -import type { DataInt } from '@globals/data' -import type { AqsiDataType } from '@globals/data' +import type { SEOInt } from '@globals/data' +import type { DataInt } from '@globals/data' +import type { ServicesDataToReplaceType } from '@globals/data' export interface SeoProps { ogCover: string @@ -8,7 +8,7 @@ export interface SeoProps { } export interface IndexPageClientProps { - aqsiServicesData: AqsiDataType + servicesDataToReplace: ServicesDataToReplaceType ogCover: string SEO: SEOInt data: DataInt diff --git a/site/pages/service-page/src/hooks/run-service-page-server-queries.hook.ts b/site/pages/service-page/src/hooks/run-service-page-server-queries.hook.ts index 5f3a052e..4375115c 100644 --- a/site/pages/service-page/src/hooks/run-service-page-server-queries.hook.ts +++ b/site/pages/service-page/src/hooks/run-service-page-server-queries.hook.ts @@ -28,5 +28,5 @@ export const runServicePageServerQueries: ServicePageServerProps = async ({ para ]) const aqsiServicesData = await getAqsiData() - return { aqsiServicesData } + return { servicesDataToReplace: aqsiServicesData } } diff --git a/site/pages/service-page/src/service-page.client.tsx b/site/pages/service-page/src/service-page.client.tsx index e14e7c15..16b64765 100644 --- a/site/pages/service-page/src/service-page.client.tsx +++ b/site/pages/service-page/src/service-page.client.tsx @@ -1,5 +1,3 @@ -/* eslint-disable */ - 'use client' import type { FC } from 'react' @@ -24,8 +22,10 @@ import { getBlogPostsData } from '@globals/data' import { replaceServicePricesHelper } from '@globals/data' import { replaceServicePriceHelper } from '@globals/data' -// @ts-expect-error param is not exist -export const ServicePageClient: FC = ({ params, aqsiServicesData }) => { +export const ServicePageClient: FC = ({ + params, + servicesDataToReplace, +}) => { const { uri } = params const { navigation } = getNavigationData() @@ -37,8 +37,8 @@ export const ServicePageClient: FC = ({ params, aqsiServ const { posts } = getBlogPostsData() const { contacts } = getContactsData() - const services = replaceServicePricesHelper(baseServices, aqsiServicesData) - const serviceBy = replaceServicePriceHelper(baseServiceBy, aqsiServicesData) + const services = replaceServicePricesHelper(baseServices, servicesDataToReplace) + const serviceBy = replaceServicePriceHelper(baseServiceBy, servicesDataToReplace) return ( diff --git a/site/pages/service-page/src/service-page.component.tsx b/site/pages/service-page/src/service-page.component.tsx index 07ae228c..33f2e9e9 100644 --- a/site/pages/service-page/src/service-page.component.tsx +++ b/site/pages/service-page/src/service-page.component.tsx @@ -11,7 +11,7 @@ import { ServicePageClient } from './service-page.client.js' import { runServicePageServerQueries } from './hooks/index.js' const ServicePage: ServicePageProps = async ({ params }) => { - const { aqsiServicesData } = await runServicePageServerQueries({ params }) + const { servicesDataToReplace } = await runServicePageServerQueries({ params }) const { uri } = params return ( { uri, }} > - + ) } diff --git a/site/pages/service-page/src/service-page.interfaces.ts b/site/pages/service-page/src/service-page.interfaces.ts index eb23598c..9d75d374 100644 --- a/site/pages/service-page/src/service-page.interfaces.ts +++ b/site/pages/service-page/src/service-page.interfaces.ts @@ -1,18 +1,14 @@ -import type { SEOInt } from '@globals/data' -import type { DataInt } from '@globals/data' -import type { AqsiDataType } from '@globals/data' - -export interface ServicePageClientProps { - aqsiServicesData: AqsiDataType - SEO: SEOInt - ogCover: string - data: DataInt -} +import type { ServicesDataToReplaceType } from '@globals/data' type ParamsType = { uri: string } +export interface ServicePageClientProps { + params: ParamsType + servicesDataToReplace: ServicesDataToReplaceType +} + export type ServicePageProps = ({ params }: { params: ParamsType }) => Promise export type ServicePageServerProps = ({ @@ -20,8 +16,3 @@ export type ServicePageServerProps = ({ }: { params: ParamsType }) => Promise - -export interface SeoProps { - ogCover: string - SEO: SEOInt -} diff --git a/site/pages/services-page/src/hooks/run-services-page-server-queries.hook.ts b/site/pages/services-page/src/hooks/run-services-page-server-queries.hook.ts index 8825b29f..ae7731a8 100644 --- a/site/pages/services-page/src/hooks/run-services-page-server-queries.hook.ts +++ b/site/pages/services-page/src/hooks/run-services-page-server-queries.hook.ts @@ -25,5 +25,5 @@ export const runServicesPageServerQueries: ServicesPageServerProps = async () => ]) const aqsiServicesData = await getAqsiData() - return { aqsiServicesData } + return { servicesDataToReplace: aqsiServicesData } } diff --git a/site/pages/services-page/src/services-page.client.tsx b/site/pages/services-page/src/services-page.client.tsx index c86faa66..a4754ede 100644 --- a/site/pages/services-page/src/services-page.client.tsx +++ b/site/pages/services-page/src/services-page.client.tsx @@ -18,7 +18,7 @@ import { getNavigationData } from '@globals/data' import { getServicesData } from '@globals/data' import { replaceServicePricesHelper } from '@globals/data' -export const ServicesPageClient: FC = ({ aqsiServicesData }) => { +export const ServicesPageClient: FC = ({ servicesDataToReplace }) => { const { fragments } = getFragmentsData() const { contacts } = getContactsData() const { navigation } = getNavigationData() @@ -26,7 +26,7 @@ export const ServicesPageClient: FC = ({ aqsiServicesDa const { services: baseServices } = getServicesData() const { carBodies } = getCarBodiesData() - const services = replaceServicePricesHelper(baseServices, aqsiServicesData) + const services = replaceServicePricesHelper(baseServices, servicesDataToReplace) return ( diff --git a/site/pages/services-page/src/services-page.component.tsx b/site/pages/services-page/src/services-page.component.tsx index 72f6ad87..5fac3d76 100644 --- a/site/pages/services-page/src/services-page.component.tsx +++ b/site/pages/services-page/src/services-page.component.tsx @@ -6,9 +6,9 @@ import { ServicesPageClient } from './services-page.client.js' import { runServicesPageServerQueries } from './hooks/index.js' const ServicesPage: ServicesPageProps = async () => { - const { aqsiServicesData } = await runServicesPageServerQueries() + const { servicesDataToReplace } = await runServicesPageServerQueries() // @ts-expect-error incorrect types - return + return } export default ServicesPage diff --git a/site/pages/services-page/src/services-page.interface.ts b/site/pages/services-page/src/services-page.interface.ts index 4092ec0a..9686202f 100644 --- a/site/pages/services-page/src/services-page.interface.ts +++ b/site/pages/services-page/src/services-page.interface.ts @@ -1,10 +1,10 @@ -import type { AqsiDataType } from '@globals/data' +import type { ServicesDataToReplaceType } from '@globals/data' export type ServicesPageProps = () => Promise export interface ServicesPageClientProps { serverQueryData: SeoProps - aqsiServicesData: AqsiDataType + servicesDataToReplace: ServicesDataToReplaceType } export type ServicesPageServerProps = () => Promise