|
@@ -1,17 +1,16 @@
|
|
|
import { useState } from "react";
|
|
import { useState } from "react";
|
|
|
-import { Badge, Tabs } from "antd";
|
|
|
|
|
|
|
+import { Badge, Tabs, Typography } from "antd";
|
|
|
import {
|
|
import {
|
|
|
TranslationOutlined,
|
|
TranslationOutlined,
|
|
|
- BookOutlined,
|
|
|
|
|
CloseOutlined,
|
|
CloseOutlined,
|
|
|
BlockOutlined,
|
|
BlockOutlined,
|
|
|
} from "@ant-design/icons";
|
|
} from "@ant-design/icons";
|
|
|
-import { useIntl } from "react-intl";
|
|
|
|
|
|
|
+
|
|
|
import { IWidgetSentEditInner } from "../SentEdit";
|
|
import { IWidgetSentEditInner } from "../SentEdit";
|
|
|
import Article from "../../article/Article";
|
|
import Article from "../../article/Article";
|
|
|
|
|
+import SentTabButton from "./SentTabButton";
|
|
|
|
|
|
|
|
-import store from "../../../store";
|
|
|
|
|
-import openArticle, { IOpenArticle } from "../../../reducers/open-article";
|
|
|
|
|
|
|
+const { Text } = Typography;
|
|
|
|
|
|
|
|
const Widget = ({
|
|
const Widget = ({
|
|
|
id,
|
|
id,
|
|
@@ -22,21 +21,16 @@ const Widget = ({
|
|
|
originNum,
|
|
originNum,
|
|
|
simNum,
|
|
simNum,
|
|
|
}: IWidgetSentEditInner) => {
|
|
}: IWidgetSentEditInner) => {
|
|
|
- const intl = useIntl();
|
|
|
|
|
-
|
|
|
|
|
const [translationActive, setTranslationActive] = useState<boolean>(false);
|
|
const [translationActive, setTranslationActive] = useState<boolean>(false);
|
|
|
const [nissayaActive, setNissayaActive] = useState<boolean>(false);
|
|
const [nissayaActive, setNissayaActive] = useState<boolean>(false);
|
|
|
const [commentaryActive, setCommentaryActive] = useState<boolean>(false);
|
|
const [commentaryActive, setCommentaryActive] = useState<boolean>(false);
|
|
|
const [originalActive, setOriginalActive] = useState<boolean>(false);
|
|
const [originalActive, setOriginalActive] = useState<boolean>(false);
|
|
|
|
|
+ const sentId = id.split("_");
|
|
|
|
|
+
|
|
|
const onChange = (key: string) => {
|
|
const onChange = (key: string) => {
|
|
|
switch (key) {
|
|
switch (key) {
|
|
|
case "translation":
|
|
case "translation":
|
|
|
setTranslationActive(true);
|
|
setTranslationActive(true);
|
|
|
- const it: IOpenArticle = {
|
|
|
|
|
- type: "corpus_sent/translation",
|
|
|
|
|
- articleId: id,
|
|
|
|
|
- };
|
|
|
|
|
- store.dispatch(openArticle(it));
|
|
|
|
|
break;
|
|
break;
|
|
|
case "nissaya":
|
|
case "nissaya":
|
|
|
setNissayaActive(true);
|
|
setNissayaActive(true);
|
|
@@ -50,109 +44,103 @@ const Widget = ({
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
return (
|
|
return (
|
|
|
- <Tabs
|
|
|
|
|
- size="small"
|
|
|
|
|
- onChange={onChange}
|
|
|
|
|
- items={[
|
|
|
|
|
- {
|
|
|
|
|
- label: (
|
|
|
|
|
- <Badge size="small" count={0}>
|
|
|
|
|
- <CloseOutlined />
|
|
|
|
|
- </Badge>
|
|
|
|
|
- ),
|
|
|
|
|
- key: "close",
|
|
|
|
|
- children: <></>,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: (
|
|
|
|
|
- <Badge size="small" count={tranNum ? tranNum : 0}>
|
|
|
|
|
- <TranslationOutlined />
|
|
|
|
|
- {intl.formatMessage({
|
|
|
|
|
- id: "channel.type.translation.label",
|
|
|
|
|
- })}
|
|
|
|
|
- </Badge>
|
|
|
|
|
- ),
|
|
|
|
|
- key: "translation",
|
|
|
|
|
- children: (
|
|
|
|
|
- <Article
|
|
|
|
|
- active={translationActive}
|
|
|
|
|
- type="corpus_sent/translation"
|
|
|
|
|
- articleId={id}
|
|
|
|
|
- mode="edit"
|
|
|
|
|
- showModeSwitch={false}
|
|
|
|
|
- showMainMenu={false}
|
|
|
|
|
- showContextMenu={false}
|
|
|
|
|
- />
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: (
|
|
|
|
|
- <Badge size="small" count={nissayaNum ? nissayaNum : 0}>
|
|
|
|
|
- <BookOutlined />
|
|
|
|
|
- {intl.formatMessage({
|
|
|
|
|
- id: "channel.type.nissaya.label",
|
|
|
|
|
- })}
|
|
|
|
|
- </Badge>
|
|
|
|
|
- ),
|
|
|
|
|
- key: "nissaya",
|
|
|
|
|
- children: (
|
|
|
|
|
- <Article
|
|
|
|
|
- active={nissayaActive}
|
|
|
|
|
- type="corpus_sent/nissaya"
|
|
|
|
|
- articleId={id}
|
|
|
|
|
- mode="edit"
|
|
|
|
|
- showModeSwitch={false}
|
|
|
|
|
- showMainMenu={false}
|
|
|
|
|
- showContextMenu={false}
|
|
|
|
|
- />
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: (
|
|
|
|
|
- <Badge size="small" count={commNum ? commNum : 0}>
|
|
|
|
|
- <BlockOutlined />
|
|
|
|
|
- {intl.formatMessage({
|
|
|
|
|
- id: "channel.type.commentary.label",
|
|
|
|
|
- })}
|
|
|
|
|
- </Badge>
|
|
|
|
|
- ),
|
|
|
|
|
- key: "commentary",
|
|
|
|
|
- children: (
|
|
|
|
|
- <Article
|
|
|
|
|
- active={commentaryActive}
|
|
|
|
|
- type="corpus_sent/commentary"
|
|
|
|
|
- articleId={id}
|
|
|
|
|
- mode="edit"
|
|
|
|
|
- showModeSwitch={false}
|
|
|
|
|
- showMainMenu={false}
|
|
|
|
|
- showContextMenu={false}
|
|
|
|
|
- />
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: (
|
|
|
|
|
- <Badge size="small" count={originNum ? originNum : 0}>
|
|
|
|
|
- <BlockOutlined />
|
|
|
|
|
- {intl.formatMessage({
|
|
|
|
|
- id: "channel.type.original.label",
|
|
|
|
|
- })}
|
|
|
|
|
- </Badge>
|
|
|
|
|
- ),
|
|
|
|
|
- key: "original",
|
|
|
|
|
- children: (
|
|
|
|
|
- <Article
|
|
|
|
|
- active={originalActive}
|
|
|
|
|
- type="corpus_sent/original"
|
|
|
|
|
- articleId={id}
|
|
|
|
|
- mode="edit"
|
|
|
|
|
- showModeSwitch={false}
|
|
|
|
|
- showMainMenu={false}
|
|
|
|
|
- showContextMenu={false}
|
|
|
|
|
- />
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
- ]}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Tabs
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ tabBarGutter={0}
|
|
|
|
|
+ onChange={onChange}
|
|
|
|
|
+ tabBarExtraContent={
|
|
|
|
|
+ <Text copyable={{ text: sentId[0] }}>{sentId[0]}</Text>
|
|
|
|
|
+ }
|
|
|
|
|
+ items={[
|
|
|
|
|
+ {
|
|
|
|
|
+ label: (
|
|
|
|
|
+ <Badge size="small" count={0}>
|
|
|
|
|
+ <CloseOutlined />
|
|
|
|
|
+ </Badge>
|
|
|
|
|
+ ),
|
|
|
|
|
+ key: "close",
|
|
|
|
|
+ children: <></>,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: (
|
|
|
|
|
+ <SentTabButton
|
|
|
|
|
+ icon={<TranslationOutlined />}
|
|
|
|
|
+ type="translation"
|
|
|
|
|
+ sentId={id}
|
|
|
|
|
+ count={tranNum}
|
|
|
|
|
+ />
|
|
|
|
|
+ ),
|
|
|
|
|
+ key: "translation",
|
|
|
|
|
+ children: (
|
|
|
|
|
+ <Article
|
|
|
|
|
+ active={translationActive}
|
|
|
|
|
+ type="corpus_sent/translation"
|
|
|
|
|
+ articleId={id}
|
|
|
|
|
+ mode="edit"
|
|
|
|
|
+ />
|
|
|
|
|
+ ),
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: (
|
|
|
|
|
+ <SentTabButton
|
|
|
|
|
+ icon={<CloseOutlined />}
|
|
|
|
|
+ type="nissaya"
|
|
|
|
|
+ sentId={id}
|
|
|
|
|
+ count={nissayaNum}
|
|
|
|
|
+ />
|
|
|
|
|
+ ),
|
|
|
|
|
+ key: "nissaya",
|
|
|
|
|
+ children: (
|
|
|
|
|
+ <Article
|
|
|
|
|
+ active={nissayaActive}
|
|
|
|
|
+ type="corpus_sent/nissaya"
|
|
|
|
|
+ articleId={id}
|
|
|
|
|
+ mode="edit"
|
|
|
|
|
+ />
|
|
|
|
|
+ ),
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: (
|
|
|
|
|
+ <SentTabButton
|
|
|
|
|
+ icon={<TranslationOutlined />}
|
|
|
|
|
+ type="commentary"
|
|
|
|
|
+ sentId={id}
|
|
|
|
|
+ count={commNum}
|
|
|
|
|
+ />
|
|
|
|
|
+ ),
|
|
|
|
|
+ key: "commentary",
|
|
|
|
|
+ children: (
|
|
|
|
|
+ <Article
|
|
|
|
|
+ active={commentaryActive}
|
|
|
|
|
+ type="corpus_sent/commentary"
|
|
|
|
|
+ articleId={id}
|
|
|
|
|
+ mode="edit"
|
|
|
|
|
+ />
|
|
|
|
|
+ ),
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: (
|
|
|
|
|
+ <SentTabButton
|
|
|
|
|
+ icon={<BlockOutlined />}
|
|
|
|
|
+ type="original"
|
|
|
|
|
+ sentId={id}
|
|
|
|
|
+ count={originNum}
|
|
|
|
|
+ />
|
|
|
|
|
+ ),
|
|
|
|
|
+ key: "original",
|
|
|
|
|
+ children: (
|
|
|
|
|
+ <Article
|
|
|
|
|
+ active={originalActive}
|
|
|
|
|
+ type="corpus_sent/original"
|
|
|
|
|
+ articleId={id}
|
|
|
|
|
+ mode="edit"
|
|
|
|
|
+ />
|
|
|
|
|
+ ),
|
|
|
|
|
+ },
|
|
|
|
|
+ ]}
|
|
|
|
|
+ />
|
|
|
|
|
+ </>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|