diff --git a/README.md b/README.md
index 86e6053..f9425a4 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Monorepo:
## 界面预览
-首页:毛玻璃搜索框、分类锚点栏与公开导航网格;登录后多出私有分类,后台可管理分类、链接与站点设置。
+首页:整条毛玻璃顶栏(站点标题)、毛玻璃搜索框与公开导航网格;登录后多出私有分类,后台可管理分类、链接与站点设置。
diff --git a/web/design-system/nav/MASTER.md b/web/design-system/nav/MASTER.md
index 45c20f1..de9d830 100644
--- a/web/design-system/nav/MASTER.md
+++ b/web/design-system/nav/MASTER.md
@@ -27,14 +27,14 @@
## 1. Pattern(页面与布局模式)
-产品形态:**现代毛玻璃起始页** —— 全屏背景图 + 毛玻璃卡片承载的搜索框、图标网格与分类锚点栏。
+产品形态:**现代毛玻璃起始页** —— 全屏背景图 + 整条毛玻璃顶栏(站点标题/Logo)+ 毛玻璃卡片承载的搜索框与图标网格。
### 1.1 页面结构(公开页 `/`)
1. **背景层**:全屏背景图(`settings.background_url`),固定不随滚动;上覆一层半透明暗/亮罩(`rgba(15,23,42,0.45)` 或浅色等价)保证前景可读。
-2. **顶部锚点栏**(sticky):分类名横向排列,点击滚动定位到对应分类区块,滚动时高亮当前区块;最右为低调登录入口(未登录)或「后台」+ 退出(已登录)。
+2. **顶栏**(sticky,整条毛玻璃:半透明底 + `backdrop-blur` + 底部分隔线):左侧为站点标题(`settings.logoUrl` 有值时为 Logo 图,否则站点标题文字;`h1` 语义);右侧为低调登录入口(未登录)或「后台」+ 退出(已登录),最右为主题切换。
3. **搜索区**(首屏中央偏上):毛玻璃大搜索框 + 引擎切换(当前引擎图标 + 下拉菜单);`/` 键聚焦、Enter 提交(按 `url_template` 的 `{q}` 替换)。
-4. **导航区**:「我的导航」标题 + 分类分节;每节是图标网格(桌面 7–8 列,平板 5–6 列,手机 4 列)。
+4. **导航区**:分类分节;每节是分类标题 + 图标网格(桌面 7–8 列,平板 5–6 列,手机 4 列)。
5. **私有区**(仅登录后):与公开区同构的分节,视觉上以毛玻璃卡片边缘的 accent 描边/「私有」徽标区分;**未登录时该区块在 DOM 与数据中完全不存在**。
### 1.2 后台(`/admin`)
@@ -118,7 +118,6 @@
- **阴影层级**:`sm 0 1px 2px rgba(0,0,0,.05)` / `md 0 4px 6px rgba(0,0,0,.10)` / `lg 0 10px 15px rgba(0,0,0,.10)` / `xl 0 20px 25px rgba(0,0,0,.15)`。
- **动效(Motion,Dial motion=3/10 微交互档)**:
- 入场:搜索框/网格卡片 stagger `opacity 0→1, y 8→0`,150–220ms,ease-out。
- - 锚点滚动:`scrollIntoView({ behavior: 'smooth', block: 'start' })`,sticky 栏下留 `scroll-margin-top`。
- 拖拽:dnd-kit `DndContext` + Motion 布局动画;拖起态加阴影与轻微旋转(≤2°)。
- 引擎切换 / 登录结果:Toast(shadcn/ui Sonner)。
- **一律尊重 `prefers-reduced-motion: reduce`**:跳过非必要动画,直接呈现终态。
diff --git a/web/src/components/link-grid.tsx b/web/src/components/link-grid.tsx
index b04b0de..1c11c84 100644
--- a/web/src/components/link-grid.tsx
+++ b/web/src/components/link-grid.tsx
@@ -1,9 +1,7 @@
-import * as React from "react";
import { FadeIn, GlassCard } from "@/components/glass";
import { SiteIcon } from "@/components/site-icon";
import { safeHost } from "@/lib/icons";
import type { SiteCategory, SiteLink } from "@/lib/types";
-import { cn } from "@/lib/utils";
/** 链接卡片:图标 + 标题 + 域名;桌面 7–8 列 / 手机 4 列 */
function LinkTile({ link, index }: { link: SiteLink; index: number }) {
@@ -69,51 +67,3 @@ export function CategorySection({
);
}
-
-/** 顶部锚点栏:滚动定位 + 当前分类高亮 */
-export function CategoryAnchorBar({
- categories,
-}: {
- categories: SiteCategory[];
-}) {
- const [active, setActive] = React.useState(null);
-
- React.useEffect(() => {
- const observer = new IntersectionObserver(
- (entries) => {
- const visible = entries
- .filter((e) => e.isIntersecting)
- .sort(
- (a, b) => a.boundingClientRect.top - b.boundingClientRect.top,
- )[0];
- if (visible) setActive(visible.target.id);
- },
- { rootMargin: "-96px 0px -60% 0px", threshold: 0 },
- );
- categories.forEach((c) => {
- const el = document.getElementById(`cat-${c.id}`);
- if (el) observer.observe(el);
- });
- return () => observer.disconnect();
- }, [categories]);
-
- return (
-
- );
-}
diff --git a/web/src/components/public-page.tsx b/web/src/components/public-page.tsx
index 76ca403..24466bf 100644
--- a/web/src/components/public-page.tsx
+++ b/web/src/components/public-page.tsx
@@ -1,7 +1,7 @@
import * as React from "react";
import { LogIn, LogOut, Settings } from "lucide-react";
import { FadeIn } from "@/components/glass";
-import { CategoryAnchorBar, CategorySection } from "@/components/link-grid";
+import { CategorySection } from "@/components/link-grid";
import { LoginDialog } from "@/components/login-dialog";
import { SearchBar } from "@/components/search-bar";
import { ThemeToggle } from "@/components/theme-toggle";
@@ -9,7 +9,8 @@ import { Button } from "@/components/ui/button";
import { useAuthenticated, useNavStore } from "@/lib/nav-store";
/**
- * 公开页(/):背景图 + 毛玻璃搜索框 + 锚点栏 + 「我的导航」图标网格 + 登录后的私有区。
+ * 公开页(/):背景图 + 整条毛玻璃顶栏(站点标题/Logo + 登录态操作)+ 毛玻璃搜索框
+ * + 「我的导航」图标网格 + 登录后的私有区。
*
* 安全口径:未登录时私有区完全不渲染 —— privateData 未加载时组件树里没有私有区块,
* 数据请求也只发 /api/public(未登录不请求 /api/private)。
@@ -92,11 +93,27 @@ export function PublicPage({ onOpenAdmin }: { onOpenAdmin: () => void }) {
}}
/>
- {/* 顶部锚点栏 */}
-
-
-
-
+ {/* 顶栏:整条毛玻璃,左侧站点标题/Logo,右侧后台、退出与主题切换 */}
+
+
+ {/*
+ 站点标题放在顶栏(h1 语义):logoUrl 有值显示适配栏高的 Logo 图,否则显示站点标题文字。
+ 文字沿用顶栏 text-foreground 口径(与右侧按钮一致):浅色档玻璃底近白、深色档近黑,两档对比度都成立。
+ */}
+
+ {settings?.logoUrl ? (
+
+ ) : (
+
+ {settings?.siteTitle ?? "我的导航"}
+
+ )}
+
+
{/*
顶栏按钮统一用前景色:浅色档的玻璃芯片是近白底,白字对比度只有 2.4:1。
新增顶栏按钮请沿用 text-foreground(深色档它就是近白,两档都成立)。
@@ -144,19 +161,8 @@ export function PublicPage({ onOpenAdmin }: { onOpenAdmin: () => void }) {
- {/* 搜索区:有 Logo 时头部换成 Logo 图,无则维持标题文字 */}
+ {/* 搜索区:站点标题已移入顶栏,这里只剩搜索框 */}
-
- {settings?.logoUrl ? (
-
- ) : (
- (settings?.siteTitle ?? "我的导航")
- )}
-
{siteData && (
({
toast: { success: vi.fn(), error: vi.fn() },
@@ -55,6 +55,69 @@ describe("PublicPage 头部:有 Logo 显示 Logo,无 Logo 显示标题文字
});
});
+describe("PublicPage 顶栏:整条毛玻璃 + 标题入栏 + 分类锚点栏已移除", () => {
+ /** 两个分类各带链接:旧锚点栏在分类多时会横向溢出,现已整块移除。 */
+ const categories: SiteCategory[] = [
+ {
+ id: "cat-dev",
+ name: "开发",
+ icon: null,
+ sortOrder: 0,
+ links: [
+ {
+ id: "link-1",
+ categoryId: "cat-dev",
+ title: "GitHub",
+ url: "https://github.com/",
+ iconUrl: null,
+ description: null,
+ sortOrder: 0,
+ },
+ ],
+ },
+ { id: "cat-read", name: "阅读", icon: null, sortOrder: 1, links: [] },
+ ];
+
+ beforeEach(() => {
+ useNavStore.setState({
+ publicData: { categories, searchEngines: [], settings: baseSettings },
+ privateData: null,
+ authStatus: "anonymous",
+ loginPromptOpen: false,
+ loadPublic: async () => {},
+ loadPrivate: async () => {},
+ });
+ });
+
+ it("站点标题在顶栏(h1)内,顶栏整条毛玻璃", () => {
+ render();
+
+ const header = document.querySelector("header");
+ expect(header).not.toBeNull();
+ // 整条毛玻璃:glass-bar 提供半透明底 + backdrop-blur + 底部分隔线(web/src/index.css)
+ expect(header).toHaveClass("glass-bar", "sticky", "top-0");
+
+ const heading = screen.getByRole("heading", { level: 1 });
+ expect(header?.contains(heading)).toBe(true);
+ expect(heading).toHaveTextContent("我的导航");
+ });
+
+ it("不再渲染分类锚点栏,正文分类区块与链接照旧", () => {
+ render();
+
+ expect(
+ screen.queryByRole("navigation", { name: "分类锚点" }),
+ ).not.toBeInTheDocument();
+ expect(
+ screen.getByRole("heading", { level: 2, name: "开发" }),
+ ).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: /GitHub/ })).toHaveAttribute(
+ "href",
+ "https://github.com/",
+ );
+ });
+});
+
describe("PublicPage:搜索跳转方式跟随站点设置 searchNewTab", () => {
const engines: SearchEngine[] = [
{