general-assistant
Version:
General Assistant components
36 lines (35 loc) • 3.18 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import MyIconContainer from '../IconContainer';
import MyChatBox from '../ChatBox';
import ChatHolder from '../ChatHolder';
import classNames from 'classnames';
import { get, merge } from 'lodash';
import { useStore } from 'zustand';
import StoreContext from '../_store/StoreContext';
import { useState, useContext } from 'react';
const AreaCenter = () => {
const dataStore = useContext(StoreContext);
const { myTopicOpened, myHistoryList, isHorizontal, showAreaLeft, showAreaRight, getAreaCenter, GlobalCtxs, getConfig, } = useStore(dataStore, (state) => ({
myTopicOpened: state.myTopicOpened,
myHistoryList: state.myHistoryList,
isHorizontal: state.isHorizontal,
showAreaLeft: state.showAreaLeft,
showAreaRight: state.showAreaRight,
getAreaCenter: state.getAreaCenter,
GlobalCtxs: state.GlobalCtxs,
getConfig: state.getConfig,
}));
const _areaCenter = getAreaCenter();
const { title, showGuideIfNeed } = getConfig();
const { top, center, bottom: BottomRender } = _areaCenter === null ? {} : _areaCenter;
const _topicInfo = myHistoryList.find((item) => item.id === myTopicOpened);
const topicName = get(_topicInfo, 'title') || '';
const [pageXstart, setPageXstart] = useState(0);
const [pageYstart, setPageYstart] = useState(0);
return (_jsxs("div", { className: classNames('AreaCenterWrap', 'DS-GA-h-full DS-GA-grow DS-GA-flex DS-GA-flex-col DS-GA-bg-area-shal', isHorizontal && showAreaLeft ? 'DS-GA-absolute DS-GA-left-[330px] DS-GA-w-full DS-GA-animate-transLR' : '', isHorizontal && showAreaRight ? 'DS-GA-absolute DS-GA-right-[330px] DS-GA-w-full DS-GA-animate-transRL' : '', 'md:DS-GA-static md:DS-GA-animate-none'), children: [top && (_jsx(MyIconContainer, { container: merge({}, {
center: {
name: (_jsxs("div", { className: classNames('DS-GA-text-sm DS-GA-flex DS-GA-flex-col DS-GA-items-center DS-GA-justify-center', 'lg:DS-GA-flex-row'), children: [_jsx("span", { className: classNames('o-text !DS-GA-w-auto DS-GA-max-w-[200px]', 'md:DS-GA-max-w-[600px]', 'lg:DS-GA-max-w-[600px]'), children: topicName }), topicName ? _jsx("span", { className: classNames('DS-GA-mx-2 DS-GA-hidden', 'lg:DS-GA-inline-block'), children: "|" }) : '', title] }))
}
}, top), className: 'AreaCenterTitleWrap DS-GA-w-full DS-GA-h-14 DS-GA-border-b DS-GA-border-b-text-shal-9' })), center && (_jsx("div", { className: 'ChatWrap DS-GA-grow DS-GA-relative', children: _jsxs("div", { className: classNames('DS-GA-w-full DS-GA-h-full DS-GA-absolute DS-GA-top-0 DS-GA-left-0', 'DS-GA-flex DS-GA-flex-col DS-GA-justify-between'), children: [showGuideIfNeed && _jsx(ChatHolder, {}), _jsx(MyChatBox, { center: center })] }) })), typeof BottomRender === 'function' && GlobalCtxs && (_jsx("div", { className: 'DS-GA-max-w-p65 DS-GA-h-9 DS-GA-self-center DS-GA-text-xs DS-GA-text-text-shmi-9 DS-GA-flex DS-GA-justify-center DS-GA-items-center DS-GA-text-center', children: _jsx(BottomRender, { ctx: GlobalCtxs }) }))] }));
};
export default AreaCenter;