diff --git a/src/domain/session/leftpanel/LeftPanelViewModel.js b/src/domain/session/leftpanel/LeftPanelViewModel.js index 50864b4c..fe5ce05b 100644 --- a/src/domain/session/leftpanel/LeftPanelViewModel.js +++ b/src/domain/session/leftpanel/LeftPanelViewModel.js @@ -23,7 +23,8 @@ import {ApplyMap} from "../../../observable/map/ApplyMap.js"; export class LeftPanelViewModel extends ViewModel { constructor(options) { super(options); - const {rooms, openRoom} = options; + const {rooms, openRoom, gridEnabled} = options; + this._gridEnabled = gridEnabled; const roomTileVMs = rooms.mapValues((room, emitChange) => { return new RoomTileViewModel({ room, @@ -35,6 +36,15 @@ export class LeftPanelViewModel extends ViewModel { this._roomList = this._roomListFilterMap.sortValues((a, b) => a.compare(b)); } + get gridEnabled() { + return this._gridEnabled.get(); + } + + toggleGrid() { + this._gridEnabled.set(!this._gridEnabled.get()); + this.emitChange("gridEnabled"); + } + get roomList() { return this._roomList; } diff --git a/src/ui/web/session/leftpanel/LeftPanelView.js b/src/ui/web/session/leftpanel/LeftPanelView.js index f262e954..d7c588ad 100644 --- a/src/ui/web/session/leftpanel/LeftPanelView.js +++ b/src/ui/web/session/leftpanel/LeftPanelView.js @@ -40,7 +40,8 @@ export class LeftPanelView extends TemplateView { t.button({onClick: () => { filterInput.value = ""; vm.clearFilter(); - }}, vm.i18n`Clear`) + }}, vm.i18n`Clear`), + t.button({onClick: () => vm.toggleGrid()}, vm => vm.gridEnabled ? "Single" : "Grid") ]), t.view(new ListView( {