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

Commit

Permalink
Remove Unpin option from maximised widget context menu (#7657)
Browse files Browse the repository at this point in the history
  • Loading branch information
jryans authored Jan 27, 2022
1 parent 5144637 commit efa1667
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/components/views/context_menus/WidgetContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ const WidgetContextMenu: React.FC<IProps> = ({
/>;
}

const pinnedWidgets = WidgetLayoutStore.instance.getContainerWidgets(room, Container.Top);
const widgetIndex = pinnedWidgets.findIndex(widget => widget.id === app.id);

let unpinButton;
if (showUnpin) {
if (showUnpin && widgetIndex >= 0) {
const onUnpinClick = () => {
WidgetLayoutStore.instance.moveToContainer(room, app, Container.Right);
onFinished();
Expand Down Expand Up @@ -175,9 +178,6 @@ const WidgetContextMenu: React.FC<IProps> = ({
revokeButton = <IconizedContextMenuOption onClick={onRevokeClick} label={_t("Revoke permissions")} />;
}

const pinnedWidgets = WidgetLayoutStore.instance.getContainerWidgets(room, Container.Top);
const widgetIndex = pinnedWidgets.findIndex(widget => widget.id === app.id);

let moveLeftButton;
if (showUnpin && widgetIndex > 0) {
const onClick = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/elements/AppTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import PersistedElement, { getPersistKey } from "./PersistedElement";
import { WidgetType } from "../../../widgets/WidgetType";
import { StopGapWidget } from "../../../stores/widgets/StopGapWidget";
import { ElementWidgetActions } from "../../../stores/widgets/ElementWidgetActions";
import RoomWidgetContextMenu from "../context_menus/WidgetContextMenu";
import WidgetContextMenu from "../context_menus/WidgetContextMenu";
import WidgetAvatar from "../avatars/WidgetAvatar";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import CallHandler from '../../../CallHandler';
Expand Down Expand Up @@ -573,7 +573,7 @@ export default class AppTile extends React.Component<IProps, IState> {
let contextMenu;
if (this.state.menuDisplayed) {
contextMenu = (
<RoomWidgetContextMenu
<WidgetContextMenu
{...aboveLeftOf(this.contextMenuButton.current.getBoundingClientRect(), null)}
app={this.props.app}
onFinished={this.closeContextMenu}
Expand Down

0 comments on commit efa1667

Please sign in to comment.