fix: use window.location for logo and canvas navigation
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-01-26 21:46:31 +08:00
parent 50c3d7a182
commit acc28658d4

View File

@ -125,7 +125,14 @@ export function TopNavbar({
return (
<nav className="fixed top-0 left-0 right-0 z-[100] flex h-12 items-center justify-between bg-black/90 backdrop-blur-sm px-4 text-white border-b border-white/10 shadow-sm">
{/* 左侧:LOGO + 网站名称 */}
<Link href="/" className="flex items-center gap-2 transition-opacity hover:opacity-80">
<a
href="/"
className="flex items-center gap-2 transition-opacity hover:opacity-80"
onClick={(e) => {
e.preventDefault();
window.location.href = "/";
}}
>
{displayLogo && (
<img
src={displayLogo}
@ -134,7 +141,7 @@ export function TopNavbar({
/>
)}
<span className="text-sm font-semibold">{siteName}</span>
</Link>
</a>
{/* 右侧区域:自定义链接 + 系统设置 */}
<div className="flex items-center gap-2">
@ -260,8 +267,7 @@ export function TopNavbar({
className="flex items-center gap-1 h-8 px-3 text-white hover:bg-white/15 hover:text-white rounded-full transition-colors text-sm font-medium"
onClick={() => {
const newId = crypto.randomUUID();
router.push(`/canvas/${newId}`);
router.refresh();
window.location.href = `/canvas/${newId}`;
}}
type="button"
title="无限画布"