fix marketplace error
This commit is contained in:
@@ -55,6 +55,8 @@ export default function ExploreSearchForm({
|
|||||||
dict: ExploreSearchFormDict
|
dict: ExploreSearchFormDict
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const cityOptions = Array.isArray(cities) ? cities : []
|
||||||
|
const ageOptions = Array.isArray(dict.ageOptions) ? dict.ageOptions : []
|
||||||
const [filters, setFilters] = useState({
|
const [filters, setFilters] = useState({
|
||||||
pickupLocation,
|
pickupLocation,
|
||||||
dropoffLocation,
|
dropoffLocation,
|
||||||
@@ -114,7 +116,7 @@ export default function ExploreSearchForm({
|
|||||||
className={selectClassName()}
|
className={selectClassName()}
|
||||||
>
|
>
|
||||||
<option value="">{dict.pickupLocation}</option>
|
<option value="">{dict.pickupLocation}</option>
|
||||||
{cities.map((city) => (
|
{cityOptions.map((city) => (
|
||||||
<option key={`pickup-${city}`} value={city}>{city}</option>
|
<option key={`pickup-${city}`} value={city}>{city}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
@@ -128,7 +130,7 @@ export default function ExploreSearchForm({
|
|||||||
className={selectClassName()}
|
className={selectClassName()}
|
||||||
>
|
>
|
||||||
<option value="">{dict.dropoffLocation}</option>
|
<option value="">{dict.dropoffLocation}</option>
|
||||||
{cities.map((city) => (
|
{cityOptions.map((city) => (
|
||||||
<option key={`dropoff-${city}`} value={city}>{city}</option>
|
<option key={`dropoff-${city}`} value={city}>{city}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
@@ -212,7 +214,7 @@ export default function ExploreSearchForm({
|
|||||||
onChange={(event) => updateFilter('driverAge', event.target.value)}
|
onChange={(event) => updateFilter('driverAge', event.target.value)}
|
||||||
className="border-0 bg-transparent text-sm font-semibold text-stone-900 outline-none"
|
className="border-0 bg-transparent text-sm font-semibold text-stone-900 outline-none"
|
||||||
>
|
>
|
||||||
{dict.ageOptions.map((option) => (
|
{ageOptions.map((option) => (
|
||||||
<option key={option} value={option}>{option}</option>
|
<option key={option} value={option}>{option}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec
|
|||||||
hour: 'Hour',
|
hour: 'Hour',
|
||||||
promoCode: 'I have a promo code',
|
promoCode: 'I have a promo code',
|
||||||
myAge: 'My age',
|
myAge: 'My age',
|
||||||
|
ageDescription: 'Driver age can affect availability, deposit amount, and final pricing.',
|
||||||
ageOptions: ['18+', '21+', '23+', '25+', '30+'],
|
ageOptions: ['18+', '21+', '23+', '25+', '30+'],
|
||||||
search: 'Search',
|
search: 'Search',
|
||||||
currentDeals: 'Current deals',
|
currentDeals: 'Current deals',
|
||||||
@@ -120,6 +121,7 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec
|
|||||||
hour: 'Heure',
|
hour: 'Heure',
|
||||||
promoCode: "J'ai un code promo",
|
promoCode: "J'ai un code promo",
|
||||||
myAge: 'Mon âge',
|
myAge: 'Mon âge',
|
||||||
|
ageDescription: "L'âge du conducteur peut influencer la disponibilité, le dépôt de garantie et le prix final.",
|
||||||
ageOptions: ['18+', '21+', '23+', '25+', '30+'],
|
ageOptions: ['18+', '21+', '23+', '25+', '30+'],
|
||||||
search: 'Rechercher',
|
search: 'Rechercher',
|
||||||
currentDeals: 'Offres du moment',
|
currentDeals: 'Offres du moment',
|
||||||
@@ -162,6 +164,7 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec
|
|||||||
hour: 'الساعة',
|
hour: 'الساعة',
|
||||||
promoCode: 'لدي رمز ترويجي',
|
promoCode: 'لدي رمز ترويجي',
|
||||||
myAge: 'عمري',
|
myAge: 'عمري',
|
||||||
|
ageDescription: 'قد يؤثر عمر السائق على التوفر ومبلغ التأمين والسعر النهائي.',
|
||||||
ageOptions: ['18+', '21+', '23+', '25+', '30+'],
|
ageOptions: ['18+', '21+', '23+', '25+', '30+'],
|
||||||
search: 'بحث',
|
search: 'بحث',
|
||||||
currentDeals: 'العروض الحالية',
|
currentDeals: 'العروض الحالية',
|
||||||
@@ -225,6 +228,13 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec
|
|||||||
marketplaceFetchOrDefault<Vehicle[]>(`/marketplace/search?${query.toString()}`, []),
|
marketplaceFetchOrDefault<Vehicle[]>(`/marketplace/search?${query.toString()}`, []),
|
||||||
marketplaceFetchOrDefault<CompanyCard[]>('/marketplace/companies?pageSize=8', []),
|
marketplaceFetchOrDefault<CompanyCard[]>('/marketplace/companies?pageSize=8', []),
|
||||||
])
|
])
|
||||||
|
const cities = Array.from(
|
||||||
|
new Set(
|
||||||
|
companies
|
||||||
|
.map((company) => company.brand?.publicCity?.trim())
|
||||||
|
.filter((city): city is string => Boolean(city))
|
||||||
|
)
|
||||||
|
).sort((left, right) => left.localeCompare(right))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="min-h-screen bg-stone-50 py-10">
|
<main className="min-h-screen bg-stone-50 py-10">
|
||||||
@@ -242,6 +252,7 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec
|
|||||||
returnTime={returnTime}
|
returnTime={returnTime}
|
||||||
promoCode={promoCode}
|
promoCode={promoCode}
|
||||||
driverAge={driverAge}
|
driverAge={driverAge}
|
||||||
|
cities={cities}
|
||||||
dict={dict}
|
dict={dict}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user