diff --git a/bun.lockb b/bun.lockb index d558f09..4992cd4 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/src/routes/places/index.tsx b/src/routes/places/index.tsx index 0565be5..d78acbe 100644 --- a/src/routes/places/index.tsx +++ b/src/routes/places/index.tsx @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { FeaturedPlace, Place } from "@/types/places"; +import { Place } from "@/types/places"; import "mapbox-gl/dist/mapbox-gl.css"; import Map, { MapRef, PointLike, Source } from "react-map-gl"; import Layer from "react-map-gl/dist/esm/components/layer"; @@ -27,7 +27,7 @@ export async function loader({ request }: LoaderFunctionArgs) { const [responsePlaces, responseTopDestinations] = await Promise.all([ api(`places?search=${keyword ?? ""}`), - api<{ data: Array }>("/places/featured"), + api("/places/featured"), ]); return { @@ -38,7 +38,7 @@ export async function loader({ request }: LoaderFunctionArgs) { } export function PlacesIndexRoute() { - const { places, keyword } = useLoaderData() as Awaited< + const { places, keyword, topDestinations } = useLoaderData() as Awaited< ReturnType >; @@ -150,7 +150,11 @@ export function PlacesIndexRoute() { @@ -214,46 +218,60 @@ function PlacesSidebarHeader() { function PlaceDetailPlaceholder({ places, keyword, + topDestinations, }: { places: Place[]; keyword: string; + topDestinations: Place[]; }) { + const placeList = keyword !== "" ? places : topDestinations; + return (
-

Show result of "{keyword}"

+

+ {keyword !== "" ? `Show result of "${keyword}"` : "Top destinations:"} +

- {places.map((place, index) => ( + {placeList.map((place, index) => (
- {place.title} + + {place.title} +
-

{place.title}

+ + {place.title} +
{place.categories.map((category, index) => ( -

{category.name}

-
+ ))}
-

+

{place.description}

-

+

{place.address}