mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
Appease the linters
This commit is contained in:
parent
04d1f5dd28
commit
6227d3c183
@ -287,7 +287,7 @@ const PersistentVResizer = ({
|
||||
|
||||
const [height, setHeight] = useStateCallback(defaultHeight, newHeight => {
|
||||
newHeight = percentageOf(newHeight, minHeight, maxHeight) * 100;
|
||||
WidgetLayoutStore.instance.setContainerHeight(room, Container.Top, newHeight)
|
||||
WidgetLayoutStore.instance.setContainerHeight(room, Container.Top, newHeight);
|
||||
});
|
||||
|
||||
return <Resizable
|
||||
|
@ -18,12 +18,12 @@ import {useEffect, useState} from "react";
|
||||
import SettingsStore from '../settings/SettingsStore';
|
||||
|
||||
// Hook to fetch the value of a setting and dynamically update when it changes
|
||||
export const useSettingValue = (settingName: string, roomId: string = null, excludeDefault = false) => {
|
||||
const [value, setValue] = useState(SettingsStore.getValue(settingName, roomId, excludeDefault));
|
||||
export const useSettingValue = <T>(settingName: string, roomId: string = null, excludeDefault = false) => {
|
||||
const [value, setValue] = useState(SettingsStore.getValue<T>(settingName, roomId, excludeDefault));
|
||||
|
||||
useEffect(() => {
|
||||
const ref = SettingsStore.watchSetting(settingName, roomId, () => {
|
||||
setValue(SettingsStore.getValue(settingName, roomId, excludeDefault));
|
||||
setValue(SettingsStore.getValue<T>(settingName, roomId, excludeDefault));
|
||||
});
|
||||
// clean-up
|
||||
return () => {
|
||||
|
@ -21,13 +21,13 @@ import { Dispatcher } from "flux";
|
||||
import { ReadyWatchingStore } from "./ReadyWatchingStore";
|
||||
|
||||
export abstract class AsyncStoreWithClient<T extends Object> extends AsyncStore<T> {
|
||||
private readyStore: ReadyWatchingStore;
|
||||
protected readyStore: ReadyWatchingStore;
|
||||
|
||||
protected constructor(dispatcher: Dispatcher<ActionPayload>, initialState: T = <T>{}) {
|
||||
super(dispatcher, initialState);
|
||||
|
||||
// Create an anonymous class to avoid code duplication
|
||||
const asyncStore = this;
|
||||
const asyncStore = this; // eslint-disable-line @typescript-eslint/no-this-alias
|
||||
this.readyStore = new (class extends ReadyWatchingStore {
|
||||
public get mxClient(): MatrixClient {
|
||||
return this.matrixClient;
|
||||
|
@ -114,7 +114,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
|
||||
// Public for test usage. Do not call this.
|
||||
public async makeReady(forcedClient?: MatrixClient) {
|
||||
if (forcedClient) {
|
||||
super.matrixClient = forcedClient;
|
||||
super.readyStore.matrixClient = forcedClient;
|
||||
}
|
||||
|
||||
this.checkLoggingEnabled();
|
||||
|
@ -155,7 +155,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
|
||||
if (room) this.recalculateRoom(room);
|
||||
};
|
||||
|
||||
private updateFromSettings = (settingName: string, roomId: string, /* and other stuff */) => {
|
||||
private updateFromSettings = (settingName: string, roomId: string /* and other stuff */) => {
|
||||
if (roomId) {
|
||||
const room = this.matrixClient.getRoom(roomId);
|
||||
if (room) this.recalculateRoom(room);
|
||||
@ -266,10 +266,6 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
|
||||
maxHeight = Math.max(maxHeight, clamp(h, MIN_WIDGET_HEIGHT_PCT, 100));
|
||||
}
|
||||
}
|
||||
let remainingWidth = 100;
|
||||
for (const width of widths) {
|
||||
remainingWidth -= width;
|
||||
}
|
||||
if (doAutobalance) {
|
||||
for (let i = 0; i < widths.length; i++) {
|
||||
widths[i] = 100 / widths.length;
|
||||
@ -406,7 +402,9 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
|
||||
public moveToContainer(room: Room, widget: IApp, toContainer: Container) {
|
||||
const allWidgets = this.getAllWidgets(room);
|
||||
if (!allWidgets.some(([w])=> w.id === widget.id)) return; // invalid
|
||||
this.updateUserLayout(room, {[widget.id]:{container: toContainer}});
|
||||
this.updateUserLayout(room, {
|
||||
[widget.id]: {container: toContainer},
|
||||
});
|
||||
}
|
||||
|
||||
public canCopyLayoutToRoom(room: Room): boolean {
|
||||
|
Loading…
Reference in New Issue
Block a user