Skip to content

Commit

Permalink
Fix bug with test in sidebar for desktop, and in display chat
Browse files Browse the repository at this point in the history
  • Loading branch information
KostiantynU committed Jul 7, 2024
1 parent ea67403 commit 483175b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/common/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ const Sidebar = () => {
const isChatOpened = useSelector(selectChatOpened);

useEffect(() => {
if (pathname === PATH.HOME) {
setShowText(false);
setShowMenu(true);
} else {
setShowText(true);
}
// if (pathname === PATH.HOME) {
// setShowText(false);
// setShowMenu(true);
// } else {
// setShowText(true);
// }
// if (pathname.includes('chat')) {
// setShowText(false);
// } else {
// setShowText(true);
// }
if (isChatOpened) {
if (isChatOpened && pathname.includes('chat')) {
setShowText(false);
} else {
setShowText(true);
Expand Down
3 changes: 2 additions & 1 deletion src/common/Sidebar/Sidebar.styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ export const StyledContentBox = styled(Box, {
@media screen and (min-width: 768px) {
gap: 0;
position: absolute;
// position: absolute;
top: 167px;
left: 40px;
}
@media screen and (min-width: 1200px) {
top: 154px;
left: 80px;
position: absolute;
}
`;

Expand Down
5 changes: 4 additions & 1 deletion src/components/Chat/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
selectSubscribed,
toggleChatOpened,
selectChatOpened,
setChatOpened,
} from '../../redux/chatSlice';
import {
subscribeToMessages,
Expand Down Expand Up @@ -118,6 +119,7 @@ const Chat = ({ children }) => {
}

// dispatch(toggleChatOpened());
dispatch(setChatOpened(true));

return () => {
dispatch(unsubscribeFromMessages());
Expand All @@ -127,7 +129,8 @@ const Chat = ({ children }) => {
dispatch(clearNewMessages());
dispatch(clearNotifications());

dispatch(toggleChatOpened());
// dispatch(toggleChatOpened());
dispatch(setChatOpened(true));
};

// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit 483175b

Please sign in to comment.