Skip to content

Commit

Permalink
fix: only show chatbox if enabled in item settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-Torrent committed Oct 11, 2021
1 parent a6b85c8 commit b2ecbc0
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions src/components/common/SideContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ export default function SideContent({ children, item }) {
[classes.contentShift]: (isChatboxMenuOpen || isPinnedMenuOpen),
})}
>
<IconButton
className={classes.iconButton}
aria-label="open drawer"
onClick={toggleChatOpen}
>
<ForumIcon />
</IconButton>
{
item.get('settings').showChatbox ?
<IconButton
className={classes.iconButton}
aria-label="open drawer"
onClick={toggleChatOpen}
>
<ForumIcon />
</IconButton>
: undefined
}

<IconButton
className={classes.iconButton}
Expand All @@ -107,18 +111,22 @@ export default function SideContent({ children, item }) {
{children}
</main>

<Paper square>
<Slide anchor="right" direction="left" in={isChatboxMenuOpen} mountOnEnter unmountOnExit minHeight={window.innerHeight - HEADER_HEIGHT}>
<Box className={classes.drawer}>
<div className={classes.drawerHeader}>
<IconButton onClick={toggleChatOpen}>
{theme.direction === 'rtl' ? <ChevronLeftIcon /> : <ChevronRightIcon />}
</IconButton>
</div>
<Chatbox item={item} />
</Box>
</Slide>
</Paper>
{
item.get('settings').showChatbox ?
<Paper square>
<Slide anchor="right" direction="left" in={isChatboxMenuOpen} mountOnEnter unmountOnExit minHeight={window.innerHeight - HEADER_HEIGHT}>
<Box className={classes.drawer}>
<div className={classes.drawerHeader}>
<IconButton onClick={toggleChatOpen}>
{theme.direction === 'rtl' ? <ChevronLeftIcon /> : <ChevronRightIcon />}
</IconButton>
</div>
<Chatbox item={item} />
</Box>
</Slide>
</Paper>
: undefined
}

<Paper square>
<Slide anchor="right" direction="left" in={isPinnedMenuOpen} mountOnEnter unmountOnExit minHeight={window.innerHeight - HEADER_HEIGHT}>
Expand Down

0 comments on commit b2ecbc0

Please sign in to comment.