feat: 移动端底部导航可配置与工作区导航、置顶后台等前端调整

This commit is contained in:
2026-10-16 16:26:08 +08:00
parent 47f87a011c
commit 55ded2695c
10 changed files with 573 additions and 154 deletions

View File

@@ -6,6 +6,7 @@ import { Fragment, useEffect, useState } from "react";
import {
Home,
BookOpen,
CodeXml,
PenSquare,
MessageSquare,
User as UserIcon,
@@ -14,7 +15,7 @@ import { apiChatUnreadSummary, type User } from "@/lib/api";
import { useAllowMessages } from "@/components/MessagesPolicyProvider";
import { useSiteBrand } from "@/components/SiteBrandProvider";
import { onDocumentVisible } from "@/lib/visibilityReconcile";
import { userPath, libraryPath } from "@/lib/urlStyle";
import { userPath, libraryPath, snippetsPath } from "@/lib/urlStyle";
import { realtime, RT_CHAT_UNREAD } from "@/lib/realtime";
import type { RtChatUnreadData } from "@/lib/realtime";
import type { MobileTabKey } from "@/lib/mobileTabs";
@@ -36,6 +37,7 @@ export default function MobileTabBar({
const allowMessages = useAllowMessages();
const { url_style: urlStyle, mobile_tabs: mobileTabs } = useSiteBrand();
const libHref = libraryPath(urlStyle);
const snipHref = snippetsPath(urlStyle);
const [chatUnread, setChatUnread] = useState(initialChatUnread);
// 登录态经 router.refresh() 下发新 props 时校正徽标
@@ -100,6 +102,16 @@ export default function MobileTabBar({
active={isActive((p) => p === libHref)}
/>
),
snippets: (
<TabLink
href={snipHref}
icon={<CodeXml size={20} />}
label="片段"
active={isActive(
(p) => p === snipHref || p.startsWith("/snippets") || p.startsWith("/snippet-"),
)}
/>
),
compose: (
<TabLink
href={user ? "/compose" : "/login"}