import { useIntl } from "react-intl"; import { Badge, Button, Dropdown, Space } from "antd"; import { MoreOutlined, CheckOutlined } from "@ant-design/icons"; import type { MenuProps } from "antd"; import RelatedPara from "../../corpus/RelatedPara"; import type { ArticleMode } from "../../article/Article" interface IWidget { book?: number; para?: number; loading?: boolean; mode?: ArticleMode; onMagicDict?: Function; onMenuClick?: Function; } const SentMenuWidget = ({ book, para, mode, loading = false, onMagicDict, onMenuClick, }: IWidget) => { const intl = useIntl(); const items: MenuProps["items"] = [ { key: "show-commentary", label: , }, { key: "show-nissaya", label: "Nissaya", }, { key: "copy-id", label: intl.formatMessage({ id: "buttons.copy.id" }), }, { key: "copy-link", label: intl.formatMessage({ id: "buttons.copy.link" }), }, { key: "affix", label: "总在最顶端开/关", }, { type: "divider", }, { key: "origin", label: "原文模式", children: [ { key: "origin-auto", label: "自动", icon: ( ), }, { key: "origin-edit", label: "翻译", icon: ( ), }, { key: "origin-wbw", label: "逐词", icon: ( ), }, ], }, { key: "compact", label: ( {intl.formatMessage({ id: "buttons.compact" })} ), }, { key: "normal", label: "正常", }, ]; const onClick: MenuProps["onClick"] = ({ key }) => { console.log(`Click on item ${key}`); if (typeof onMenuClick !== "undefined") { onMenuClick(key); } switch (key) { case "magic-dict-current": if (typeof onMagicDict !== "undefined") { onMagicDict("current"); } break; default: break; } }; return (