diff --git a/app/page.js b/app/page.js index 7da1a31..c1121d8 100644 --- a/app/page.js +++ b/app/page.js @@ -38,7 +38,7 @@ function HomeInner() { {view === 'messages' && (
-

消息

+

消息

暂无消息

diff --git a/components/AdminPage.js b/components/AdminPage.js index 3be3144..c56f3d6 100644 --- a/components/AdminPage.js +++ b/components/AdminPage.js @@ -2,6 +2,7 @@ // 管理后台:5 个 tab import { useState } from 'react'; +import { Icon } from './Icons'; import AdminReports from './admin/AdminReports'; import AdminUsers from './admin/AdminUsers'; import AdminLogs from './admin/AdminLogs'; @@ -9,11 +10,11 @@ import AdminLinks from './admin/AdminLinks'; import AdminForumSettings from './admin/AdminForumSettings'; const TABS = [ - { key: 'reports', label: '举报' }, - { key: 'users', label: '用户' }, - { key: 'logs', label: '日志' }, - { key: 'links', label: '友链' }, - { key: 'settings', label: '论坛设置' }, + { key: 'reports', label: '举报', icon: 'shieldAlert' }, + { key: 'users', label: '用户', icon: 'users' }, + { key: 'logs', label: '日志', icon: 'file' }, + { key: 'links', label: '友链', icon: 'link' }, + { key: 'settings', label: '论坛设置', icon: 'settings' }, ]; export default function AdminPage() { @@ -22,7 +23,7 @@ export default function AdminPage() { return (
-

管理后台

+

管理后台

{TABS.map((t) => ( @@ -31,7 +32,7 @@ export default function AdminPage() { className={'admin-tab' + (tab === t.key ? ' active' : '')} onClick={() => setTab(t.key)} > - {t.label} + {t.label} ))}
diff --git a/components/Feed.js b/components/Feed.js index 5e4e0d0..ffed199 100644 --- a/components/Feed.js +++ b/components/Feed.js @@ -4,6 +4,7 @@ import { useEffect, useState, useCallback } from 'react'; import { API } from '@/lib/api'; import { useApp } from './AppProvider'; +import { Icon } from './Icons'; function avatar(username) { return 'https://ui-avatars.com/api/?name=' + encodeURIComponent(username || '匿名用户') + @@ -12,7 +13,7 @@ function avatar(username) { export default function Feed({ onOpenModal, onReport }) { const { currentUser, sort, setSort, openPost, navigate, refreshKey } = useApp(); - const [posts, setPosts] = useState(null); // null = loading + const [posts, setPosts] = useState(null); const [error, setError] = useState(null); const load = useCallback(async () => { @@ -53,7 +54,7 @@ export default function Feed({ onOpenModal, onReport }) { navigate('new'); }} > - 发布新帖 + 发布新帖
@@ -82,17 +83,23 @@ export default function Feed({ onOpenModal, onReport }) {
)}
- 💬 {p.reply_count || 0} + + {p.reply_count || 0} + + }}> + 举报 + {currentUser && currentUser.id === p.user_id && ( + }}> + 删除 + )}
diff --git a/components/Icons.js b/components/Icons.js new file mode 100644 index 0000000..30ff40b --- /dev/null +++ b/components/Icons.js @@ -0,0 +1,85 @@ +'use client'; + +// 图标库 — SVG 内容逐字符提取自旧版 index.html (Feather Icons),与原版一致 +const S = { + xmlns: 'http://www.w3.org/2000/svg', width: 16, height: 16, viewBox: '0 0 24 24', + fill: 'none', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round', + style: { display: 'inline', verticalAlign: 'middle' }, +}; + +export function Icon({ name, size = 16, ...rest }) { + return {PATHS[name] || null}; +} + +const PATHS = { + message: ( + <> + + + ), + settings: ( + <> + + + ), + shieldAlert: ( + <> + + + ), + moon: ( + <> + + + ), + logout: ( + <> + + + ), + book: ( + <> + + + ), + link: ( + <> + + + ), + plus: ( + <> + + + ), + shield: ( + <> + + + ), + users: ( + <> + + + ), + file: ( + <> + + + ), + plus2: ( + <> + + + ), + close: ( + <> + + + ), + trash: ( + <> + + + ), +}; diff --git a/components/Modals.js b/components/Modals.js index e909c98..5ae0169 100644 --- a/components/Modals.js +++ b/components/Modals.js @@ -4,6 +4,7 @@ import { useState, useEffect } from 'react'; import { API, generateCaptcha } from '@/lib/api'; import { useApp } from './AppProvider'; +import { Icon } from './Icons'; export default function Modals({ modal, onClose, reportPostId }) { const { login, register, currentUser, refresh } = useApp(); @@ -87,7 +88,7 @@ export default function Modals({ modal, onClose, reportPostId }) { {modal === 'login' && (
- ✕ +

登录

setLoginEmail(e.target.value)} /> setLoginPassword(e.target.value)} @@ -100,7 +101,7 @@ export default function Modals({ modal, onClose, reportPostId }) { {modal === 'register' && (
- ✕ +

注册

setRegUsername(e.target.value)} /> setRegEmail(e.target.value)} /> @@ -119,8 +120,8 @@ export default function Modals({ modal, onClose, reportPostId }) { {modal === 'report' && currentUser && (
- ✕ -

举报帖子

+ +

举报帖子

请选择举报原因:

{post.username || '匿名用户'} {time} {canDelete && ( - + )}
diff --git a/components/ReplyList.js b/components/ReplyList.js index fb65cb0..3e43c87 100644 --- a/components/ReplyList.js +++ b/components/ReplyList.js @@ -4,6 +4,7 @@ import { useEffect, useState, useCallback } from 'react'; import { API, generateCaptcha } from '@/lib/api'; import { useApp } from './AppProvider'; +import { Icon } from './Icons'; function avatar(username) { return 'https://ui-avatars.com/api/?name=' + encodeURIComponent(username || '匿名用户') + @@ -61,7 +62,9 @@ export default function ReplyList({ postId, onRefresh }) { return ( <> -
💬 {replies.length} 条回复
+
+ {replies.length} 条回复 +
{replies.length === 0 ? (
还没有回复,快来抢沙发吧 🛋️
@@ -75,7 +78,9 @@ export default function ReplyList({ postId, onRefresh }) { {r.username || '匿名用户'} {rTime} {currentUser && currentUser.id === r.user_id && ( - + )}
@@ -88,7 +93,7 @@ export default function ReplyList({ postId, onRefresh }) {
-

发表回复

+

发表回复