feat: 友链/书库/移动端导航/排行榜等多模块功能
新增模块: - 友链(friendlink)后端处理 + 前端管理页与友链板 - 书库(library):导入、章节、封面、阅读页、横竖版自适应 AdaptiveCoverSlot - 顶栏导航(header_nav)配置与 MobileTabBar/MobileRailDrawers 移动端抽屉 - 排行榜 service 测试、站点页面测试、时间线发布(timeline_release) 其它改动: - 后端 handlers/services 全量小幅调整 - 前端组件、库函数、URL/品牌/站点 URL 工具更新 - Lightbox 图片、MdEntries 条目卡、coverColor 派生色相等前端能力
This commit is contained in:
@@ -7,6 +7,8 @@ import Footer from "@/components/Footer";
|
||||
import BackToTop from "@/components/BackToTop";
|
||||
import MobileTabBar from "@/components/MobileTabBar";
|
||||
import type { User } from "@/lib/api";
|
||||
import { isWideShellPath } from "@/lib/siteUrl";
|
||||
import { libraryPath, userPath } from "@/lib/urlStyle";
|
||||
import { useSiteBrand } from "@/components/SiteBrandProvider";
|
||||
|
||||
function pathIsAdmin(pathname: string | null) {
|
||||
@@ -24,11 +26,6 @@ function pathIsComposeStudio(pathname: string | null) {
|
||||
return pathname === "/compose" || /^\/post\/[^/]+\/edit\/?$/.test(pathname);
|
||||
}
|
||||
|
||||
/** 底部公共菜单避让:聊天 / 发帖工作台锁视口,不渲染底栏 */
|
||||
function pathHasNoTabBar(pathname: string | null) {
|
||||
return pathIsChat(pathname) || pathIsComposeStudio(pathname);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公开站 chrome 闸门:/admin 不渲染 Header/Footer/1440 main。
|
||||
* 首屏用 middleware 的 x-pathname 初值保证 hydration 一致;
|
||||
@@ -85,7 +82,19 @@ export default function SiteChrome({
|
||||
|
||||
// 聊天 / 发帖工作台锁视口,窗口回顶无意义
|
||||
const showBackToTop = !pathIsChat(pathname) && !pathIsComposeStudio(pathname);
|
||||
const showTabBar = showBackToTop;
|
||||
// 底栏只在已启用 tab 的根路径显示(个人页子 tab 走 ?tab= 查询参数,不影响 pathname);
|
||||
// 发帖无「首页」概念不产生可见路径,发帖工作台 / 帖子编辑页继续排除
|
||||
const enabledTabs = new Set(brand.mobile_tabs);
|
||||
const meHref = user ? userPath(brand.url_style, user.id) : "";
|
||||
const tabBarRoots: string[] = [];
|
||||
if (enabledTabs.has("home")) tabBarRoots.push("/");
|
||||
if (enabledTabs.has("library")) tabBarRoots.push(libraryPath(brand.url_style));
|
||||
if (enabledTabs.has("messages")) tabBarRoots.push("/chat");
|
||||
if (enabledTabs.has("me") && meHref) tabBarRoots.push(meHref);
|
||||
const showTabBar =
|
||||
!!pathname && !pathIsComposeStudio(pathname) && tabBarRoots.includes(pathname);
|
||||
// 书库页正文区放宽(Header/Footer 保持 1440,避免顶栏菜单位置随页面跳动)
|
||||
const wideShell = isWideShellPath(pathname);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -105,7 +114,7 @@ export default function SiteChrome({
|
||||
<main
|
||||
id="main"
|
||||
tabIndex={-1}
|
||||
className="flex-1 w-full max-w-[1440px] mx-auto px-4 sm:px-6 pt-4 sm:pt-[var(--main-pad-y)] pb-[calc(4.75rem+env(safe-area-inset-bottom))] lg:pb-[var(--main-pad-y)] outline-none"
|
||||
className={`flex-1 w-full ${wideShell ? "max-w-[1680px]" : "max-w-[1440px]"} mx-auto px-4 sm:px-6 pt-4 sm:pt-[var(--main-pad-y)] pb-[var(--main-pad-y)] outline-none`}
|
||||
>
|
||||
{children}
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user