index.tsx 2.1 KB

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