Files
forumlify/components/AdminPage.js
T
lezi-fun 4732e7d61d feat: port upstream custom pages, notifications, recovery codes, account security
- schema: custom_pages, notifications, recovery_codes tables + UNIQUE(conversations) + posts.edited_at
- API: custom-pages CRUD (public + admin), notifications (list/read/read-all), recovery-codes (generate/count/reset-password), user avatar/password/email, post edit
- UI: custom page nav links + iframe rendering, admin custom pages tab with editor modal, messages page shows notifications, settings page gains avatar upload, password/email change, recovery codes manager
- Sync globals.css with upstream rewrite
2026-08-10 09:07:06 +08:00

52 lines
1.8 KiB
JavaScript

'use client';
// 管理后台: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';
import AdminLinks from './admin/AdminLinks';
import AdminForumSettings from './admin/AdminForumSettings';
import AdminCustomPages from './admin/AdminCustomPages';
const TABS = [
{ key: 'reports', label: '举报', icon: 'shieldAlert' },
{ key: 'users', label: '用户', icon: 'users' },
{ key: 'logs', label: '日志', icon: 'file' },
{ key: 'links', label: '友链', icon: 'link' },
{ key: 'custom', label: '自定义页面', icon: 'file' },
{ key: 'settings', label: '论坛设置', icon: 'settings' },
];
export default function AdminPage() {
const [tab, setTab] = useState('reports');
return (
<div className="page-slide active">
<div className="page-header" style={{ maxWidth: 900, margin: '0 auto', width: '100%' }}>
<h2><Icon name="shieldAlert" size={20} /> 管理后台</h2>
</div>
<div className="admin-tabs" style={{ maxWidth: 900, margin: '0 auto', width: '100%' }}>
{TABS.map((t) => (
<button
key={t.key}
className={'admin-tab' + (tab === t.key ? ' active' : '')}
onClick={() => setTab(t.key)}
>
<Icon name={t.icon} size={14} /> {t.label}
</button>
))}
</div>
<div id="adminContent" style={{ maxWidth: 900, margin: '0 auto', width: '100%' }}>
{tab === 'reports' && <AdminReports />}
{tab === 'users' && <AdminUsers />}
{tab === 'logs' && <AdminLogs />}
{tab === 'links' && <AdminLinks />}
{tab === 'custom' && <AdminCustomPages />}
{tab === 'settings' && <AdminForumSettings />}
</div>
</div>
);
}