import { QuestionCircleOutlined } from '@ant-design/icons';
import { css } from '@emotion/css';
import { Dropdown, Menu, Popover } from 'antd';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { DropdownVisibleContext, usePlugin, useToken } from '..';
import { useCurrentAppInfo } from '../appInfo/CurrentAppInfoProvider';
import { observer } from '@formily/reactive-react';
import { parseHTML } from '@nocobase/utils/client';
/**
* @note If you want to change here, Note the Setting block on the mobile side
*/
const SettingsMenu: React.FC<{
redirectUrl?: string;
}> = () => {
const { t } = useTranslation();
const data = useCurrentAppInfo();
const { token } = useToken();
// 是否是简体中文
const isSimplifiedChinese = data?.data?.lang === 'zh-CN';
const items = [
{
key: 'nocobase',
disabled: true,
label: (
NocoBase
v{data?.data?.version}
),
},
{
key: 'divider_1',
type: 'divider',
},
{
key: 'homePage',
label: (
{t('Home page')}
),
},
{
key: 'userManual',
label: (
{t('Handbook')}
),
},
{
key: 'license',
label: (
{t('License')}
),
},
];
return ;
};
const helpClassName = css`
display: inline-block;
vertical-align: top;
width: 46px;
height: 46px;
&:hover {
background: rgba(255, 255, 255, 0.1) !important;
}
`;
export const Help = observer(
() => {
const [visible, setVisible] = useState(false);
const { token } = useToken();
const customBrandPlugin: any = usePlugin('@nocobase/plugin-custom-brand');
const data = useCurrentAppInfo();
const icon = (
);
if (customBrandPlugin?.options?.options?.about) {
const appVersion = `v${data?.data?.version}`;
const content = parseHTML(customBrandPlugin.options.options.about, { appVersion });
return (
}
>
{icon}
);
}
return (
{
setVisible(visible);
}}
dropdownRender={() => {
return ;
}}
>
{icon}
);
},
{ displayName: 'Help' },
);