visuddhinanda 2 лет назад
Родитель
Сommit
d1afdb1b72

+ 3 - 0
dashboard/src/components/template/SentEdit.tsx

@@ -85,6 +85,8 @@ export const SentEditInner = ({
     }
   }, []);
 
+  const channelsId = translation?.map((item) => item.channel.id);
+
   return (
     <Card
       bodyStyle={{ paddingBottom: 0 }}
@@ -115,6 +117,7 @@ export const SentEditInner = ({
         para={para}
         wordStart={wordStart}
         wordEnd={wordEnd}
+        channelsId={channelsId}
         path={path}
         tranNum={tranNum}
         nissayaNum={nissayaNum}

+ 10 - 3
dashboard/src/components/template/SentEdit/SentCanRead.tsx

@@ -19,6 +19,7 @@ interface IWidget {
   wordStart: number;
   wordEnd: number;
   type: TChannelType;
+  channelsId?: string[];
   reload?: boolean;
   onReload?: Function;
 }
@@ -28,6 +29,7 @@ const SentCanReadWidget = ({
   wordStart,
   wordEnd,
   type,
+  channelsId,
   reload = false,
   onReload,
 }: IWidget) => {
@@ -37,9 +39,11 @@ const SentCanReadWidget = ({
   const user = useAppSelector(_currentUser);
 
   const load = () => {
-    get<ISentenceListResponse>(
-      `/v2/sentence?view=sent-can-read&sentence=${book}-${para}-${wordStart}-${wordEnd}&type=${type}&mode=edit`
-    )
+    const sentId = `${book}-${para}-${wordStart}-${wordEnd}`;
+    let url = `/v2/sentence?view=sent-can-read&sentence=${sentId}&type=${type}&mode=edit`;
+    url += channelsId ? `&channels=${channelsId.join()}` : "";
+    console.log("url", url);
+    get<ISentenceListResponse>(url)
       .then((json) => {
         if (json.ok) {
           console.log("sent load", json.data.rows);
@@ -74,14 +78,17 @@ const SentCanReadWidget = ({
         }
       });
   };
+
   useEffect(() => {
     load();
   }, []);
+
   useEffect(() => {
     if (reload) {
       load();
     }
   }, [reload]);
+
   return (
     <>
       <div style={{ display: "flex", justifyContent: "space-between" }}>

+ 3 - 0
dashboard/src/components/template/SentEdit/SentTab.tsx

@@ -25,6 +25,7 @@ interface IWidget {
   para: number;
   wordStart: number;
   wordEnd: number;
+  channelsId?: string[];
   path?: ITocPathNode[];
   layout?: "row" | "column";
   tranNum?: number;
@@ -42,6 +43,7 @@ const SentTabWidget = ({
   para,
   wordStart,
   wordEnd,
+  channelsId,
   path,
   tranNum,
   nissayaNum,
@@ -180,6 +182,7 @@ const SentTabWidget = ({
                 wordStart={parseInt(sId[2])}
                 wordEnd={parseInt(sId[3])}
                 type="commentary"
+                channelsId={channelsId}
               />
             ),
           },