refactor(header): move search entrypoint to Discover only

This commit is contained in:
zetaloop
2026-02-25 02:56:08 +08:00
parent 360ac9b5be
commit 6cbe07d489
-25
View File
@@ -6,7 +6,6 @@ import {
LogOut,
Menu,
MessageSquare,
Search,
Settings,
ShoppingBag,
User,
@@ -27,7 +26,6 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Input } from "@/components/ui/input"
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
import type { UserRole } from "@/lib/types"
import { cn } from "@/lib/utils"
@@ -54,7 +52,6 @@ export function Header() {
currentRole === "consumer"
? [
{ href: "/", label: "发现" },
{ href: "/search", label: "找陪玩" },
{ href: "/community", label: "社区" },
{ href: "/chat", label: "消息" },
]
@@ -80,13 +77,6 @@ export function Header() {
(state) => state.notifications.filter((notification) => !notification.read).length,
)
const handleSearch = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault()
const formData = new FormData(e.currentTarget)
const q = formData.get("q") as string
if (q.trim()) router.push(`/search?q=${encodeURIComponent(q.trim())}`)
}
const profileHref =
currentRole === "player"
? user
@@ -126,14 +116,6 @@ export function Header() {
))}
</nav>
</div>
<form onSubmit={handleSearch} className="hidden md:flex w-full md:w-64 lg:w-96">
<div className="relative w-full">
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
<Input name="q" placeholder="搜索打手、店铺..." className="pl-8 h-9" />
</div>
</form>
<div className="flex items-center justify-end gap-1">
{isAuthenticated ? (
<>
@@ -254,13 +236,6 @@ export function Header() {
</SheetTitle>
</SheetHeader>
<div className="mt-4 space-y-4">
<form onSubmit={handleSearch}>
<div className="relative">
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
<Input name="q" placeholder="搜索打手、店铺..." className="pl-8" />
</div>
</form>
{isAuthenticated && (
<div className="flex items-center gap-2 px-1">
<Avatar className="h-8 w-8">