diff --git a/frontend/app/(urls)/search/[category]/[route]/page.tsx b/frontend/app/(urls)/search/[category]/[route]/page.tsx index 7bb532e..dede80c 100644 --- a/frontend/app/(urls)/search/[category]/[route]/page.tsx +++ b/frontend/app/(urls)/search/[category]/[route]/page.tsx @@ -1,14 +1,7 @@ import React, { Suspense } from 'react' import type { Metadata } from 'next' import SearchCard from '../../components/SearchCard' -import { SearchCardProps } from '@/app/types' - -interface SearchPageProps { - params: { - category: string - route: string - } -} +import { SearchCardProps, RouteSearchPageProps } from '@/app/types' async function fetchSearch(category: string, from: string, to: string) { const response = await fetch( @@ -32,17 +25,17 @@ async function fetchSearch(category: string, from: string, to: string) { export async function generateMetadata({ params, }: { - params: SearchPageProps['params'] + params: RouteSearchPageProps['params'] }): Promise { - const [fromCity, toCity] = params.route.split('-') + const [fromCity, toCity] = (await params).route.split('-') return { - title: `Поиск ${params.category === 'mover' ? 'перевозчика' : 'посылки'} ${fromCity} → ${toCity} | Tripwb`, - description: `Найдите ${params.category === 'mover' ? 'перевозчика' : 'посылку'} по маршруту ${fromCity} → ${toCity} | Tripwb`, + title: `Поиск ${(await params).category === 'mover' ? 'перевозчика' : 'посылки'} ${fromCity} → ${toCity} | Tripwb`, + description: `Найдите ${(await params).category === 'mover' ? 'перевозчика' : 'посылку'} по маршруту ${fromCity} → ${toCity} | Tripwb`, openGraph: { - title: `Поиск ${params.category === 'mover' ? 'перевозчика' : 'посылки'} ${fromCity} → ${toCity} | Tripwb`, - description: `Найдите ${params.category === 'mover' ? 'перевозчика' : 'посылку'} по маршруту ${fromCity} → ${toCity}`, - url: `https://tripwb.com/search/${params.category}/${params.route}`, + title: `Поиск ${(await params).category === 'mover' ? 'перевозчика' : 'посылки'} ${fromCity} → ${toCity} | Tripwb`, + description: `Найдите ${(await params).category === 'mover' ? 'перевозчика' : 'посылку'} по маршруту ${fromCity} → ${toCity}`, + url: `https://tripwb.com/search/${(await params).category}/${(await params).route}`, siteName: 'TripWB', images: [ { @@ -56,7 +49,7 @@ export async function generateMetadata({ type: 'website', }, alternates: { - canonical: `https://tripwb.com/search/${params.category}/${params.route}`, + canonical: `https://tripwb.com/search/${(await params).category}/${(await params).route}`, }, robots: { index: true, @@ -65,7 +58,7 @@ export async function generateMetadata({ } } -export default async function SearchPage(props: SearchPageProps) { +export default async function SearchPage(props: RouteSearchPageProps) { const params = await props.params const { category, route } = params const [fromCity, toCity] = route.split('-') @@ -75,13 +68,10 @@ export default async function SearchPage(props: SearchPageProps) { return (

- {category === 'mover' ? 'Поиск перевозчика' : 'Поиск посылки'} + {category === 'mover' + ? `Поиск перевозчика по маршруту : ${fromCity} → ${toCity}` + : `Поиск посылки по маршруту : ${fromCity} → ${toCity}`}

-
-

- Маршрут: {fromCity} → {toCity} -

-
Загрузка результатов...
}>
diff --git a/frontend/app/types/index.ts b/frontend/app/types/index.ts index 4133297..04a543f 100644 --- a/frontend/app/types/index.ts +++ b/frontend/app/types/index.ts @@ -260,3 +260,10 @@ export interface LeadPageProps extends Lead { owner_name: string owner_email: string } + +export interface RouteSearchPageProps { + params: Promise<{ + category: string + route: string + }> +}