Merge pull request 'feat(web): show search prompt while no query is entered' (#24) from t3code/client-first-playback-caching into main

This commit was merged in pull request #24.
This commit is contained in:
joshuafhiggins committed 2026-10-08 16:18:38 -04:00
commit e7483135bc
3 files changed
+19 -8

No files matched your search

+8 -1
View File
@@ -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 (
<div className="flex h-svh flex-col">
<header className="flex items-center justify-center border-b px-4 py-3">
<Skeleton className="h-10 w-full max-w-xl rounded-full" />
</header>
<SearchResultsSkeleton />
{hasQuery ? <SearchResultsSkeleton /> : <SearchPrompt />}
</div>
)
}
+2 -7
View File
@@ -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 (
<div className="flex flex-1 items-center justify-center px-6 pb-28">
<p className="text-center text-muted-foreground">
Search for songs, albums, artists, and playlists in your library.
</p>
</div>
)
return <SearchPrompt />
}
if (!showResults) {
+9
View File
@@ -0,0 +1,9 @@
export function SearchPrompt() {
return (
<div className="flex flex-1 items-center justify-center px-6 pb-28">
<p className="text-center text-muted-foreground">
Search for songs, albums, artists, and playlists in your library.
</p>
</div>
)
}