Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Render mini user menu for when space panel is disabled (#7258)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Dec 2, 2021
1 parent d3c556b commit 0a99be3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
5 changes: 5 additions & 0 deletions res/css/structures/_LeftPanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ $roomListCollapsedWidth: 68px;
display: flex;
align-items: center;

.mx_UserMenu {
// mini-mode for when Space Panel is disabled
margin-right: 12px;
}

& + .mx_RoomListHeader {
margin-top: 12px;
}
Expand Down
6 changes: 6 additions & 0 deletions res/css/structures/_SpacePanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ $activeBorderColor: $primary-content;
mask-image: linear-gradient(180deg, transparent, black 5%, black 95%, transparent);
}
}

.mx_UserMenu {
padding: 0 2px 8px;
border-bottom: 1px solid $quinary-content;
margin: 12px 14px 4px 18px;
}
}

.mx_SpacePanel_contextMenu {
Expand Down
3 changes: 0 additions & 3 deletions res/css/structures/_UserMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ limitations under the License.
*/

.mx_UserMenu {
padding: 0 2px 8px;
border-bottom: 1px solid $quinary-content;
margin: 12px 14px 4px 18px;
box-sizing: border-box;
display: flex;
align-items: center;
Expand Down
9 changes: 8 additions & 1 deletion src/components/structures/LeftPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { UPDATE_EVENT } from "../../stores/AsyncStore";
import IndicatorScrollbar from "./IndicatorScrollbar";
import RoomBreadcrumbs from "../views/rooms/RoomBreadcrumbs";
import SettingsStore from "../../settings/SettingsStore";
import UserMenu from "./UserMenu";

interface IProps {
isMinimized: boolean;
Expand Down Expand Up @@ -380,6 +381,7 @@ export default class LeftPanel extends React.Component<IProps, IState> {
onBlur={this.onBlur}
onKeyDown={this.onKeyDown}
>
{ !SpaceStore.spacesEnabled && <UserMenu isPanelCollapsed={true} /> }
<RoomSearch
isMinimized={this.props.isMinimized}
ref={this.roomSearchRef}
Expand Down Expand Up @@ -420,7 +422,12 @@ export default class LeftPanel extends React.Component<IProps, IState> {
<aside className="mx_LeftPanel_roomListContainer">
{ this.renderSearchDialExplore() }
{ this.renderBreadcrumbs() }
{ !this.props.isMinimized && <RoomListHeader onVisibilityChange={this.refreshStickyHeaders} /> }
{ !this.props.isMinimized && (
<RoomListHeader
onVisibilityChange={this.refreshStickyHeaders}
spacePanelDisabled={!SpaceStore.spacesEnabled}
/>
) }
<div className="mx_LeftPanel_roomListWrapper">
<div
className={roomListClasses}
Expand Down
5 changes: 4 additions & 1 deletion src/components/views/rooms/RoomListHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ const useJoiningRooms = (): Set<string> => {
};

interface IProps {
spacePanelDisabled: boolean;
onVisibilityChange?(): void;
}

const RoomListHeader = ({ onVisibilityChange }: IProps) => {
const RoomListHeader = ({ spacePanelDisabled, onVisibilityChange }: IProps) => {
const cli = useContext(MatrixClientContext);
const [mainMenuDisplayed, mainMenuHandle, openMainMenu, closeMainMenu] = useContextMenu<HTMLDivElement>();
const [plusMenuDisplayed, plusMenuHandle, openPlusMenu, closePlusMenu] = useContextMenu<HTMLDivElement>();
Expand Down Expand Up @@ -183,6 +184,8 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => {
return <div className="mx_LeftPanel_roomListFilterCount">
{ _t("%(count)s results", { count }) }
</div>;
} else if (spacePanelDisabled) {
return null;
}

const communityId = CommunityPrototypeStore.instance.getSelectedCommunityId();
Expand Down

0 comments on commit 0a99be3

Please sign in to comment.