Merge pull request #4791 from matrix-org/joriks/semicolon
Lint ts semicolons (aka. The great semicolon migration)
This commit is contained in:
commit
29d0cfc0b0
36 changed files with 115 additions and 110 deletions
|
@ -15,5 +15,5 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Based on https://stackoverflow.com/a/53229857/3532235
|
// Based on https://stackoverflow.com/a/53229857/3532235
|
||||||
export type Without<T, U> = {[P in Exclude<keyof T, keyof U>] ? : never}
|
export type Without<T, U> = {[P in Exclude<keyof T, keyof U>] ? : never};
|
||||||
export type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
export type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
||||||
|
|
|
@ -150,7 +150,7 @@ export default abstract class BasePlatform {
|
||||||
abstract displayNotification(title: string, msg: string, avatarUrl: string, room: Object);
|
abstract displayNotification(title: string, msg: string, avatarUrl: string, room: Object);
|
||||||
|
|
||||||
loudNotification(ev: Event, room: Object) {
|
loudNotification(ev: Event, room: Object) {
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a promise that resolves to a string representing the current version of the application.
|
* Returns a promise that resolves to a string representing the current version of the application.
|
||||||
|
|
|
@ -119,26 +119,26 @@ export default class DeviceListener {
|
||||||
|
|
||||||
// No need to do a recheck here: we just need to get a snapshot of our devices
|
// No need to do a recheck here: we just need to get a snapshot of our devices
|
||||||
// before we download any new ones.
|
// before we download any new ones.
|
||||||
}
|
};
|
||||||
|
|
||||||
_onDevicesUpdated = (users: string[]) => {
|
_onDevicesUpdated = (users: string[]) => {
|
||||||
if (!users.includes(MatrixClientPeg.get().getUserId())) return;
|
if (!users.includes(MatrixClientPeg.get().getUserId())) return;
|
||||||
this._recheck();
|
this._recheck();
|
||||||
}
|
};
|
||||||
|
|
||||||
_onDeviceVerificationChanged = (userId: string) => {
|
_onDeviceVerificationChanged = (userId: string) => {
|
||||||
if (userId !== MatrixClientPeg.get().getUserId()) return;
|
if (userId !== MatrixClientPeg.get().getUserId()) return;
|
||||||
this._recheck();
|
this._recheck();
|
||||||
}
|
};
|
||||||
|
|
||||||
_onUserTrustStatusChanged = (userId: string) => {
|
_onUserTrustStatusChanged = (userId: string) => {
|
||||||
if (userId !== MatrixClientPeg.get().getUserId()) return;
|
if (userId !== MatrixClientPeg.get().getUserId()) return;
|
||||||
this._recheck();
|
this._recheck();
|
||||||
}
|
};
|
||||||
|
|
||||||
_onCrossSingingKeysChanged = () => {
|
_onCrossSingingKeysChanged = () => {
|
||||||
this._recheck();
|
this._recheck();
|
||||||
}
|
};
|
||||||
|
|
||||||
_onAccountData = (ev) => {
|
_onAccountData = (ev) => {
|
||||||
// User may have:
|
// User may have:
|
||||||
|
@ -152,11 +152,11 @@ export default class DeviceListener {
|
||||||
) {
|
) {
|
||||||
this._recheck();
|
this._recheck();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
_onSync = (state, prevState) => {
|
_onSync = (state, prevState) => {
|
||||||
if (state === 'PREPARED' && prevState === null) this._recheck();
|
if (state === 'PREPARED' && prevState === null) this._recheck();
|
||||||
}
|
};
|
||||||
|
|
||||||
// The server doesn't tell us when key backup is set up, so we poll
|
// The server doesn't tell us when key backup is set up, so we poll
|
||||||
// & cache the result
|
// & cache the result
|
||||||
|
|
|
@ -35,13 +35,13 @@ import { crossSigningCallbacks } from './CrossSigningManager';
|
||||||
import {SHOW_QR_CODE_METHOD} from "matrix-js-sdk/src/crypto/verification/QRCode";
|
import {SHOW_QR_CODE_METHOD} from "matrix-js-sdk/src/crypto/verification/QRCode";
|
||||||
|
|
||||||
export interface IMatrixClientCreds {
|
export interface IMatrixClientCreds {
|
||||||
homeserverUrl: string,
|
homeserverUrl: string;
|
||||||
identityServerUrl: string,
|
identityServerUrl: string;
|
||||||
userId: string,
|
userId: string;
|
||||||
deviceId: string,
|
deviceId: string;
|
||||||
accessToken: string,
|
accessToken: string;
|
||||||
guest: boolean,
|
guest: boolean;
|
||||||
pickleKey?: string,
|
pickleKey?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Move this to the js-sdk
|
// TODO: Move this to the js-sdk
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default class TagOrderActions {
|
||||||
// For an optimistic update
|
// For an optimistic update
|
||||||
return {tags, removedTags};
|
return {tags, removedTags};
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an action thunk that will do an asynchronous request to
|
* Creates an action thunk that will do an asynchronous request to
|
||||||
|
|
|
@ -35,15 +35,15 @@ export interface ISelectionRange {
|
||||||
|
|
||||||
export interface ICompletion {
|
export interface ICompletion {
|
||||||
type: "at-room" | "command" | "community" | "room" | "user";
|
type: "at-room" | "command" | "community" | "room" | "user";
|
||||||
completion: string,
|
completion: string;
|
||||||
completionId?: string;
|
completionId?: string;
|
||||||
component?: ReactElement,
|
component?: ReactElement;
|
||||||
range: ISelectionRange,
|
range: ISelectionRange;
|
||||||
command?: string,
|
command?: string;
|
||||||
suffix?: string;
|
suffix?: string;
|
||||||
// If provided, apply a LINK entity to the completion with the
|
// If provided, apply a LINK entity to the completion with the
|
||||||
// data = { url: href }.
|
// data = { url: href }.
|
||||||
href?: string,
|
href?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PROVIDERS = [
|
const PROVIDERS = [
|
||||||
|
|
|
@ -46,7 +46,7 @@ export const TextualCompletion = forwardRef<ITextualCompletionProps, any>((props
|
||||||
});
|
});
|
||||||
|
|
||||||
interface IPillCompletionProps extends ITextualCompletionProps {
|
interface IPillCompletionProps extends ITextualCompletionProps {
|
||||||
children?: React.ReactNode,
|
children?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PillCompletion = forwardRef<IPillCompletionProps, any>((props, ref) => {
|
export const PillCompletion = forwardRef<IPillCompletionProps, any>((props, ref) => {
|
||||||
|
|
|
@ -151,9 +151,9 @@ interface IProps { // TODO type things better
|
||||||
// Represents the screen to display as a result of parsing the initial window.location
|
// Represents the screen to display as a result of parsing the initial window.location
|
||||||
initialScreenAfterLogin?: IScreen;
|
initialScreenAfterLogin?: IScreen;
|
||||||
// displayname, if any, to set on the device when logging in/registering.
|
// displayname, if any, to set on the device when logging in/registering.
|
||||||
defaultDeviceDisplayName?: string,
|
defaultDeviceDisplayName?: string;
|
||||||
// A function that makes a registration URL
|
// A function that makes a registration URL
|
||||||
makeRegistrationUrl: (object) => string,
|
makeRegistrationUrl: (object) => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
|
|
|
@ -291,6 +291,6 @@ export default class UserMenuButton extends React.Component<IProps, IState> {
|
||||||
</ContextMenuButton>
|
</ContextMenuButton>
|
||||||
{contextMenu}
|
{contextMenu}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ class PassphraseField extends PureComponent<IProps, IState> {
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange}
|
||||||
onValidate={this.onValidate}
|
onValidate={this.onValidate}
|
||||||
/>
|
/>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import React from 'react';
|
||||||
import {Key} from '../../../Keyboard';
|
import {Key} from '../../../Keyboard';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
export type ButtonEvent = React.MouseEvent<Element> | React.KeyboardEvent<Element>
|
export type ButtonEvent = React.MouseEvent<Element> | React.KeyboardEvent<Element>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* children: React's magic prop. Represents all children given to the element.
|
* children: React's magic prop. Represents all children given to the element.
|
||||||
|
@ -40,7 +40,7 @@ interface IProps extends React.InputHTMLAttributes<Element> {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
onClick?(e?: ButtonEvent): void;
|
onClick?(e?: ButtonEvent): void;
|
||||||
};
|
}
|
||||||
|
|
||||||
interface IAccessibleButtonProps extends React.InputHTMLAttributes<Element> {
|
interface IAccessibleButtonProps extends React.InputHTMLAttributes<Element> {
|
||||||
ref?: React.Ref<Element>;
|
ref?: React.Ref<Element>;
|
||||||
|
|
|
@ -17,20 +17,20 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
className: string,
|
className: string;
|
||||||
dragFunc: (currentLocation: ILocationState, event: MouseEvent) => ILocationState,
|
dragFunc: (currentLocation: ILocationState, event: MouseEvent) => ILocationState;
|
||||||
onMouseUp: (event: MouseEvent) => void,
|
onMouseUp: (event: MouseEvent) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
onMouseMove: (event: MouseEvent) => void,
|
onMouseMove: (event: MouseEvent) => void;
|
||||||
onMouseUp: (event: MouseEvent) => void,
|
onMouseUp: (event: MouseEvent) => void;
|
||||||
location: ILocationState,
|
location: ILocationState;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILocationState {
|
export interface ILocationState {
|
||||||
currentX: number,
|
currentX: number;
|
||||||
currentY: number,
|
currentY: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Draggable extends React.Component<IProps, IState> {
|
export default class Draggable extends React.Component<IProps, IState> {
|
||||||
|
@ -58,13 +58,13 @@ export default class Draggable extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
document.addEventListener("mousemove", this.state.onMouseMove);
|
document.addEventListener("mousemove", this.state.onMouseMove);
|
||||||
document.addEventListener("mouseup", this.state.onMouseUp);
|
document.addEventListener("mouseup", this.state.onMouseUp);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onMouseUp = (event: MouseEvent): void => {
|
private onMouseUp = (event: MouseEvent): void => {
|
||||||
document.removeEventListener("mousemove", this.state.onMouseMove);
|
document.removeEventListener("mousemove", this.state.onMouseMove);
|
||||||
document.removeEventListener("mouseup", this.state.onMouseUp);
|
document.removeEventListener("mouseup", this.state.onMouseUp);
|
||||||
this.props.onMouseUp(event);
|
this.props.onMouseUp(event);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onMouseMove(event: MouseEvent): void {
|
private onMouseMove(event: MouseEvent): void {
|
||||||
const newLocation = this.props.dragFunc(this.state.location, event);
|
const newLocation = this.props.dragFunc(this.state.location, event);
|
||||||
|
@ -75,7 +75,7 @@ export default class Draggable extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <div className={this.props.className} onMouseDown={this.onMouseDown.bind(this)} />
|
return <div className={this.props.className} onMouseDown={this.onMouseDown.bind(this)} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -85,20 +85,20 @@ interface ITextareaProps extends IProps, TextareaHTMLAttributes<HTMLTextAreaElem
|
||||||
type PropShapes = IInputProps | ISelectProps | ITextareaProps;
|
type PropShapes = IInputProps | ISelectProps | ITextareaProps;
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
valid: boolean,
|
valid: boolean;
|
||||||
feedback: React.ReactNode,
|
feedback: React.ReactNode;
|
||||||
feedbackVisible: boolean,
|
feedbackVisible: boolean;
|
||||||
focused: boolean,
|
focused: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Field extends React.PureComponent<PropShapes, IState> {
|
export default class Field extends React.PureComponent<PropShapes, IState> {
|
||||||
private id: string;
|
private id: string;
|
||||||
private input: HTMLInputElement;
|
private input: HTMLInputElement;
|
||||||
|
|
||||||
private static defaultProps = {
|
public static readonly defaultProps = {
|
||||||
element: "input",
|
element: "input",
|
||||||
type: "text",
|
type: "text",
|
||||||
}
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This was changed from throttle to debounce: this is more traditional for
|
* This was changed from throttle to debounce: this is more traditional for
|
||||||
|
|
|
@ -20,15 +20,15 @@ import Draggable, {ILocationState} from './Draggable';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
// Current room
|
// Current room
|
||||||
roomId: string,
|
roomId: string;
|
||||||
minWidth: number,
|
minWidth: number;
|
||||||
maxWidth: number,
|
maxWidth: number;
|
||||||
};
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
width: number,
|
width: number;
|
||||||
IRCLayoutRoot: HTMLElement,
|
IRCLayoutRoot: HTMLElement;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default class IRCTimelineProfileResizer extends React.Component<IProps, IState> {
|
export default class IRCTimelineProfileResizer extends React.Component<IProps, IState> {
|
||||||
constructor(props: IProps) {
|
constructor(props: IProps) {
|
||||||
|
@ -37,20 +37,19 @@ export default class IRCTimelineProfileResizer extends React.Component<IProps, I
|
||||||
this.state = {
|
this.state = {
|
||||||
width: SettingsStore.getValue("ircDisplayNameWidth", this.props.roomId),
|
width: SettingsStore.getValue("ircDisplayNameWidth", this.props.roomId),
|
||||||
IRCLayoutRoot: null,
|
IRCLayoutRoot: null,
|
||||||
}
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.setState({
|
this.setState({
|
||||||
IRCLayoutRoot: document.querySelector(".mx_IRCLayout") as HTMLElement,
|
IRCLayoutRoot: document.querySelector(".mx_IRCLayout") as HTMLElement,
|
||||||
}, () => this.updateCSSWidth(this.state.width))
|
}, () => this.updateCSSWidth(this.state.width));
|
||||||
}
|
}
|
||||||
|
|
||||||
private dragFunc = (location: ILocationState, event: React.MouseEvent<Element, MouseEvent>): ILocationState => {
|
private dragFunc = (location: ILocationState, event: React.MouseEvent<Element, MouseEvent>): ILocationState => {
|
||||||
const offset = event.clientX - location.currentX;
|
const offset = event.clientX - location.currentX;
|
||||||
const newWidth = this.state.width + offset;
|
const newWidth = this.state.width + offset;
|
||||||
|
|
||||||
console.log({offset})
|
|
||||||
// If we're trying to go smaller than min width, don't.
|
// If we're trying to go smaller than min width, don't.
|
||||||
if (newWidth < this.props.minWidth) {
|
if (newWidth < this.props.minWidth) {
|
||||||
return location;
|
return location;
|
||||||
|
@ -69,8 +68,8 @@ export default class IRCTimelineProfileResizer extends React.Component<IProps, I
|
||||||
return {
|
return {
|
||||||
currentX: event.clientX,
|
currentX: event.clientX,
|
||||||
currentY: location.currentY,
|
currentY: location.currentY,
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
private updateCSSWidth(newWidth: number) {
|
private updateCSSWidth(newWidth: number) {
|
||||||
this.state.IRCLayoutRoot.style.setProperty("--name-width", newWidth + "px");
|
this.state.IRCLayoutRoot.style.setProperty("--name-width", newWidth + "px");
|
||||||
|
@ -83,6 +82,10 @@ export default class IRCTimelineProfileResizer extends React.Component<IProps, I
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <Draggable className="mx_ProfileResizer" dragFunc={this.dragFunc.bind(this)} onMouseUp={this.onMoueUp.bind(this)}/>
|
return <Draggable
|
||||||
|
className="mx_ProfileResizer"
|
||||||
|
dragFunc={this.dragFunc.bind(this)}
|
||||||
|
onMouseUp={this.onMoueUp.bind(this)}
|
||||||
|
/>;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
|
@ -48,18 +48,18 @@ export default class SettingsFlag extends React.Component<IProps, IState> {
|
||||||
this.props.roomId,
|
this.props.roomId,
|
||||||
this.props.isExplicit,
|
this.props.isExplicit,
|
||||||
),
|
),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private onChange = (checked: boolean): void => {
|
private onChange = (checked: boolean): void => {
|
||||||
this.save(checked);
|
this.save(checked);
|
||||||
this.setState({ value: checked });
|
this.setState({ value: checked });
|
||||||
if (this.props.onChange) this.props.onChange(checked);
|
if (this.props.onChange) this.props.onChange(checked);
|
||||||
}
|
};
|
||||||
|
|
||||||
private checkBoxOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
private checkBoxOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
this.onChange(e.target.checked);
|
this.onChange(e.target.checked);
|
||||||
}
|
};
|
||||||
|
|
||||||
private save = (val?: boolean): void => {
|
private save = (val?: boolean): void => {
|
||||||
return SettingsStore.setValue(
|
return SettingsStore.setValue(
|
||||||
|
@ -68,7 +68,7 @@ export default class SettingsFlag extends React.Component<IProps, IState> {
|
||||||
this.props.level,
|
this.props.level,
|
||||||
val !== undefined ? val : this.state.value,
|
val !== undefined ? val : this.state.value,
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const canChange = SettingsStore.canSetValue(this.props.name, this.props.roomId, this.props.level);
|
const canChange = SettingsStore.canSetValue(this.props.name, this.props.roomId, this.props.level);
|
||||||
|
|
|
@ -65,9 +65,9 @@ export default class Slider extends React.Component<IProps> {
|
||||||
|
|
||||||
const intervalWidth = 1 / (values.length - 1);
|
const intervalWidth = 1 / (values.length - 1);
|
||||||
|
|
||||||
const linearInterpolation = (value - closestLessValue) / (closestGreaterValue - closestLessValue)
|
const linearInterpolation = (value - closestLessValue) / (closestGreaterValue - closestLessValue);
|
||||||
|
|
||||||
return 100 * (closest - 1 + linearInterpolation) * intervalWidth
|
return 100 * (closest - 1 + linearInterpolation) * intervalWidth;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ export default class Slider extends React.Component<IProps> {
|
||||||
selection = <div className="mx_Slider_selection">
|
selection = <div className="mx_Slider_selection">
|
||||||
<div className="mx_Slider_selectionDot" style={{left: "calc(-0.55em + " + offset + "%)"}} />
|
<div className="mx_Slider_selectionDot" style={{left: "calc(-0.55em + " + offset + "%)"}} />
|
||||||
<hr style={{width: offset + "%"}} />
|
<hr style={{width: offset + "%"}} />
|
||||||
</div>
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div className="mx_Slider">
|
return <div className="mx_Slider">
|
||||||
|
@ -115,13 +115,13 @@ export default class Slider extends React.Component<IProps> {
|
||||||
|
|
||||||
interface IDotProps {
|
interface IDotProps {
|
||||||
// Callback for behavior onclick
|
// Callback for behavior onclick
|
||||||
onClick: () => void,
|
onClick: () => void;
|
||||||
|
|
||||||
// Whether the dot should appear active
|
// Whether the dot should appear active
|
||||||
active: boolean,
|
active: boolean;
|
||||||
|
|
||||||
// The label on the dot
|
// The label on the dot
|
||||||
label: string,
|
label: string;
|
||||||
|
|
||||||
// Whether the slider is disabled
|
// Whether the slider is disabled
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
@ -129,7 +129,7 @@ interface IDotProps {
|
||||||
|
|
||||||
class Dot extends React.PureComponent<IDotProps> {
|
class Dot extends React.PureComponent<IDotProps> {
|
||||||
render(): React.ReactNode {
|
render(): React.ReactNode {
|
||||||
let className = "mx_Slider_dot"
|
let className = "mx_Slider_dot";
|
||||||
if (!this.props.disabled && this.props.active) {
|
if (!this.props.disabled && this.props.active) {
|
||||||
className += " mx_Slider_dotActive";
|
className += " mx_Slider_dotActive";
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default class StyledCheckbox extends React.PureComponent<IProps, IState>
|
||||||
|
|
||||||
public static readonly defaultProps = {
|
public static readonly defaultProps = {
|
||||||
className: "",
|
className: "",
|
||||||
}
|
};
|
||||||
|
|
||||||
constructor(props: IProps) {
|
constructor(props: IProps) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -51,6 +51,6 @@ export default class StyledCheckbox extends React.PureComponent<IProps, IState>
|
||||||
{ this.props.children }
|
{ this.props.children }
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</span>
|
</span>;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,7 +26,7 @@ interface IState {
|
||||||
export default class StyledRadioButton extends React.PureComponent<IProps, IState> {
|
export default class StyledRadioButton extends React.PureComponent<IProps, IState> {
|
||||||
public static readonly defaultProps = {
|
public static readonly defaultProps = {
|
||||||
className: '',
|
className: '',
|
||||||
}
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const { children, className, disabled, ...otherProps } = this.props;
|
const { children, className, disabled, ...otherProps } = this.props;
|
||||||
|
@ -43,6 +43,6 @@ export default class StyledRadioButton extends React.PureComponent<IProps, IStat
|
||||||
<div><div></div></div>
|
<div><div></div></div>
|
||||||
<span>{children}</span>
|
<span>{children}</span>
|
||||||
<div className="mx_RadioButton_spacer" />
|
<div className="mx_RadioButton_spacer" />
|
||||||
</label>
|
</label>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ interface IProps {
|
||||||
|
|
||||||
// Called when the checked state changes. First argument will be the new state.
|
// Called when the checked state changes. First argument will be the new state.
|
||||||
onChange(checked: boolean): void;
|
onChange(checked: boolean): void;
|
||||||
};
|
}
|
||||||
|
|
||||||
// Controlled Toggle Switch element, written with Accessibility in mind
|
// Controlled Toggle Switch element, written with Accessibility in mind
|
||||||
export default ({checked, disabled = false, onChange, ...props}: IProps) => {
|
export default ({checked, disabled = false, onChange, ...props}: IProps) => {
|
||||||
|
|
|
@ -29,15 +29,15 @@ const MIN_TOOLTIP_HEIGHT = 25;
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
// Class applied to the element used to position the tooltip
|
// Class applied to the element used to position the tooltip
|
||||||
className: string,
|
className: string;
|
||||||
// Class applied to the tooltip itself
|
// Class applied to the tooltip itself
|
||||||
tooltipClassName?: string,
|
tooltipClassName?: string;
|
||||||
// Whether the tooltip is visible or hidden.
|
// Whether the tooltip is visible or hidden.
|
||||||
// The hidden state allows animating the tooltip away via CSS.
|
// The hidden state allows animating the tooltip away via CSS.
|
||||||
// Defaults to visible if unset.
|
// Defaults to visible if unset.
|
||||||
visible?: boolean,
|
visible?: boolean;
|
||||||
// the react element to put into the tooltip
|
// the react element to put into the tooltip
|
||||||
label: React.ReactNode,
|
label: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Tooltip extends React.Component<IProps> {
|
export default class Tooltip extends React.Component<IProps> {
|
||||||
|
@ -126,7 +126,7 @@ export default class Tooltip extends React.Component<IProps> {
|
||||||
tooltip: this.tooltip,
|
tooltip: this.tooltip,
|
||||||
parent: parent,
|
parent: parent,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
// Render a placeholder
|
// Render a placeholder
|
||||||
|
|
|
@ -97,7 +97,7 @@ export default class RoomBreadcrumbs2 extends React.PureComponent<IProps, IState
|
||||||
>
|
>
|
||||||
<RoomAvatar room={r} width={32} height={32}/>
|
<RoomAvatar room={r} width={32} height={32}/>
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
)
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (tiles.length > 0) {
|
if (tiles.length > 0) {
|
||||||
|
|
|
@ -423,7 +423,7 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
|
||||||
{visibleTiles}
|
{visibleTiles}
|
||||||
{showNButton}
|
{showNButton}
|
||||||
</ResizableBox>
|
</ResizableBox>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: onKeyDown support
|
// TODO: onKeyDown support
|
||||||
|
|
|
@ -232,7 +232,7 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
/>
|
/>
|
||||||
{contextMenu}
|
{contextMenu}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): React.ReactElement {
|
public render(): React.ReactElement {
|
||||||
|
|
|
@ -35,23 +35,23 @@ interface IProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IThemeState {
|
interface IThemeState {
|
||||||
theme: string,
|
theme: string;
|
||||||
useSystemTheme: boolean,
|
useSystemTheme: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomThemeMessage {
|
export interface CustomThemeMessage {
|
||||||
isError: boolean,
|
isError: boolean;
|
||||||
text: string
|
text: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
interface IState extends IThemeState {
|
interface IState extends IThemeState {
|
||||||
// String displaying the current selected fontSize.
|
// String displaying the current selected fontSize.
|
||||||
// Needs to be string for things like '17.' without
|
// Needs to be string for things like '17.' without
|
||||||
// trailing 0s.
|
// trailing 0s.
|
||||||
fontSize: string,
|
fontSize: string;
|
||||||
customThemeUrl: string,
|
customThemeUrl: string;
|
||||||
customThemeMessage: CustomThemeMessage,
|
customThemeMessage: CustomThemeMessage;
|
||||||
useCustomFontSize: boolean,
|
useCustomFontSize: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class AppearanceUserSettingsTab extends React.Component<IProps, IState> {
|
export default class AppearanceUserSettingsTab extends React.Component<IProps, IState> {
|
||||||
|
@ -159,7 +159,7 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
|
||||||
);
|
);
|
||||||
|
|
||||||
return {valid: true, feedback: _t('Use between %(min)s pt and %(max)s pt', {min, max})};
|
return {valid: true, feedback: _t('Use between %(min)s pt and %(max)s pt', {min, max})};
|
||||||
}
|
};
|
||||||
|
|
||||||
private onAddCustomTheme = async (): Promise<void> => {
|
private onAddCustomTheme = async (): Promise<void> => {
|
||||||
let currentThemes: string[] = SettingsStore.getValue("custom_themes");
|
let currentThemes: string[] = SettingsStore.getValue("custom_themes");
|
||||||
|
|
|
@ -90,7 +90,7 @@ export default class VerificationRequestToast extends React.PureComponent<IProps
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error while cancelling verification request", err);
|
console.error("Error while cancelling verification request", err);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
accept = async () => {
|
accept = async () => {
|
||||||
ToastStore.sharedInstance().dismissToast(this.props.toastKey);
|
ToastStore.sharedInstance().dismissToast(this.props.toastKey);
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { Action } from "../actions";
|
||||||
import {UpdateCheckStatus} from "../../BasePlatform";
|
import {UpdateCheckStatus} from "../../BasePlatform";
|
||||||
|
|
||||||
export interface CheckUpdatesPayload extends ActionPayload {
|
export interface CheckUpdatesPayload extends ActionPayload {
|
||||||
action: Action.CheckUpdates,
|
action: Action.CheckUpdates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current phase of the manual update check.
|
* The current phase of the manual update check.
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { ActionPayload } from "../payloads";
|
||||||
import { Action } from "../actions";
|
import { Action } from "../actions";
|
||||||
|
|
||||||
export interface OpenToTabPayload extends ActionPayload {
|
export interface OpenToTabPayload extends ActionPayload {
|
||||||
action: Action.ViewUserSettings | string, // TODO: Add room settings action
|
action: Action.ViewUserSettings | string; // TODO: Add room settings action
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The tab ID to open in the settings view to start, if possible.
|
* The tab ID to open in the settings view to start, if possible.
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { ActionPayload } from "../payloads";
|
||||||
import { Action } from "../actions";
|
import { Action } from "../actions";
|
||||||
|
|
||||||
export interface RecheckThemePayload extends ActionPayload {
|
export interface RecheckThemePayload extends ActionPayload {
|
||||||
action: Action.RecheckTheme,
|
action: Action.RecheckTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optionally specify the exact theme which is to be loaded.
|
* Optionally specify the exact theme which is to be loaded.
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { Action } from "../actions";
|
||||||
import { Component } from "react";
|
import { Component } from "react";
|
||||||
|
|
||||||
export interface ViewTooltipPayload extends ActionPayload {
|
export interface ViewTooltipPayload extends ActionPayload {
|
||||||
action: Action.ViewTooltip,
|
action: Action.ViewTooltip;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The tooltip to render. If it's null the tooltip will not be rendered
|
* The tooltip to render. If it's null the tooltip will not be rendered
|
||||||
|
@ -31,5 +31,5 @@ export interface ViewTooltipPayload extends ActionPayload {
|
||||||
* The parent under which to render the tooltip. Can be null to remove
|
* The parent under which to render the tooltip. Can be null to remove
|
||||||
* the parent type.
|
* the parent type.
|
||||||
*/
|
*/
|
||||||
parent: null | Element
|
parent: null | Element;
|
||||||
}
|
}
|
|
@ -19,7 +19,7 @@ import { ActionPayload } from "../payloads";
|
||||||
import { Action } from "../actions";
|
import { Action } from "../actions";
|
||||||
|
|
||||||
export interface ViewUserPayload extends ActionPayload {
|
export interface ViewUserPayload extends ActionPayload {
|
||||||
action: Action.ViewUser,
|
action: Action.ViewUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The member to view. May be null or falsy to indicate that no member
|
* The member to view. May be null or falsy to indicate that no member
|
||||||
|
|
|
@ -15,6 +15,6 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default interface IWatcher {
|
export default interface IWatcher {
|
||||||
start(): void
|
start(): void;
|
||||||
stop(): void
|
stop(): void;
|
||||||
}
|
}
|
|
@ -127,7 +127,7 @@ export class Algorithm extends EventEmitter {
|
||||||
const algorithm = getListAlgorithmInstance(order, tagId, this.sortAlgorithms[tagId]);
|
const algorithm = getListAlgorithmInstance(order, tagId, this.sortAlgorithms[tagId]);
|
||||||
this.algorithms[tagId] = algorithm;
|
this.algorithms[tagId] = algorithm;
|
||||||
|
|
||||||
await algorithm.setRooms(this._cachedRooms[tagId])
|
await algorithm.setRooms(this._cachedRooms[tagId]);
|
||||||
this._cachedRooms[tagId] = algorithm.orderedRooms;
|
this._cachedRooms[tagId] = algorithm.orderedRooms;
|
||||||
this.recalculateFilteredRoomsForTag(tagId); // update filter to re-sort the list
|
this.recalculateFilteredRoomsForTag(tagId); // update filter to re-sort the list
|
||||||
this.recalculateStickyRoom(tagId); // update sticky room to make sure it appears if needed
|
this.recalculateStickyRoom(tagId); // update sticky room to make sure it appears if needed
|
||||||
|
@ -539,5 +539,5 @@ export class Algorithm extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ export class ImportanceAlgorithm extends OrderingAlgorithm {
|
||||||
// handling. For instance, if 45 rooms are removed from the middle of a 50 room list, the
|
// handling. For instance, if 45 rooms are removed from the middle of a 50 room list, the
|
||||||
// index for the categories will be way off.
|
// index for the categories will be way off.
|
||||||
|
|
||||||
const nextOrderIndex = CATEGORY_ORDER.indexOf(category) + 1
|
const nextOrderIndex = CATEGORY_ORDER.indexOf(category) + 1;
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
for (let i = nextOrderIndex; i < CATEGORY_ORDER.length; i++) {
|
for (let i = nextOrderIndex; i < CATEGORY_ORDER.length; i++) {
|
||||||
const nextCategory = CATEGORY_ORDER[i];
|
const nextCategory = CATEGORY_ORDER[i];
|
||||||
|
|
|
@ -36,7 +36,7 @@ export function formatCount(count: number): string {
|
||||||
*/
|
*/
|
||||||
export function formatCountLong(count: number): string {
|
export function formatCountLong(count: number): string {
|
||||||
const formatter = new Intl.NumberFormat();
|
const formatter = new Intl.NumberFormat();
|
||||||
return formatter.format(count)
|
return formatter.format(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,7 @@ interface Client {
|
||||||
getStoredDevicesForUser: (userId: string) => [{ deviceId: string }];
|
getStoredDevicesForUser: (userId: string) => [{ deviceId: string }];
|
||||||
checkDeviceTrust: (userId: string, deviceId: string) => {
|
checkDeviceTrust: (userId: string, deviceId: string) => {
|
||||||
isVerified: () => boolean
|
isVerified: () => boolean
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Room {
|
interface Room {
|
||||||
|
|
|
@ -46,7 +46,9 @@
|
||||||
"quotemark": false,
|
"quotemark": false,
|
||||||
"radix": true,
|
"radix": true,
|
||||||
"semicolon": [
|
"semicolon": [
|
||||||
"always"
|
true,
|
||||||
|
"always",
|
||||||
|
"strict-bound-class-methods"
|
||||||
],
|
],
|
||||||
"triple-equals": [],
|
"triple-equals": [],
|
||||||
"typedef-whitespace": [
|
"typedef-whitespace": [
|
||||||
|
|
Loading…
Reference in a new issue