Consolidate all the work thus far

This commit is contained in:
Michael Telatynski 2020-09-08 10:19:51 +01:00
parent 31cca5e0f2
commit 98b59fb217
26 changed files with 337 additions and 274 deletions

View file

@ -46,7 +46,7 @@ interface IRoomWidgets {
// TODO consolidate WidgetEchoStore into this
// TODO consolidate ActiveWidgetStore into this
export class WidgetStore extends AsyncStoreWithClient<IState> {
export default class WidgetStore extends AsyncStoreWithClient<IState> {
private static internalInstance = new WidgetStore();
private widgetMap = new Map<string, IApp>();
@ -159,6 +159,14 @@ export class WidgetStore extends AsyncStoreWithClient<IState> {
return roomInfo ? roomInfo.pinned.has(widgetId) : false;
}
public canPin(widgetId: string) {
// only allow pinning up to a max of two as we do not yet have grid splits
// the only case it will go to three is if you have two and then a Jitsi gets added
const roomId = this.getRoomId(widgetId);
const roomInfo = this.getRoom(roomId);
return roomInfo && roomInfo.pinned.size < 2;
}
public pinWidget(widgetId: string) {
const roomId = this.getRoomId(widgetId);
const roomInfo = this.getRoom(roomId);