mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
add grid toggle button to left panel
This commit is contained in:
parent
7955462dda
commit
1ff6d36ec3
@ -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;
|
||||
}
|
||||
|
@ -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(
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user