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

Remove Unpin option from maximised widget context menu #7657

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
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