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 {
|
export class LeftPanelViewModel extends ViewModel {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
const {rooms, openRoom} = options;
|
const {rooms, openRoom, gridEnabled} = options;
|
||||||
|
this._gridEnabled = gridEnabled;
|
||||||
const roomTileVMs = rooms.mapValues((room, emitChange) => {
|
const roomTileVMs = rooms.mapValues((room, emitChange) => {
|
||||||
return new RoomTileViewModel({
|
return new RoomTileViewModel({
|
||||||
room,
|
room,
|
||||||
@ -35,6 +36,15 @@ export class LeftPanelViewModel extends ViewModel {
|
|||||||
this._roomList = this._roomListFilterMap.sortValues((a, b) => a.compare(b));
|
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() {
|
get roomList() {
|
||||||
return this._roomList;
|
return this._roomList;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,8 @@ export class LeftPanelView extends TemplateView {
|
|||||||
t.button({onClick: () => {
|
t.button({onClick: () => {
|
||||||
filterInput.value = "";
|
filterInput.value = "";
|
||||||
vm.clearFilter();
|
vm.clearFilter();
|
||||||
}}, vm.i18n`Clear`)
|
}}, vm.i18n`Clear`),
|
||||||
|
t.button({onClick: () => vm.toggleGrid()}, vm => vm.gridEnabled ? "Single" : "Grid")
|
||||||
]),
|
]),
|
||||||
t.view(new ListView(
|
t.view(new ListView(
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user