diff --git a/apps/marketplace/src/app/explore/ExploreSearchForm.tsx b/apps/marketplace/src/app/explore/ExploreSearchForm.tsx index cd0568f..4755d7f 100644 --- a/apps/marketplace/src/app/explore/ExploreSearchForm.tsx +++ b/apps/marketplace/src/app/explore/ExploreSearchForm.tsx @@ -55,6 +55,8 @@ export default function ExploreSearchForm({ dict: ExploreSearchFormDict }) { const router = useRouter() + const cityOptions = Array.isArray(cities) ? cities : [] + const ageOptions = Array.isArray(dict.ageOptions) ? dict.ageOptions : [] const [filters, setFilters] = useState({ pickupLocation, dropoffLocation, @@ -114,7 +116,7 @@ export default function ExploreSearchForm({ className={selectClassName()} > - {cities.map((city) => ( + {cityOptions.map((city) => ( ))} @@ -128,7 +130,7 @@ export default function ExploreSearchForm({ className={selectClassName()} > - {cities.map((city) => ( + {cityOptions.map((city) => ( ))} @@ -212,7 +214,7 @@ export default function ExploreSearchForm({ onChange={(event) => updateFilter('driverAge', event.target.value)} className="border-0 bg-transparent text-sm font-semibold text-stone-900 outline-none" > - {dict.ageOptions.map((option) => ( + {ageOptions.map((option) => ( ))} diff --git a/apps/marketplace/src/app/explore/page.tsx b/apps/marketplace/src/app/explore/page.tsx index 13ec4f6..2ebcbb2 100644 --- a/apps/marketplace/src/app/explore/page.tsx +++ b/apps/marketplace/src/app/explore/page.tsx @@ -78,6 +78,7 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec hour: 'Hour', promoCode: 'I have a promo code', myAge: 'My age', + ageDescription: 'Driver age can affect availability, deposit amount, and final pricing.', ageOptions: ['18+', '21+', '23+', '25+', '30+'], search: 'Search', currentDeals: 'Current deals', @@ -120,6 +121,7 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec hour: 'Heure', promoCode: "J'ai un code promo", 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+'], search: 'Rechercher', currentDeals: 'Offres du moment', @@ -162,6 +164,7 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec hour: 'الساعة', promoCode: 'لدي رمز ترويجي', myAge: 'عمري', + ageDescription: 'قد يؤثر عمر السائق على التوفر ومبلغ التأمين والسعر النهائي.', ageOptions: ['18+', '21+', '23+', '25+', '30+'], search: 'بحث', currentDeals: 'العروض الحالية', @@ -225,6 +228,13 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec marketplaceFetchOrDefault(`/marketplace/search?${query.toString()}`, []), marketplaceFetchOrDefault('/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 (
@@ -242,6 +252,7 @@ export default async function ExplorePage({ searchParams }: { searchParams?: Rec returnTime={returnTime} promoCode={promoCode} driverAge={driverAge} + cities={cities} dict={dict} />