Remove Unpin option from maximised widget context menu (#7657)

This commit is contained in:
J. Ryan Stinnett 2022-01-27 17:08:09 +00:00 committed by GitHub
parent 51446378e3
commit efa1667d7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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();
@ -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 = () => {

View File

@ -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';
@ -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}