Bläddra i källkod

Merge pull request #1849 from visuddhinanda/agile

按照输入顺序显示channel
visuddhinanda 2 år sedan
förälder
incheckning
1a46d77eb4

+ 5 - 1
dashboard/src/components/article/ToolButtonSetting.tsx

@@ -2,15 +2,19 @@ import { SettingOutlined } from "@ant-design/icons";
 import SettingArticle from "../auth/setting/SettingArticle";
 
 import ToolButton from "./ToolButton";
+import { useIntl } from "react-intl";
 
 interface IWidget {
   type?: string;
   articleId?: string;
 }
 const ToolButtonSettingWidget = ({ type, articleId }: IWidget) => {
+  const intl = useIntl();
   return (
     <ToolButton
-      title="设置"
+      title={intl.formatMessage({
+        id: `buttons.setting`,
+      })}
       icon={<SettingOutlined />}
       content={<SettingArticle />}
     />

+ 23 - 4
dashboard/src/components/auth/setting/SettingArticle.tsx

@@ -4,12 +4,18 @@ import { settingInfo } from "../../../reducers/setting";
 
 import { SettingFind } from "./default";
 import SettingItem from "./SettingItem";
+import { useIntl } from "react-intl";
 
 const SettingArticleWidget = () => {
   const settings = useAppSelector(settingInfo);
+  const intl = useIntl();
   return (
     <div>
-      <Divider>阅读</Divider>
+      <Divider>
+        {intl.formatMessage({
+          id: `buttons.read`,
+        })}
+      </Divider>
       <SettingItem data={SettingFind("setting.display.original", settings)} />
       <SettingItem data={SettingFind("setting.layout.direction", settings)} />
       <SettingItem data={SettingFind("setting.layout.paragraph", settings)} />
@@ -19,9 +25,17 @@ const SettingArticleWidget = () => {
       <SettingItem
         data={SettingFind("setting.pali.script.secondary", settings)}
       />
-      <Divider>翻译</Divider>
+      <Divider>
+        {intl.formatMessage({
+          id: `buttons.translate`,
+        })}
+      </Divider>
 
-      <Divider>逐词解析</Divider>
+      <Divider>
+        {intl.formatMessage({
+          id: `buttons.wbw`,
+        })}
+      </Divider>
       <Divider>Nissaya</Divider>
       <SettingItem
         data={SettingFind("setting.nissaya.layout.read", settings)}
@@ -29,7 +43,12 @@ const SettingArticleWidget = () => {
       <SettingItem
         data={SettingFind("setting.nissaya.layout.edit", settings)}
       />
-      <Divider>字典</Divider>
+
+      <Divider>
+        {intl.formatMessage({
+          id: `columns.library.dict.title`,
+        })}
+      </Divider>
       <SettingItem data={SettingFind("setting.dict.lang", settings)} />
     </div>
   );

+ 18 - 5
dashboard/src/components/auth/setting/SettingItem.tsx

@@ -78,7 +78,10 @@ const SettingItemWidget = ({
                       title: intl.formatMessage({ id: item.label }),
                     };
                   })}
-                  titles={["备选", "我的选择"]}
+                  titles={[
+                    "备选",
+                    intl.formatMessage({ id: "labels.selected" }),
+                  ]}
                   targetKeys={targetKeys}
                   onChange={(
                     newTargetKeys: string[],
@@ -203,11 +206,21 @@ const SettingItemWidget = ({
 
     return (
       <div style={{ marginBottom: 10 }}>
-        <div style={{ display: "flex", justifyContent: "space-between" }}>
-          <Text>{intl.formatMessage({ id: data.label })}</Text>
-          {content}
+        <div
+          style={{
+            display: "flex",
+            justifyContent: "space-between",
+            flexWrap: "wrap",
+          }}
+        >
+          <div>
+            <div>
+              <Text>{intl.formatMessage({ id: data.label })}</Text>
+            </div>
+            <Text type="secondary">{description}</Text>
+          </div>
+          <div style={{ marginLeft: "auto" }}>{content}</div>
         </div>
-        <Text type="secondary">{description}</Text>
       </div>
     );
   }

+ 8 - 4
dashboard/src/components/channel/ChannelMy.tsx

@@ -98,9 +98,13 @@ const ChannelMy = ({
       setTreeData(data);
     } else {
       //当前被选择的
-      const currChannel = channelList.filter((value) =>
-        selectedRowKeys.includes(value.uid)
-      );
+      let selectedChannel: IItem[] = [];
+      selectedRowKeys.forEach((channelId) => {
+        const channel = channelList.find((value) => value.uid === channelId);
+        if (channel) {
+          selectedChannel.push(channel);
+        }
+      });
       let show = selectedRowKeys;
       //有进度的
       const progressing = channelList.filter(
@@ -117,7 +121,7 @@ const ChannelMy = ({
         (value) => !show.includes(value.uid) && value.role !== "member"
       );
       const channelData = [
-        ...currChannel,
+        ...selectedChannel,
         ...progressing,
         ...myChannel,
         ...others,

+ 1 - 0
dashboard/src/locales/en-US/label.ts

@@ -31,6 +31,7 @@ const items = {
   "labels.curr.paragraph.quote.link.tpl": "引用链接模版",
   "labels.curr.paragraph.copy.quote.link.tpl": "复制引用模版",
   "labels.input": "input",
+  "labels.selected": "Selected",
 };
 
 export default items;

+ 1 - 1
dashboard/src/locales/zh-Hans/auth/index.ts

@@ -8,7 +8,7 @@ const items = {
   "auth.role.assistant": "助理老师",
   "auth.role.unknown": "未知",
   "auth.role.delete": "已删除",
-  "auth.role.reader": "阅读",
+  "auth.role.reader": "阅读",
   "auth.type.user": "用户",
   "auth.type.group": "群组",
 };

+ 1 - 0
dashboard/src/locales/zh-Hans/label.ts

@@ -31,6 +31,7 @@ const items = {
   "labels.curr.paragraph.quote.link.tpl": "引用链接模版",
   "labels.curr.paragraph.copy.quote.link.tpl": "复制引用模版",
   "labels.input": "请输入",
+  "labels.selected": "已经选择",
 };
 
 export default items;