Просмотр исходного кода

Merge pull request #1511 from visuddhinanda/agile

调整搜索结果书名在前面
visuddhinanda 2 лет назад
Родитель
Сommit
6d950ef1f8

+ 90 - 0
dashboard/src/assets/icon/index.tsx

@@ -348,6 +348,80 @@ const CommentOutLined = () => (
     ></path>
   </svg>
 );
+
+const TranslationOutLined = () => (
+  <svg
+    viewBox="0 0 1024 1024"
+    version="1.1"
+    xmlns="http://www.w3.org/2000/svg"
+    p-id="5512"
+    width="1em"
+    height="1em"
+  >
+    <path
+      d="M608 416h288c35.36 0 64 28.48 64 64v416c0 35.36-28.48 64-64 64H480c-35.36 0-64-28.48-64-64v-288H128c-35.36 0-64-28.48-64-64V128c0-35.36 28.48-64 64-64h416c35.36 0 64 28.48 64 64v288z m0 64v64c0 35.36-28.48 64-64 64h-64v256.032c0 17.664 14.304 31.968 31.968 31.968H864a31.968 31.968 0 0 0 31.968-31.968V512a31.968 31.968 0 0 0-31.968-31.968H608zM128 159.968V512c0 17.664 14.304 31.968 31.968 31.968H512a31.968 31.968 0 0 0 31.968-31.968V160A31.968 31.968 0 0 0 512.032 128H160A31.968 31.968 0 0 0 128 159.968z m64 244.288V243.36h112.736V176h46.752c6.4 0.928 9.632 1.824 9.632 2.752a10.56 10.56 0 0 1-1.376 4.128c-2.752 7.328-4.128 16.032-4.128 26.112v34.368h119.648v156.768h-50.88v-20.64h-68.768v118.272H306.112v-118.272H238.752v24.768H192z m46.72-122.368v60.48h67.392V281.92H238.752z m185.664 60.48V281.92h-68.768v60.48h68.768z m203.84 488H576L668.128 576h64.64l89.344 254.4h-54.976l-19.264-53.664h-100.384l-19.232 53.632z m33.024-96.256h72.864l-34.368-108.608h-1.376l-37.12 108.608zM896 320h-64a128 128 0 0 0-128-128V128a192 192 0 0 1 192 192zM128 704h64a128 128 0 0 0 128 128v64a192 192 0 0 1-192-192z"
+      fill="currentColor"
+      p-id="5513"
+    ></path>
+  </svg>
+);
+
+const OverviewOutLined = () => (
+  <svg
+    viewBox="0 0 1024 1024"
+    version="1.1"
+    xmlns="http://www.w3.org/2000/svg"
+    p-id="6575"
+    width="1em"
+    height="1em"
+  >
+    <path
+      d="M485.9 487.6H315.6c-93.9 0-170.3-76.4-170.3-170.3S221.7 147 315.6 147s170.3 76.4 170.3 170.3v170.3zM315.6 191c-69.7 0-126.3 56.7-126.3 126.3S246 443.6 315.6 443.6h126.3V317.3c0-69.7-56.6-126.3-126.3-126.3z m390.8 296.6H536.1V317.3c0-93.9 76.4-170.3 170.3-170.3s170.3 76.4 170.3 170.3-76.4 170.3-170.3 170.3z m-126.3-44h126.3c69.7 0 126.3-56.7 126.3-126.3S776 191 706.4 191s-126.3 56.7-126.3 126.3v126.3zM706.4 877c-93.9 0-170.3-76.4-170.3-170.3V536.4h170.3c93.9 0 170.3 76.4 170.3 170.3S800.3 877 706.4 877zM580.1 580.4v126.3c0 69.7 56.7 126.3 126.3 126.3s126.3-56.7 126.3-126.3c0-69.7-56.7-126.3-126.3-126.3H580.1zM315.6 877c-93.9 0-170.3-76.4-170.3-170.3s76.4-170.3 170.3-170.3h170.3v170.3c0 93.9-76.4 170.3-170.3 170.3z m0-296.6c-69.7 0-126.3 56.7-126.3 126.3 0 69.7 56.7 126.3 126.3 126.3s126.3-56.7 126.3-126.3V580.4H315.6z"
+      p-id="6576"
+      fill="currentColor"
+    ></path>
+  </svg>
+);
+
+const CourseOutLined = () => (
+  <svg
+    viewBox="0 0 1024 1024"
+    version="1.1"
+    xmlns="http://www.w3.org/2000/svg"
+    p-id="1555"
+    width="1em"
+    height="1em"
+  >
+    <path
+      d="M838.3 80.3H442.8c-55.9 0-103.3 42.8-110.8 98.8-86.4 14.7-150.7 90.3-150.7 178.7 0 100 81.3 181.3 181.3 181.3s181.3-81.3 181.3-181.3c0-41.8-14.6-82.7-41.2-115-24.3-29.5-57.4-50.7-94-60.4 4.8-15.5 18.5-26.4 34.2-26.4h395.5c19.9 0 36.1 17.4 36.1 38.7v525.1c0 21.3-16.2 38.7-36.1 38.7H660.9v-61.6c0-41-18.9-79.6-51-104.9l118.7-238.5c4.5-9.1 5.2-19.3 2-28.9s-10-17.4-19-21.9c-18.7-9.3-41.5-1.7-50.8 17L539.3 563.9c-4-0.4-8-0.5-12-0.5h-69c-20.9 0-37.9 17-37.9 37.9s17 37.9 37.9 37.9h69c31.9 0 57.8 25.9 57.8 57.8v112.4c0 31.9-26 57.8-57.8 57.8h-69c-20.9 0-37.9 17-37.9 37.9s17 37.9 37.9 37.9h69c64.4 0 119.5-46.2 131.3-108.7h179.8c61.7 0 111.9-51.3 111.9-114.4V194.7c-0.1-63.1-50.3-114.4-112-114.4zM468.1 357.7c0 58.2-47.3 105.5-105.5 105.5s-105.5-47.3-105.5-105.5 47.3-105.5 105.5-105.5 105.5 47.3 105.5 105.5z"
+      fill="currentColor"
+      p-id="1556"
+    ></path>
+    <path
+      d="M208.1 639.1H268c20.9 0 37.9-17 37.9-37.9s-17-37.9-37.9-37.9h-59.9c-73.7 0-133.6 59.9-133.6 133.6v112.4c0 73.7 59.9 133.6 133.6 133.6H268c20.9 0 37.9-17 37.9-37.9s-17-37.9-37.9-37.9h-59.9c-31.9 0-57.8-25.9-57.8-57.8V696.9c-0.1-31.9 25.9-57.8 57.8-57.8z"
+      fill="currentColor"
+      p-id="1557"
+    ></path>
+  </svg>
+);
+
+const AnthologyOutLined = () => (
+  <svg
+    viewBox="0 0 1024 1024"
+    version="1.1"
+    xmlns="http://www.w3.org/2000/svg"
+    p-id="2573"
+    width="1em"
+    height="1em"
+  >
+    <path
+      d="M111.872 734.56c3.744 0.448 7.392 1.312 11.232 1.408l416.032 63.648a31.456 31.456 0 0 0 20.736-3.84l448-256a32 32 0 0 0-31.744-55.552l-438.304 250.464L130.56 672.384A30.72 30.72 0 0 0 125.728 672C91.68 672 64 642.336 64 605.888c0-25.76 16.576-50.208 41.28-60.864 1.536-0.672 2.592-1.92 3.968-2.752 4.608 0.64 9.12 1.632 13.888 1.728l416.032 63.648a31.936 31.936 0 0 0 20.704-3.872l448-256a32 32 0 0 0-31.744-55.552l-438.304 250.464L130.56 480.384A30.72 30.72 0 0 0 125.728 480C91.68 480 64 450.336 64 413.888c0-25.792 16.416-49.696 40.192-60.384l435.264 62.176a31.936 31.936 0 0 0 20.416-3.904l448-256a31.968 31.968 0 0 0-11.072-59.424l-420.576-64a32.96 32.96 0 0 0-20 3.424l-475.424 256a31.872 31.872 0 0 0-8.032 6.144C29.536 320 0 365.088 0 413.888c0 38.72 16.736 73.12 42.752 96.96C16.352 535.328 0 569.792 0 605.888c0 38.656 16.704 73.024 42.656 96.864C16.32 727.04 0 761.28 0 797.888c0 70.848 54.976 128.672 123.104 130.08l416.032 63.648a31.456 31.456 0 0 0 20.736-3.84l448-256a32 32 0 0 0-31.744-55.552l-438.304 250.464L130.56 864.384A30.72 30.72 0 0 0 125.728 864C91.68 864 64 834.336 64 797.888c0-28.064 20.128-54.72 47.872-63.328zM508.64 145.696l70.752-35.36c15.744-7.872 42.88-12.288 60.288-9.792l160.672 22.944c17.408 2.496 18.784 10.976 3.04 18.848l-70.752 35.36c-15.744 7.872-42.88 12.288-60.288 9.792l-160.672-22.944c-17.44-2.528-18.816-10.976-3.04-18.848z"
+      p-id="2574"
+      fill="currentColor"
+    ></path>
+  </svg>
+);
+
 export const DictIcon = (props: Partial<CustomIconComponentProps>) => (
   <Icon component={DictSvg} {...props} />
 );
