import { Affix, Button, Space, Tabs } from "antd"; import { useEffect, useState } from "react"; import { CloseOutlined } from "@ant-design/icons"; import { FullscreenOutlined, FullscreenExitOutlined } from "@ant-design/icons"; import type { IChannel } from "../channel/Channel"; import DictComponent from "../dict/DictComponent"; import type { ArticleType } from "./Article"; import { useAppSelector } from "../../hooks"; import { openPanel, rightPanel } from "../../reducers/right-panel"; import store from "../../store"; import DiscussionBox from "../discussion/DiscussionBox"; import { show } from "../../reducers/discussion"; import { useIntl } from "react-intl"; import SuggestionBox from "../template/SentEdit/SuggestionBox"; import ChannelMy from "../channel/ChannelMy"; import GrammarBook from "../term/GrammarBook"; interface IWidget { curr?: TPanelName; type: ArticleType; articleId: string; selectedChannelsId?: string[]; onChannelSelect?: Function; onClose?: Function; onTabChange?: Function; } const RightPanelWidget = ({ curr = "close", type, articleId, onChannelSelect, selectedChannelsId, onClose, onTabChange, }: IWidget) => { const [open, setOpen] = useState(false); const [activeTab, setActiveTab] = useState("dict"); const _openPanel = useAppSelector(rightPanel); const intl = useIntl(); const divMinWidth = 400; const divMaxWidth = 700; const [divWidth, setDivWidth] = useState(divMinWidth); const tabInnerStyle: React.CSSProperties = { width: "100%", height: `calc(100vh - 96px)`, overflowY: "scroll", }; useEffect(() => { console.log("panel", _openPanel); if (typeof _openPanel !== "undefined") { if (typeof onTabChange !== "undefined") { onTabChange(_openPanel); } store.dispatch(openPanel(undefined)); } }, [_openPanel]); useEffect(() => { switch (curr) { case "open": setOpen(true); break; case "dict": setOpen(true); setActiveTab(curr); break; case "channel": setOpen(true); setActiveTab(curr); break; case "discussion": setOpen(true); setActiveTab(curr); break; case "suggestion": setOpen(true); setActiveTab(curr); break; case "grammar": setOpen(true); setActiveTab(curr); break; case "close": setOpen(false); break; default: setOpen(false); break; } }, [curr]); return (
setActiveTab(activeKey)} tabBarExtraContent={{ right: ( {divWidth === divMinWidth ? (
); }; export default RightPanelWidget;