UNPKG

general-assistant

Version:

General Assistant components

31 lines (30 loc) 1.96 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useTranslation } from 'react-i18next'; import { useStore } from 'zustand'; import StoreContext from '../_store/StoreContext'; import { useEffect, useContext } from 'react'; import classNames from 'classnames'; export default function ChatHolder() { const { t } = useTranslation(); const dataStore = useContext(StoreContext); const { _getTemCreate, myHistoryList, topic, setConfig, myTopicOpened, } = useStore(dataStore, (state) => ({ _getTemCreate: state._getTemCreate, myHistoryList: state.myHistoryList, topic: state.topic, setConfig: state.setConfig, myTopicOpened: state.myTopicOpened, })); useEffect(() => { setConfig({ inputProps: { isShowInput: !!myHistoryList.length && myTopicOpened !== null, }, }); }, [myHistoryList.length, myTopicOpened]); return ((myHistoryList.length === 0 || myTopicOpened == null) && (_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-z-[1] DS-GA-bg-area-shal DS-GA-text-center DS-GA-text-theme-midd-9', 'DS-GA-text-base DS-GA-flex DS-GA-flex-col DS-GA-justify-center DS-GA-items-center DS-GA-gap-2', 'md:DS-GA-text-xl md:DS-GA-flex-row', 'lg:DS-GA-text-2xl lg:DS-GA-flex-row'), children: [_jsx("span", { className: 'DS-GA-mr-1', children: t('chatholder01') }), _jsxs("div", { className: 'DS-GA-w-fit DS-GA-px-6 DS-GA-py-1 DS-GA-rounded-md DS-GA-shadow-lg DS-GA-cursor-pointer', onClick: async () => { const _flag = await _getTemCreate().onClick(); if (!_flag) return; topic.open(topic.getList()[0].id); }, children: [_jsx("i", { className: 'iconfont-assistant icon-add DS-GA-mr-2' }), _jsx("span", { className: 'DS-GA-ml-1', children: t('chatholder02') })] })] }))); }