Prechádzať zdrojové kódy

使用 SentCanRead组件显示其他译文

visuddhinanda 3 rokov pred
rodič
commit
864307c7b3

+ 22 - 15
dashboard/src/components/template/SentEdit/SentTab.tsx

@@ -9,6 +9,7 @@ import {
 import { IWidgetSentEditInner } from "../SentEdit";
 import { IWidgetSentEditInner } from "../SentEdit";
 import Article from "../../article/Article";
 import Article from "../../article/Article";
 import SentTabButton from "./SentTabButton";
 import SentTabButton from "./SentTabButton";
+import SentCanRead from "./SentCanRead";
 
 
 const { Text } = Typography;
 const { Text } = Typography;
 
 
@@ -29,6 +30,7 @@ const Widget = ({
     return <></>;
     return <></>;
   }
   }
   const sentId = id.split("_");
   const sentId = id.split("_");
+  const sId = sentId[0].split("-");
 
 
   const onChange = (key: string) => {
   const onChange = (key: string) => {
     switch (key) {
     switch (key) {
@@ -49,6 +51,7 @@ const Widget = ({
   return (
   return (
     <>
     <>
       <Tabs
       <Tabs
+        style={{ marginBottom: 0 }}
         size="small"
         size="small"
         tabBarGutter={0}
         tabBarGutter={0}
         onChange={onChange}
         onChange={onChange}
@@ -76,11 +79,12 @@ const Widget = ({
             ),
             ),
             key: "translation",
             key: "translation",
             children: (
             children: (
-              <Article
-                active={translationActive}
-                type="corpus_sent/translation"
-                articleId={id}
-                mode="edit"
+              <SentCanRead
+                book={parseInt(sId[0])}
+                para={parseInt(sId[1])}
+                wordStart={parseInt(sId[2])}
+                wordEnd={parseInt(sId[3])}
+                type="translation"
               />
               />
             ),
             ),
           },
           },
@@ -95,11 +99,12 @@ const Widget = ({
             ),
             ),
             key: "nissaya",
             key: "nissaya",
             children: (
             children: (
-              <Article
-                active={nissayaActive}
-                type="corpus_sent/nissaya"
-                articleId={id}
-                mode="edit"
+              <SentCanRead
+                book={parseInt(sId[0])}
+                para={parseInt(sId[1])}
+                wordStart={parseInt(sId[2])}
+                wordEnd={parseInt(sId[3])}
+                type="nissaya"
               />
               />
             ),
             ),
           },
           },
@@ -114,11 +119,12 @@ const Widget = ({
             ),
             ),
             key: "commentary",
             key: "commentary",
             children: (
             children: (
-              <Article
-                active={commentaryActive}
-                type="corpus_sent/commentary"
-                articleId={id}
-                mode="edit"
+              <SentCanRead
+                book={parseInt(sId[0])}
+                para={parseInt(sId[1])}
+                wordStart={parseInt(sId[2])}
+                wordEnd={parseInt(sId[3])}
+                type="commentary"
               />
               />
             ),
             ),
           },
           },
@@ -132,6 +138,7 @@ const Widget = ({
               />
               />
             ),
             ),
             key: "original",
             key: "original",
+            disabled: true,
             children: (
             children: (
               <Article
               <Article
                 active={originalActive}
                 active={originalActive}