@@ -417,3 +491,19 @@ export const TemplateOutlinedIcon = (
 export const CommentOutlinedIcon = (
   props: Partial<CustomIconComponentProps>
 ) => <Icon component={CommentOutLined} {...props} />;
+
+export const TranslationOutLinedIcon = (
+  props: Partial<CustomIconComponentProps>
+) => <Icon component={TranslationOutLined} {...props} />;
+
+export const OverviewOutLinedIcon = (
+  props: Partial<CustomIconComponentProps>
+) => <Icon component={OverviewOutLined} {...props} />;
+
+export const CourseOutLinedIcon = (
+  props: Partial<CustomIconComponentProps>
+) => <Icon component={CourseOutLined} {...props} />;
+
+export const AnthologyOutLinedIcon = (
+  props: Partial<CustomIconComponentProps>
+) => <Icon component={AnthologyOutLined} {...props} />;

+ 12 - 6
dashboard/src/components/blog/BlogNav.tsx

@@ -1,8 +1,14 @@
 import { Link } from "react-router-dom";
 import { useIntl } from "react-intl";
-import { MailOutlined } from "@ant-design/icons";
+import { HomeOutlined } from "@ant-design/icons";
 import type { MenuProps } from "antd";
 import { Menu, Row, Col } from "antd";
+import {
+  AnthologyOutLinedIcon,
+  CourseOutLinedIcon,
+  TermOutlinedIcon,
+  TranslationOutLinedIcon,
+} from "../../assets/icon";
 
 interface IWidgetBlogNav {
   selectedKey: string;
@@ -21,7 +27,7 @@ const BlogNavWidget = ({ selectedKey, studio }: IWidgetBlogNav) => {
         </Link>
       ),
       key: "overview",
-      icon: <MailOutlined />,
+      icon: <HomeOutlined />,
     },
     {
       label: (
@@ -30,7 +36,7 @@ const BlogNavWidget = ({ selectedKey, studio }: IWidgetBlogNav) => {
         </Link>
       ),
       key: "palicanon",
-      icon: <MailOutlined />,
+      icon: <TranslationOutLinedIcon />,
     },
     {
       label: (
@@ -39,7 +45,7 @@ const BlogNavWidget = ({ selectedKey, studio }: IWidgetBlogNav) => {
         </Link>
       ),
       key: "course",
-      icon: <MailOutlined />,
+      icon: <CourseOutLinedIcon />,
     },
     {
       label: (
@@ -48,7 +54,7 @@ const BlogNavWidget = ({ selectedKey, studio }: IWidgetBlogNav) => {
         </Link>
       ),
       key: "anthology",
-      icon: <MailOutlined />,
+      icon: <AnthologyOutLinedIcon />,
     },
     {
       label: (
@@ -57,7 +63,7 @@ const BlogNavWidget = ({ selectedKey, studio }: IWidgetBlogNav) => {
         </Link>
       ),
       key: "term",
-      icon: <MailOutlined />,
+      icon: <TermOutlinedIcon />,
     },
   ];
   return (

+ 5 - 2
dashboard/src/components/corpus/TocPath.tsx

@@ -21,6 +21,7 @@ interface IWidgetTocPath {
   trigger?: React.ReactNode;
   link?: ELinkType;
   channel?: string[];
+  style?: React.CSSProperties;
   onChange?: Function;
 }
 const TocPathWidget = ({
@@ -28,13 +29,15 @@ const TocPathWidget = ({
   trigger,
   link = "self",
   channel,
+  style,
   onChange,
 }: IWidgetTocPath): JSX.Element => {
   const navigate = useNavigate();
   const [searchParams, setSearchParams] = useSearchParams();
-
   const fullPath = (
-    <Breadcrumb style={{ whiteSpace: "nowrap", width: "100%" }}>
+    <Breadcrumb
+      style={{ whiteSpace: "nowrap", width: "100%", fontSize: style?.fontSize }}
+    >
       {data.map((item, id) => {
         return (
           <Breadcrumb.Item

+ 42 - 23
dashboard/src/components/fts/FullTextSearchResult.tsx

@@ -5,6 +5,7 @@ import { Link } from "react-router-dom";
 import { get } from "../../request";
 import TocPath, { ITocPathNode } from "../corpus/TocPath";
 import Marked from "../general/Marked";
+import PaliText from "../template/Wbw/PaliText";
 import "./search.css";
 
 const { Title, Text } = Typography;
@@ -21,7 +22,7 @@ interface IFtsData {
 }
 interface IFtsResponse {
   ok: boolean;
-  string: string;
+  message: string;
   data: {
     rows: IFtsData[];
     count: number;
@@ -100,6 +101,8 @@ const FullTxtSearchResultWidget = ({
         });
         setFtsData(result);
         setTotal(json.data.count);
+      } else {
+        console.error(json.message);
       }
     });
   }, [bookId, currPage, keyWord, match, orderBy, pageType, tags, view]);
@@ -122,28 +125,44 @@ const FullTxtSearchResultWidget = ({
           return `结果: ${total}`;
         },
       }}
-      renderItem={(item) => (
-        <List.Item>
-          <Title level={5}>
-            <Link
-              to={`/article/para/${item.book}-${item.paragraph}?book=${item.book}&par=${item.paragraph}`}
-            >
-              {item.title}
-            </Link>
-          </Title>
-          <div>
-            <Text type="secondary">{item.paliTitle}</Text>
-          </div>
-          <Space>
-            <TocPath data={item.path} />
-            {"/"}
-            <Tag>{item.paragraph}</Tag>
-          </Space>
-          <div>
-            <Marked className="search_content" text={item.content} />
-          </div>
-        </List.Item>
-      )}
+      renderItem={(item) => {
+        const paragraph = [
+          item.paragraph - 1,
+          item.paragraph,
+          item.paragraph + 1,
+        ];
+        return (
+          <List.Item>
+            <div>
+              <PaliText text={item.path ? item.path[0].title : ""} />
+            </div>
+            <div>
+              <Space style={{ color: "gray", fontSize: "80%" }}>
+                <TocPath
+                  data={item.path?.slice(1)}
+                  style={{ fontSize: "80%" }}
+                />
+                {"/"}
+                <Tag style={{ fontSize: "80%" }}>{item.paragraph}</Tag>
+              </Space>
+            </div>
+            <Title level={4} style={{ fontWeight: 500 }}>
+              <Link
+                to={`/article/para/${item.book}-${item.paragraph}?book=${item.book}&par=${paragraph}&focus=${item.paragraph}`}
+              >
+                {item.title}
+              </Link>
+            </Title>
+            <div style={{ display: "none" }}>
+              <Text type="secondary">{item.paliTitle}</Text>
+            </div>
+
+            <div>
+              <Marked className="search_content" text={item.content} />
+            </div>
+          </List.Item>
+        );
+      }}
     />
   );
 };