Browse Source

✨ (dashboard-v6): 术语详情页在编辑者下方显示所属 channel 与公开性标签

新增 ChannelStatusTag(按 status 着色);ArticleLayout 加 afterEditors 插槽。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 22 hours ago
parent
commit
42b07ab854

+ 13 - 1
dashboard-v6/src/components/article/TypeTerm.tsx

@@ -1,4 +1,4 @@
-import { Breadcrumb, Button, Space } from "antd";
+import { Breadcrumb, Button, Divider, Space, Typography } from "antd";
 import { useIntl } from "react-intl";
 import { useIntl } from "react-intl";
 import { EditOutlined, ShareAltOutlined } from "@ant-design/icons";
 import { EditOutlined, ShareAltOutlined } from "@ant-design/icons";
 import type { ArticleMode } from "../../api/article";
 import type { ArticleMode } from "../../api/article";
@@ -13,10 +13,13 @@ import ArticleHeader from "./components/ArticleHeader";
 import ArticleLayout from "./components/ArticleLayout";
 import ArticleLayout from "./components/ArticleLayout";
 import { useTerm } from "./hooks/useTerm";
 import { useTerm } from "./hooks/useTerm";
 import TermShare from "../term/TermShare";
 import TermShare from "../term/TermShare";
+import ChannelStatusTag from "../channel/ChannelStatusTag";
 import { QualityCtl } from "../template/Quality";
 import { QualityCtl } from "../template/Quality";
 import MarkupView from "../markup/MarkupView";
 import MarkupView from "../markup/MarkupView";
 import type { MarkupNode } from "../markup/types";
 import type { MarkupNode } from "../markup/types";
 
 
+const { Text } = Typography;
+
 interface IWidget {
 interface IWidget {
   id?: string;
   id?: string;
   mode?: ArticleMode | null;
   mode?: ArticleMode | null;
@@ -114,6 +117,15 @@ const TypeTermWidget = ({
         ]}
         ]}
         editor={term?.editor}
         editor={term?.editor}
         coEditor={term?.co_editor}
         coEditor={term?.co_editor}
+        afterEditors={
+          term?.channel ? (
+            <Space size="small">
+              <Divider orientation="vertical" />
+              <Text type="secondary">{term.channel.name}</Text>
+              <ChannelStatusTag status={term.channel.status} />
+            </Space>
+          ) : undefined
+        }
         created_at={term?.created_at}
         created_at={term?.created_at}
         updated_at={term?.updated_at}
         updated_at={term?.updated_at}
         loading={loading}
         loading={loading}

+ 4 - 0
dashboard-v6/src/components/article/components/ArticleLayout.tsx

@@ -32,6 +32,8 @@ export interface IArticleLayout {
   editor?: IEditorBrief | null;
   editor?: IEditorBrief | null;
   /** 协作者(v3 的 co_editor):人类授权代写的 AI 模型 */
   /** 协作者(v3 的 co_editor):人类授权代写的 AI 模型 */
   coEditor?: IEditorBrief | null;
   coEditor?: IEditorBrief | null;
+  /** 显示在编辑者那一行下面(如术语所属的 channel) */
+  afterEditors?: ReactNode;
   owner?: IStudio;
   owner?: IStudio;
   loading?: boolean;
   loading?: boolean;
   errorCode?: number;
   errorCode?: number;
@@ -53,6 +55,7 @@ const ArticleLayout = ({
   editor,
   editor,
   coEditor,
   coEditor,
   updated_at,
   updated_at,
+  afterEditors,
   resList,
   resList,
   loading,
   loading,
   errorCode,
   errorCode,
@@ -97,6 +100,7 @@ const ArticleLayout = ({
               coEditor={coEditor}
               coEditor={coEditor}
               updatedAt={updated_at}
               updatedAt={updated_at}
             />
             />
+            {afterEditors}
             <Divider />
             <Divider />
           </Flex>
           </Flex>
           {html
           {html

+ 30 - 0
dashboard-v6/src/components/channel/ChannelStatusTag.tsx

@@ -0,0 +1,30 @@
+import { Tag } from "antd";
+import { useIntl } from "react-intl";
+
+/** channel 的 status → 文案 key 与标签颜色 */
+const STATUS: Record<number, { label: string; color: string }> = {
+  0: { label: "disable", color: "default" },
+  5: { label: "blocked", color: "red" },
+  10: { label: "private", color: "orange" },
+  20: { label: "public_no_list", color: "blue" },
+  30: { label: "public", color: "green" },
+  40: { label: "public.edit", color: "cyan" },
+};
+
+/** channel 公开性标签,按 status 着色;未知的 status 不显示 */
+const ChannelStatusTag = ({ status }: { status?: number | null }) => {
+  const intl = useIntl();
+  const item =
+    status === undefined || status === null ? undefined : STATUS[status];
+  if (!item) {
+    return null;
+  }
+
+  return (
+    <Tag color={item.color}>
+      {intl.formatMessage({ id: `forms.fields.publicity.${item.label}.label` })}
+    </Tag>
+  );
+};
+
+export default ChannelStatusTag;