Sfoglia il codice sorgente

fix: channel chapter title link navigates to chapter page

visuddhinanda 5 giorni fa
parent
commit
e3bf847458
1 ha cambiato i file con 7 aggiunte e 3 eliminazioni
  1. 7 3
      dashboard-v6/src/pages/workspace/channel/show.tsx

+ 7 - 3
dashboard-v6/src/pages/workspace/channel/show.tsx

@@ -1,5 +1,5 @@
 import { useEffect, useState } from "react";
 import { useEffect, useState } from "react";
-import { useParams } from "react-router";
+import { useNavigate, useParams } from "react-router";
 import { useIntl } from "react-intl";
 import { useIntl } from "react-intl";
 import { Button, Card, Tabs } from "antd";
 import { Button, Card, Tabs } from "antd";
 import { TeamOutlined } from "@ant-design/icons";
 import { TeamOutlined } from "@ant-design/icons";
@@ -17,6 +17,7 @@ import TermList from "../../../components/term/TermList";
 
 
 const Widget = () => {
 const Widget = () => {
   const { channelId } = useParams(); //url 参数
   const { channelId } = useParams(); //url 参数
+  const navigate = useNavigate();
   const [title, setTitle] = useState<string>();
   const [title, setTitle] = useState<string>();
   const intl = useIntl();
   const intl = useIntl();
   const channelTitle = intl.formatMessage({
   const channelTitle = intl.formatMessage({
@@ -73,8 +74,11 @@ const Widget = () => {
                         : "";
                         : "";
                       window.open(fullUrl(url), "_blank");
                       window.open(fullUrl(url), "_blank");
                     } else {
                     } else {
-                      //setParam(chapter);
-                      //setArticleOpen(true);
+                      let url = articlePath(chapter.type, chapter.articleId);
+                      url += chapter?.channelId
+                        ? `?channel=${chapter.channelId}`
+                        : "";
+                      navigate(url);
                     }
                     }
                   }}
                   }}
                 />
                 />