feat(web): 页脚品牌与备案信息、首页文案精简及导航/侧栏交互优化
- 页脚「纯文本驱动」改为 Powered by Pure Note(链至仓库地址),新增 公安备案展示:国徽图标 + 备案号链至 beian.mps.gov.cn,备案号可在 后台设置(站点描述下一项)配置,留空不显示 - settings 白名单新增 beian_no 键(trim、≤200 字符、可清空),/api/site 一并下发;TestSettingsWhitelist 补生效/清空/超长用例 - 去除首页 hero 文案区(PURE NOTE · 极简笔记/记录,而不打扰。等), 同步清理失效样式并微调顶部留白 - 博客 header 首页/标签菜单补 House/Tags 图标,与管理按钮同风格 - 管理侧栏「返回博客/退出登录」浓缩为图标按钮置于用户行右侧,CSS 悬浮 tooltip(top-center、带箭头,原生 title 延迟高不采用),返回 博客改新窗口打开
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -1,5 +1,5 @@
|
||||
import { Link, NavLink, Outlet, useLocation, useNavigate } from 'react-router'
|
||||
import { Moon, Sun, Monitor, ExternalLink, House, PenLine, Trash2, Settings, LogOut } from 'lucide-react'
|
||||
import { Moon, Sun, Monitor, ExternalLink, House, PenLine, Tags, Trash2, Settings, LogOut } from 'lucide-react'
|
||||
import { useSiteTitle } from '../features/site'
|
||||
import { useTheme } from '../lib/theme'
|
||||
import { useAuth } from '../lib/auth'
|
||||
@@ -32,8 +32,12 @@ export function BlogLayout() {
|
||||
<div className="pn-site-header-inner">
|
||||
<Link to="/" className="pn-site-wordmark">{title}</Link>
|
||||
<nav className="pn-site-nav" aria-label="站点导航">
|
||||
<NavLink to="/" end className="pn-site-navlink hide-sm">首页</NavLink>
|
||||
<NavLink to="/tags" className="pn-site-navlink hide-sm">标签</NavLink>
|
||||
<NavLink to="/" end className="pn-site-navlink hide-sm">
|
||||
<House size={14} />首页
|
||||
</NavLink>
|
||||
<NavLink to="/tags" className="pn-site-navlink hide-sm">
|
||||
<Tags size={14} />标签
|
||||
</NavLink>
|
||||
<NavLink to="/admin" className="pn-site-navlink">
|
||||
<ExternalLink size={14} />管理
|
||||
</NavLink>
|
||||
@@ -46,7 +50,22 @@ export function BlogLayout() {
|
||||
</main>
|
||||
<footer className="pn-site-footer">
|
||||
<div className="pn-site-footer-inner">
|
||||
© {new Date().getFullYear()} {title} · 纯文本驱动 · <a href="/feed.xml">RSS</a>
|
||||
<p className="pn-site-footer-line">
|
||||
© {new Date().getFullYear()} {title} · Powered by{' '}
|
||||
<a href="https://git.airnan.cn/wangairnan/pure-note" target="_blank" rel="noreferrer">Pure Note</a>
|
||||
{' '}· <a href="/feed.xml">RSS</a>
|
||||
</p>
|
||||
{data?.beian_no && (
|
||||
<a
|
||||
className="pn-site-beian"
|
||||
href="https://beian.mps.gov.cn/"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<img src="/national_emblem.png" alt="" aria-hidden />
|
||||
{data.beian_no}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
@@ -108,22 +127,33 @@ function AdminSidebar() {
|
||||
</nav>
|
||||
|
||||
<div className="pn-admin-foot">
|
||||
<Link to="/" className="pn-admin-item">
|
||||
<ExternalLink size={15} /><span>返回博客</span>
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="pn-admin-item"
|
||||
onClick={() => void logout().then(() => navigate('/'))}
|
||||
>
|
||||
<LogOut size={15} /><span>退出登录</span>
|
||||
</button>
|
||||
<div className="pn-admin-user">
|
||||
<span className="pn-admin-avatar">管</span>
|
||||
<span className="pn-admin-user-meta">
|
||||
<span className="pn-admin-user-name">管理员</span>
|
||||
<span className="pn-admin-user-role">站点所有者</span>
|
||||
</span>
|
||||
<span className="pn-admin-user-actions">
|
||||
<a
|
||||
href="/"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="pn-admin-iconbtn"
|
||||
data-tip="返回博客"
|
||||
aria-label="返回博客(新窗口打开)"
|
||||
>
|
||||
<ExternalLink size={15} />
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
className="pn-admin-iconbtn"
|
||||
data-tip="退出登录"
|
||||
aria-label="退出登录"
|
||||
onClick={() => void logout().then(() => navigate('/'))}
|
||||
>
|
||||
<LogOut size={15} />
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
+92
-31
@@ -517,6 +517,24 @@ button:focus-visible {
|
||||
.pn-site-footer-inner a:hover {
|
||||
color: var(--foreground);
|
||||
}
|
||||
.pn-site-footer-line {
|
||||
margin: 0;
|
||||
}
|
||||
.pn-site-beian {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.pn-site-beian img {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
flex: none;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.pn-site-beian:hover img {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.pn-site-header-inner {
|
||||
@@ -535,35 +553,9 @@ button:focus-visible {
|
||||
首页(博客首页.html)
|
||||
============================================================ */
|
||||
.pn-home-content {
|
||||
padding-top: 64px;
|
||||
padding-top: 56px;
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
.pn-home-hero {
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
.pn-home-eyebrow {
|
||||
margin: 0 0 18px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.14em;
|
||||
color: var(--muted-foreground);
|
||||
}
|
||||
.pn-home-title {
|
||||
margin: 0 0 18px;
|
||||
font-family: var(--font-serif);
|
||||
font-weight: 400;
|
||||
font-size: clamp(34px, 6vw, 46px);
|
||||
line-height: 1.18;
|
||||
letter-spacing: var(--tracking-tight);
|
||||
color: var(--foreground);
|
||||
}
|
||||
.pn-home-desc {
|
||||
margin: 0;
|
||||
max-width: 560px;
|
||||
font-size: 15px;
|
||||
line-height: 1.8;
|
||||
color: var(--muted-foreground);
|
||||
}
|
||||
.pn-home-filter {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
@@ -728,10 +720,7 @@ button:focus-visible {
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.pn-home-content {
|
||||
padding-top: 44px;
|
||||
}
|
||||
.pn-home-hero {
|
||||
margin-bottom: 40px;
|
||||
padding-top: 40px;
|
||||
}
|
||||
.pn-home-post {
|
||||
padding: 26px 0;
|
||||
@@ -1597,6 +1586,78 @@ button:focus-visible {
|
||||
gap: 10px;
|
||||
padding: 8px 10px 2px;
|
||||
}
|
||||
.pn-admin-user-actions {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-left: auto;
|
||||
}
|
||||
.pn-admin-iconbtn {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: var(--radius-sm);
|
||||
background: transparent;
|
||||
color: var(--muted-foreground);
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease, color 0.15s ease;
|
||||
}
|
||||
.pn-admin-iconbtn:hover {
|
||||
background: var(--sidebar-accent);
|
||||
color: var(--sidebar-accent-foreground);
|
||||
}
|
||||
.pn-admin-iconbtn svg {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
}
|
||||
/* CSS 悬浮 tooltip(原生 title 延迟高且部分环境不显示) */
|
||||
.pn-admin-iconbtn::after {
|
||||
content: attr(data-tip);
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: calc(100% + 10px);
|
||||
z-index: 30;
|
||||
padding: 4px 8px;
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--primary);
|
||||
color: var(--primary-foreground);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transform: translate(-50%, 2px);
|
||||
transition: opacity 0.15s ease, transform 0.15s ease;
|
||||
}
|
||||
.pn-admin-iconbtn::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 100%;
|
||||
z-index: 30;
|
||||
margin-left: -5px;
|
||||
border: 5px solid transparent;
|
||||
border-top-color: var(--primary);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
.pn-admin-iconbtn:hover::after,
|
||||
.pn-admin-iconbtn:focus-visible::after {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
.pn-admin-iconbtn:hover::before,
|
||||
.pn-admin-iconbtn:focus-visible::before {
|
||||
opacity: 1;
|
||||
}
|
||||
.pn-admin-avatar {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
|
||||
@@ -87,6 +87,7 @@ export interface SiteSettings {
|
||||
site_title: string
|
||||
site_desc: string
|
||||
page_size: number
|
||||
beian_no: string
|
||||
}
|
||||
|
||||
export interface NoteItem {
|
||||
|
||||
@@ -18,6 +18,7 @@ export default function AdminSettings() {
|
||||
|
||||
const [title, setTitle] = useState('')
|
||||
const [desc, setDesc] = useState('')
|
||||
const [beian, setBeian] = useState('')
|
||||
const [pageSize, setPageSize] = useState(10)
|
||||
const [toast, setToast] = useState<{ msg: string; kind: 'success' | 'error' } | null>(null)
|
||||
|
||||
@@ -25,6 +26,7 @@ export default function AdminSettings() {
|
||||
if (data) {
|
||||
setTitle(data.site_title)
|
||||
setDesc(data.site_desc)
|
||||
setBeian(data.beian_no)
|
||||
setPageSize(data.page_size)
|
||||
}
|
||||
}, [data])
|
||||
@@ -33,7 +35,7 @@ export default function AdminSettings() {
|
||||
mutationFn: () =>
|
||||
api('/api/admin/settings', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ site_title: title, site_desc: desc, page_size: pageSize }),
|
||||
body: JSON.stringify({ site_title: title, site_desc: desc, beian_no: beian, page_size: pageSize }),
|
||||
}),
|
||||
onSuccess: () => {
|
||||
setToast({ msg: '设置已保存', kind: 'success' })
|
||||
@@ -74,6 +76,17 @@ export default function AdminSettings() {
|
||||
onChange={(e) => setDesc(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="pn-as-field">
|
||||
<label className="pn-as-label" htmlFor="beian-no">公安备案号</label>
|
||||
<input
|
||||
id="beian-no"
|
||||
className="pn-as-input"
|
||||
placeholder="如:京公网安备11000000000000号"
|
||||
value={beian}
|
||||
onChange={(e) => setBeian(e.target.value)}
|
||||
/>
|
||||
<p className="pn-as-hint">显示在博客页脚并链接至公安部备案官网;留空则不显示。</p>
|
||||
</div>
|
||||
<div className="pn-as-field">
|
||||
<label className="pn-as-label" htmlFor="page-size">首页每页条数(1–100)</label>
|
||||
<input
|
||||
|
||||
@@ -61,12 +61,6 @@ export default function Home() {
|
||||
|
||||
return (
|
||||
<div className="pn-home-content">
|
||||
<section className="pn-home-hero">
|
||||
<p className="pn-home-eyebrow">PURE NOTE · 极简笔记</p>
|
||||
<h1 className="pn-home-title">记录,而不打扰。</h1>
|
||||
<p className="pn-home-desc">Pure Note 是一个纯文本驱动的极简笔记工具,这里是公开的笔记。</p>
|
||||
</section>
|
||||
|
||||
{topTags.length > 0 && (
|
||||
<nav className="tabs pn-home-filter" aria-label="按标签筛选笔记">
|
||||
<Link to="/" className={page === 1 ? 'active' : undefined}>全部</Link>
|
||||
|
||||
Reference in New Issue
Block a user