diff --git a/apps/web/app/(app)/search/loading.tsx b/apps/web/app/(app)/search/loading.tsx index 143c211..7c5e0f5 100644 --- a/apps/web/app/(app)/search/loading.tsx +++ b/apps/web/app/(app)/search/loading.tsx @@ -1,13 +1,20 @@ +"use client" + +import { useSearchParams } from "next/navigation" + import { SearchResultsSkeleton } from "@/components/library-skeletons" +import { SearchPrompt } from "@/components/search-prompt" import { Skeleton } from "@/components/ui/skeleton" export default function Loading() { + const hasQuery = Boolean(useSearchParams().get("q")?.trim()) + return (
- + {hasQuery ? : }
) } diff --git a/apps/web/app/(app)/search/page.tsx b/apps/web/app/(app)/search/page.tsx index 2906365..b683a32 100644 --- a/apps/web/app/(app)/search/page.tsx +++ b/apps/web/app/(app)/search/page.tsx @@ -6,6 +6,7 @@ import { usePathname, useSearchParams } from "next/navigation" import { ContentCarousel } from "@/components/content-carousel" import { SearchResultsSkeleton } from "@/components/library-skeletons" +import { SearchPrompt } from "@/components/search-prompt" import { SearchSongItem } from "@/components/search-song-item" import { SearchTopResultCard, type TopResult } from "@/components/search-top-result-card" import { useCachedQuery } from "@/hooks/use-cached-query" @@ -55,13 +56,7 @@ function SearchResults({ query }: { query: string }) { } if (!hasQuery) { - return ( -
-

- Search for songs, albums, artists, and playlists in your library. -

-
- ) + return } if (!showResults) { diff --git a/apps/web/components/search-prompt.tsx b/apps/web/components/search-prompt.tsx new file mode 100644 index 0000000..3f32ed3 --- /dev/null +++ b/apps/web/components/search-prompt.tsx @@ -0,0 +1,9 @@ +export function SearchPrompt() { + return ( +
+

+ Search for songs, albums, artists, and playlists in your library. +

+
+ ) +}