import React from 'react';
import { Space } from 'antd';
// @ts-ignore
import { SelectLang } from 'umi';
import Avatar from './AvatarDropdown';
import styles from './index.less';
import NoticeIcon from '../NoticeIcon/NoticeIcon';
import EnvTag from '../EnvTag';
import { getDefaultSettings } from '../../utils/utils';
import Handbook from './Handbook';

export type SiderTheme = 'light' | 'dark';

const GlobalHeaderRight: React.FC<{}> = (props) => {
  const { navTheme, layout, rightRenderItems } = getDefaultSettings();
  let className = styles.right;

  if ((navTheme === 'dark' && layout === 'top') || layout === 'mix') {
    className = `${styles.right}  ${styles.dark}`;
  }

  let extraItems = null;
  if (rightRenderItems) {
    extraItems = rightRenderItems(props);
  }

  return (
    <Space className={className}>
      {extraItems}
      <NoticeIcon />
      <Handbook />
      <Avatar menu />
      <EnvTag />
      <SelectLang className={styles.action} />
    </Space>
  );
};
export default GlobalHeaderRight;
