diff --git a/src/modules/config/config-version-switcher.tsx b/src/modules/config/config-version-switcher.tsx
index 439c7b5..1b2edf8 100644
--- a/src/modules/config/config-version-switcher.tsx
+++ b/src/modules/config/config-version-switcher.tsx
@@ -13,13 +13,6 @@ import {
DialogTitle,
} from "@/components/ui/dialog";
import { Label } from "@/components/ui/label";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select";
import {
Sheet,
SheetContent,
@@ -45,10 +38,6 @@ function versionStatusLabel(status: string): string {
return status;
}
-function versionSelectLabel(v: ConfigVersionSummary): string {
- return `#${v.id} · v${v.version_no} · ${versionStatusLabel(v.status)}`;
-}
-
const STATUS_ORDER = ["draft", "active", "archived"] as const;
export type ConfigVersionSwitcherProps = {
@@ -101,6 +90,11 @@ export function ConfigVersionSwitcher({
return groups;
}, [sortedVersions]);
+ const selectedVersion = useMemo(
+ () => sortedVersions.find((v) => String(v.id) === selectedId) ?? null,
+ [selectedId, sortedVersions],
+ );
+
const statusCounts = useMemo(
() =>
STATUS_ORDER.map((status) => ({
@@ -135,47 +129,69 @@ export function ConfigVersionSwitcher({
return (
<>
-
+
-
-
-
-
- {sheetTitle}
- {sheetDescription}
-
-
- {statusCounts.map((s) => (
-
- {s.label}
- {s.count}
-
- ))}
+
+
+
+
+
+
+ {sheetTitle}
+
+
+ {sheetDescription}
+
+
-
+
+
+ {statusCounts.map((s) => (
+
+
{s.label}
+
+ {s.count}
+
+
+ ))}
+
+
+
{sortedVersions.length === 0 ? (
-
暂无版本记录。
+
+ 暂无版本记录。
+
) : (
STATUS_ORDER.map((status) => {
const rows = groupedVersions.get(status) ?? [];
@@ -183,72 +199,110 @@ export function ConfigVersionSwitcher({
return null;
}
return (
-
+
-
-
-
{versionStatusLabel(status)}
+
+
+
+ {versionStatusLabel(status)}
+
-
{rows.length} 条
+
+ {rows.length} 条
+
-
+
{rows.map((v) => {
const isCurrent = selectedId === String(v.id);
return (
-
-
-
-
v{v.version_no}
-
-
#{v.id}
+
+
+
+
+
+
+
+ v{v.version_no}
+
+
+
+ #{v.id}
+
+
+
+ 生效时间:{v.effective_at ? formatDt(v.effective_at) : "—"}
+ {v.reason ? ` · 备注:${v.reason}` : ""}
+
+
+ {isCurrent ? (
+
+ 当前查看
+
+ ) : null}
-
- 生效时间:{v.effective_at ? formatDt(v.effective_at) : "—"}
- {v.reason ? ` · 备注:${v.reason}` : ""}
-
-
-
-
- {onRollbackVersion && v.status !== "draft" ? (
+
- ) : null}
- {onDeleteVersion && v.status !== "active" ? (
-
- ) : null}
+ {onRollbackVersion && v.status !== "draft" ? (
+
+ ) : null}
+ {onDeleteVersion && v.status !== "active" ? (
+
+ ) : null}
+
diff --git a/src/modules/config/doc/play-config-doc-screen.tsx b/src/modules/config/doc/play-config-doc-screen.tsx
index f2b88cb..7e2cee3 100644
--- a/src/modules/config/doc/play-config-doc-screen.tsx
+++ b/src/modules/config/doc/play-config-doc-screen.tsx
@@ -315,19 +315,16 @@ export function PlayConfigDocScreen() {
{detail ? (
- 当前版本:v{detail.version_no} ·{" "}
- {detail.status === "active" ? "生效中" : detail.status === "draft" ? "草稿" : "已归档"}
{activeHead ? (
<>
- {" "}
- · 线上生效版本 v{activeHead.version_no}
+ 线上生效版本 v{activeHead.version_no}
{activeHead.effective_at ? ` · ${activeHead.effective_at}` : ""}
>
) : null}
{!isDraft ? (
- {" "}
- — 限额与规则为只读,请先新建草稿。
+ {activeHead ? " — " : ""}
+ 限额与规则为只读,请先新建草稿。
) : null}
@@ -378,10 +375,11 @@ export function PlayConfigDocScreen() {
}}
/>
-
+
{
@@ -394,8 +392,8 @@ export function PlayConfigDocScreen() {