Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion client/sidebar/RoomList/SideBarItemTemplateWithData.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { memo } from 'react';

import { roomTypes } from '../../../app/utils/client';
import RoomMenu from '../RoomMenu';
import { useSidebarClose } from '../hooks/useSidebarDisplay';
Comment thread
tassoevan marked this conversation as resolved.
Outdated
import SidebarIcon from './SidebarIcon';
import { normalizeSidebarMessage } from './normalizeSidebarMessage';

Expand Down Expand Up @@ -37,8 +38,10 @@ function SideBarItemTemplateWithData({
sidebarViewMode,
isAnonymous,
}) {
const title = roomTypes.getRoomName(room.t, room);
const { closeSidebar } = useSidebarClose();

const href = roomTypes.getRouteLink(room.t, room);
const title = roomTypes.getRoomName(room.t, room);

const {
lastMessage,
Expand Down Expand Up @@ -90,6 +93,7 @@ function SideBarItemTemplateWithData({
threadUnread={threadUnread}
selected={selected}
href={href}
onClick={() => !selected && closeSidebar()}
aria-label={title}
title={title}
time={lastMessage?.ts}
Expand Down
19 changes: 19 additions & 0 deletions client/sidebar/hooks/useSidebarDisplay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const useSidebarClose = (): {
Comment thread
dougfabris marked this conversation as resolved.
closeSidebar: () => void;
} => {
const closeSidebar = (): void => {
const sidebarWrap = $('.sidebar-wrap');
const sidebar = $('.sidebar');
const wrapper = $('.messages-box > .wrapper');

sidebarWrap.css('width', '');
sidebarWrap.css('background-color', '');
sidebar.css('transform', '');
sidebar.css('box-shadow', '');
sidebar.css('transition', '');
sidebarWrap.css('transition', '');
wrapper && wrapper.css('overflow', '');
};

return { closeSidebar };
};
1 change: 1 addition & 0 deletions client/views/room/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const Header = ({ room }) => {
}),
[isMobile],
);

if (isEmbedded && !showTopNavbarEmbeddedLayout) {
return null;
}
Expand Down