diff --git a/components/sidebar-history-item.tsx b/components/sidebar-history-item.tsx index d5f0f9e..1e93c5a 100644 --- a/components/sidebar-history-item.tsx +++ b/components/sidebar-history-item.tsx @@ -1,7 +1,5 @@ "use client"; -import Link from "next/link"; -import { useRouter } from "next/navigation"; import { memo } from "react"; import { useChatVisibility } from "@/hooks/use-chat-visibility"; import type { Chat } from "@/lib/db/schema"; @@ -40,24 +38,26 @@ const PureChatItem = ({ onDelete: (chatId: string) => void; setOpenMobile: (open: boolean) => void; }) => { - const router = useRouter(); const { visibilityType, setVisibilityType } = useChatVisibility({ chatId: chat.id, initialVisibilityType: chat.visibility, }); + const handleNavigation = (e: React.MouseEvent) => { + e.preventDefault(); + setOpenMobile(false); + window.location.href = `/chat/${chat.id}`; + }; + return ( - { - setOpenMobile(false); - router.refresh(); - }} + {chat.title} - + diff --git a/components/top-navbar.tsx b/components/top-navbar.tsx index e9f7142..537dfab 100644 --- a/components/top-navbar.tsx +++ b/components/top-navbar.tsx @@ -174,15 +174,18 @@ export function TopNavbar({ )} {/* AI智能精选 */} - router.refresh()} + onClick={(e) => { + e.preventDefault(); + window.location.href = "/featured"; + }} > AI精选 - + {/* 精选榜单 */} @@ -268,15 +271,18 @@ export function TopNavbar({ {/* 我的图册 */} - router.refresh()} + onClick={(e) => { + e.preventDefault(); + window.location.href = "/gallery"; + }} > 我的图册 - + {/* 分隔线 (如果有链接或图册按钮,且是管理员) */} {isAdmin && ( @@ -285,14 +291,17 @@ export function TopNavbar({ {/* 系统设置(仅管理员可见)*/} {isAdmin && ( - router.refresh()} + onClick={(e) => { + e.preventDefault(); + window.location.href = "/settings"; + }} > - + )}