index.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import Grid from '@mui/material/Grid'
  2. import { makeStyles } from '@material-ui/core'
  3. import { useSelector } from 'react-redux'
  4. import LeftBar from './LeftBar'
  5. import CentralBar from './CentralBar'
  6. import RightBar from './RightBar'
  7. import { getRightIsOpen } from '../../redux/control/selector'
  8. import { getChatMemo } from '../../redux/chat/selector'
  9. const useStyles = makeStyles({
  10. container: {
  11. minHeight: '100vh',
  12. maxHeight: '100vh',
  13. },
  14. centralAndRight: {
  15. display:'flex'
  16. },
  17. centralBar: {
  18. background: 'linear-gradient(to bottom right, #e7f097 , #b1e667,#f4f75e)',
  19. },
  20. })
  21. const HomePage = () => {
  22. const classes = useStyles()
  23. const rightIsOpen = useSelector(getRightIsOpen)
  24. const { companionId } = useSelector(getChatMemo)
  25. return (
  26. <Grid className={classes.container} container spacing={0} >
  27. <LeftBar />
  28. {companionId ?
  29. <Grid item lg={9} className={classes.centralAndRight}>
  30. <CentralBar rightIsOpen={rightIsOpen}/>
  31. <RightBar rightIsOpen={rightIsOpen}/>
  32. </Grid> :
  33. <Grid item lg={9} className={classes.centralBar}/>}
  34. </Grid>
  35. )
  36. }
  37. export default HomePage