feat: 管理端板块管理与旧版数据导入,补充部署运营文档

- 新增管理端板块管理页面与后端接口(admin_board)
- 新增旧版数据导入:legacyimport 服务、导入面板、importusers 命令行工具
- 聊天用户卡片、板块图标等 UI 组件与界面优化
- 补充 about/公告/1Panel 部署等文档
- gitignore 排除 dist/ 构建产物与 .agents/ 本地工具目录
This commit is contained in:
2026-09-24 03:37:44 +08:00
parent c1f6a6636b
commit 3e55b5d230
53 changed files with 5078 additions and 409 deletions

View File

@@ -3,6 +3,7 @@
import { useEffect, useId, useRef, useState } from "react";
import { Check, ChevronDown } from "lucide-react";
import type { Board } from "@/lib/api";
import BoardIcon, { boardColor } from "@/components/BoardIcon";
type BoardPickerProps = {
boards: Board[];
@@ -15,10 +16,6 @@ type BoardPickerProps = {
id?: string;
};
function boardColorIndex(b: Board, fallbackIndex: number) {
return Math.max(0, b.color_index ?? fallbackIndex) % 8;
}
export default function BoardPicker({
boards,
value,
@@ -104,9 +101,7 @@ export default function BoardPicker({
? "暂无可用板块"
: "请选择板块";
const colorIdx = selected
? boardColorIndex(selected, selectedIdx)
: 0;
const colorIdx = selected ? boardColor(selected) : 0;
return (
<div className="j13-board-picker" ref={rootRef}>
@@ -126,7 +121,7 @@ export default function BoardPicker({
className={`j13-board-trigger-ico${selected ? ` av-${colorIdx}` : " is-placeholder"}`}
aria-hidden
>
{(selected?.name || "板").slice(0, 1)}
<BoardIcon icon={selected?.icon} name={selected?.name || "板"} size={16} />
</span>
<span className="j13-board-trigger-copy">
<span className="j13-board-trigger-name">{label}</span>
@@ -160,7 +155,6 @@ export default function BoardPicker({
>
{boards.map((b, i) => {
const selectedHere = b.id === value;
const c = boardColorIndex(b, i);
return (
<li key={b.id} role="presentation">
<button
@@ -173,8 +167,8 @@ export default function BoardPicker({
onMouseEnter={() => setActiveIndex(i)}
onClick={() => pick(b.id)}
>
<span className={`j13-board-trigger-ico av-${c}`} aria-hidden>
{b.name.slice(0, 1)}
<span className={`j13-board-trigger-ico av-${boardColor(b)}`} aria-hidden>
<BoardIcon icon={b.icon} name={b.name} size={16} />
</span>
<span className="flex-1 min-w-0 truncate">{b.name}</span>
{selectedHere && <Check size={15} className="shrink-0" />}
@@ -188,19 +182,23 @@ export default function BoardPicker({
);
}
/** 编辑态只读板块徽章(与触发器同高) */
/** 编辑态只读板块徽章(与触发器同高;boardId + 原始 color_index,内部按全站规则解析配色) */
export function BoardBadge({
name,
boardId,
colorIndex = 0,
icon,
}: {
name: string;
boardId: number;
colorIndex?: number;
icon?: string;
}) {
const c = Math.max(0, colorIndex) % 8;
const c = boardColor({ id: boardId, color_index: colorIndex });
return (
<div className="j13-board-badge">
<span className={`j13-board-trigger-ico av-${c}`} aria-hidden>
{name.slice(0, 1)}
<BoardIcon icon={icon} name={name} size={16} />
</span>
<span className="truncate">{name}</span>
</div>