index.tsx 752 B

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * index
  3. * @author: oldj
  4. * @homepage: https://oldj.net
  5. */
  6. import HostsEditor from '@renderer/components/Editor/HostsEditor'
  7. import useOnBroadcast from '@renderer/core/useOnBroadcast'
  8. import events from '@common/events'
  9. import React from 'react'
  10. import styles from './index.module.scss'
  11. import { useToast } from '@chakra-ui/react'
  12. const MainPanel = () => {
  13. const toast = useToast()
  14. useOnBroadcast(events.cmd_run_result, (result) => {
  15. // console.log(result)
  16. if (!result.success) {
  17. toast({
  18. status: 'error',
  19. description: result.stderr || 'cmd run error',
  20. isClosable: true,
  21. })
  22. }
  23. })
  24. return (
  25. <div className={styles.root}>
  26. <HostsEditor />
  27. </div>
  28. )
  29. }
  30. export default MainPanel