index.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { Space } from 'antd';
  2. import { QuestionCircleOutlined } from '@ant-design/icons';
  3. import React, { useEffect } from 'react';
  4. import { SelectLang, useModel } from 'umi';
  5. import Avatar from './AvatarDropdown';
  6. import styles from './index.less';
  7. import useSendWebsocketMessage from '@/hooks/websocket/useSendWebsocketMessage';
  8. import { Store } from 'jetlinks-store';
  9. import NoticeIcon from '../NoticeIcon';
  10. // export type SiderTheme = 'light' | 'dark';
  11. const GlobalHeaderRight: React.FC = () => {
  12. const { initialState } = useModel('@@initialState');
  13. const [subscribeTopic] = useSendWebsocketMessage();
  14. useEffect(() => {
  15. Store.set('sendMessage', subscribeTopic);
  16. }, []);
  17. if (!initialState || !initialState.settings) {
  18. return null;
  19. }
  20. const { navTheme, layout } = initialState.settings;
  21. let className = styles.right;
  22. if ((navTheme === 'dark' && layout === 'top') || layout === 'mix') {
  23. className = `${styles.right} ${styles.dark}`;
  24. }
  25. return (
  26. <Space className={className}>
  27. {/*<HeaderSearch*/}
  28. {/* className={`${styles.action} ${styles.search}`}*/}
  29. {/* placeholder="站内搜索"*/}
  30. {/* defaultValue="umi ui"*/}
  31. {/* options={[*/}
  32. {/* { label: <a href="https://umijs.org/zh/guide/umi-ui.html">umi ui</a>, value: 'umi ui' },*/}
  33. {/* {*/}
  34. {/* label: <a href="https://ant.design/">Ant Design</a>,*/}
  35. {/* value: 'Ant Design',*/}
  36. {/* },*/}
  37. {/* {*/}
  38. {/* label: <a href="https://protable.ant.design/">Pro Table</a>,*/}
  39. {/* value: 'Pro Table',*/}
  40. {/* },*/}
  41. {/* {*/}
  42. {/* label: <a href="https://prolayout.ant.design/">Pro Layout</a>,*/}
  43. {/* value: 'Pro Layout',*/}
  44. {/* },*/}
  45. {/* ]}*/}
  46. {/* // onSearch={value => {*/}
  47. {/* // console.log('input', value);*/}
  48. {/* // }}*/}
  49. {/*/>*/}
  50. <span
  51. className={styles.action}
  52. onClick={() => {
  53. window.open('http://doc.jetlinks.cn');
  54. }}
  55. >
  56. <QuestionCircleOutlined />
  57. </span>
  58. <span>
  59. <NoticeIcon />
  60. </span>
  61. <Avatar menu={true} />
  62. <SelectLang className={styles.action} />
  63. </Space>
  64. );
  65. };
  66. export default GlobalHeaderRight;