Use IDialogProps

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-09-10 19:01:05 +02:00
parent ee90ff0b98
commit 6e11f2478c
No known key found for this signature in database
GPG key ID: 55C211A1226CB17D
21 changed files with 41 additions and 64 deletions

View file

@ -27,14 +27,9 @@ import { _t } from "../../../languageHandler";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import { MatrixClient } from "matrix-js-sdk/src/client";
import { IDialogProps } from "./IDialogProps";
interface IProps {
// onFinished callback to call when Escape is pressed
// Take a boolean which is true if the dialog was dismissed
// with a positive / confirm action or false if it was
// cancelled (BaseDialog itself only calls this with false).
onFinished: (confirm: any) => void;
interface IProps extends IDialogProps {
// Whether the dialog should have a 'close' button that will
// cause the dialog to be cancelled. This should only be set
// to false if there is nothing the app can sensibly do if the

View file

@ -25,14 +25,13 @@ import Modal from "../../../Modal";
import BugReportDialog from "./BugReportDialog";
import InfoDialog from "./InfoDialog";
import StyledRadioGroup from "../elements/StyledRadioGroup";
import { IDialogProps } from "./IDialogProps";
const existingIssuesUrl = "https://github.com/vector-im/element-web/issues" +
"?q=is%3Aopen+is%3Aissue+sort%3Areactions-%2B1-desc";
const newIssueUrl = "https://github.com/vector-im/element-web/issues/new/choose";
interface IProps {
onFinished: () => void;
}
interface IProps extends IDialogProps {}
const FeedbackDialog: React.FC<IProps> = (props: IProps) => {
const [rating, setRating] = useState<string>();

View file

@ -26,6 +26,7 @@ import Spinner from "../elements/Spinner";
import VerificationShowSas from "../verification/VerificationShowSas";
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import { IDialogProps } from "./IDialogProps";
const PHASE_START = 0;
const PHASE_SHOW_SAS = 1;
@ -33,9 +34,8 @@ const PHASE_WAIT_FOR_PARTNER_TO_CONFIRM = 2;
const PHASE_VERIFIED = 3;
const PHASE_CANCELLED = 4;
interface IProps {
interface IProps extends IDialogProps {
verifier: any; // TODO types
onFinished: (confirmed: boolean) => void;
}
interface IState {

View file

@ -21,10 +21,9 @@ import { Action } from "../../../dispatcher/actions";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import { IDialogProps } from "./IDialogProps";
interface IProps {
onFinished: () => void;
}
interface IProps extends IDialogProps {}
@replaceableComponent("views.dialogs.IntegrationsDisabledDialog")
export default class IntegrationsDisabledDialog extends React.Component<IProps> {

View file

@ -19,11 +19,9 @@ import { _t } from "../../../languageHandler";
import SdkConfig from "../../../SdkConfig";
import * as sdk from "../../../index";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import { IDialogProps } from "./IDialogProps";
interface IProps {
onFinished: () => void;
}
interface IProps extends IDialogProps {}
@replaceableComponent("views.dialogs.IntegrationsImpossibleDialog")
export default class IntegrationsImpossibleDialog extends React.Component<IProps> {

View file

@ -27,8 +27,9 @@ import { replaceableComponent } from "../../../utils/replaceableComponent";
import { MatrixClient } from "matrix-js-sdk/src/client";
import BaseDialog from "./BaseDialog";
import { IAuthData } from "matrix-js-sdk/src/interactive-auth";
import { IDialogProps } from "./IDialogProps";
interface IProps {
interface IProps extends IDialogProps {
// matrix client to use for UI auth requests
matrixClient: MatrixClient;
@ -43,8 +44,6 @@ interface IProps {
// callback
makeRequest: (auth: IAuthData) => Promise<IAuthData>;
onFinished: (confirmed: boolean, result?) => void;
// Optional title and body to show when not showing a particular stage
title?: string;
body?: string;

View file

@ -20,15 +20,15 @@ import SdkConfig from '../../../SdkConfig';
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import Spinner from "../elements/Spinner";
import { IDialogProps } from "./IDialogProps";
interface IProps {
interface IProps extends IDialogProps {
failures: Record<string, Record<string, {
errcode: string;
error: string;
}>>;
source: string;
continuation: () => void;
onFinished: () => void;
}
const KeySignatureUploadFailedDialog: React.FC<IProps> = ({

View file

@ -20,8 +20,7 @@ import QuestionDialog from './QuestionDialog';
import { _t } from '../../../languageHandler';
import SdkConfig from '../../../SdkConfig';
interface IProps {
onFinished: () => void;
interface IProps extends IDialogProps {
host: string;
}

View file

@ -19,10 +19,9 @@ import React from 'react';
import QuestionDialog from './QuestionDialog';
import { _t } from '../../../languageHandler';
import SdkConfig from '../../../SdkConfig';
import { IDialogProps } from "./IDialogProps";
interface IProps {
onFinished: () => void;
}
interface IProps extends IDialogProps {}
const LazyLoadingResyncDialog: React.FC<IProps> = (props: IProps) => {
const brand = SdkConfig.get().brand;

View file

@ -25,11 +25,11 @@ import { _t } from '../../../languageHandler';
import { replaceableComponent } from "../../../utils/replaceableComponent";
import QuestionDialog from "./QuestionDialog";
import { DeviceInfo } from "matrix-js-sdk/src/crypto/deviceinfo";
import { IDialogProps } from "./IDialogProps";
interface IProps {
interface IProps extends IDialogProps {
userId: string;
device: DeviceInfo;
onFinished: (confirmed: boolean) => void;
}
@replaceableComponent("views.dialogs.ManualDeviceKeyVerificationDialog")

View file

@ -26,10 +26,10 @@ import ScrollPanel from "../../structures/ScrollPanel";
import Spinner from "../elements/Spinner";
import EditHistoryMessage from "../messages/EditHistoryMessage";
import DateSeparator from "../messages/DateSeparator";
import { IDialogProps } from "./IDialogProps";
interface IProps {
interface IProps extends IDialogProps {
mxEvent: MatrixEvent;
onFinished: () => void;
}
interface IState {

View file

@ -20,8 +20,9 @@ import classNames from "classnames";
import * as sdk from '../../../index';
import { _t } from '../../../languageHandler';
import { IDialogProps } from "./IDialogProps";
interface IProps {
interface IProps extends IDialogProps {
title?: string;
description?: React.ReactNode;
extraButtons?: React.ReactNode;
@ -29,7 +30,6 @@ interface IProps {
buttonDisabled?: boolean;
danger?: boolean;
focus?: boolean;
onFinished: (confirmed: boolean) => void;
headerImage?: string;
quitOnly?: boolean; // quitOnly doesn't show the cancel button just the quit [x].
fixedWidth?: boolean;

View file

@ -25,10 +25,10 @@ import QuestionDialog from "./QuestionDialog";
import BugReportDialog from "./BugReportDialog";
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import { IDialogProps } from "./IDialogProps";
interface IProps {
interface IProps extends IDialogProps {
error: string;
onFinished: () => void;
}
@replaceableComponent("views.dialogs.SessionRestoreErrorDialog")

View file

@ -26,10 +26,10 @@ import ErrorDialog from "./ErrorDialog";
import QuestionDialog from "./QuestionDialog";
import BaseDialog from "./BaseDialog";
import EditableText from "../elements/EditableText";
import { IDialogProps } from "./IDialogProps";
interface IProps {
interface IProps extends IDialogProps {
title: string;
onFinished: (confirmed: boolean) => void;
}
interface IState {

View file

@ -17,11 +17,10 @@ limitations under the License.
import React from 'react';
import { _t } from "../../../languageHandler";
import { CommandCategories, Commands } from "../../../SlashCommands";
import { IDialogProps } from "./IDialogProps";
import InfoDialog from "./InfoDialog";
interface IProps {
onFinished: () => void;
}
interface IProps extends IDialogProps {}
const SlashCommandHelpDialog: React.FC<IProps> = ({ onFinished }) => {
const categories = {};

View file

@ -22,10 +22,9 @@ import { replaceableComponent } from "../../../utils/replaceableComponent";
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import BugReportDialog from "./BugReportDialog";
import { IDialogProps } from "./IDialogProps";
interface IProps {
onFinished: (confirmed: boolean) => void;
}
interface IProps extends IDialogProps { }
@replaceableComponent("views.dialogs.StorageEvictedDialog")
export default class StorageEvictedDialog extends React.Component<IProps> {

View file

@ -25,15 +25,9 @@ import { IntegrationManagerInstance } from "../../../integrations/IntegrationMan
import ScalarAuthClient from "../../../ScalarAuthClient";
import AccessibleButton from "../elements/AccessibleButton";
import IntegrationManager from "../settings/IntegrationManager";
import { IDialogProps } from "./IDialogProps";
interface IProps {
/**
* Called with:
* * success {bool} True if the user accepted any douments, false if cancelled
* * agreedUrls {string[]} List of agreed URLs
*/
onFinished: () => void;
interface IProps extends IDialogProps {
/**
* Optional room where the integration manager should be open to
*/

View file

@ -21,8 +21,9 @@ import { replaceableComponent } from "../../../utils/replaceableComponent";
import { IFieldState, IValidationResult } from "../elements/Validation";
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import { IDialogProps } from "./IDialogProps";
interface IProps {
interface IProps extends IDialogProps {
title?: string;
description?: string | JSX.Element;
value?: string;
@ -30,7 +31,6 @@ import DialogButtons from "../elements/DialogButtons";
button?: string;
busyMessage?: string; // pass _td string
focus?: boolean;
onFinished: (success: boolean, value?: string) => void;
hasCancel?: boolean;
validator?: (fieldState: IFieldState) => IValidationResult; // result of withValidation
fixedWidth?: boolean;

View file

@ -22,12 +22,12 @@ import ContentMessages from '../../../ContentMessages';
import { replaceableComponent } from "../../../utils/replaceableComponent";
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import { IDialogProps } from "./IDialogProps";
interface IProps {
interface IProps extends IDialogProps {
badFiles: File[];
totalFiles: number;
contentMessages: ContentMessages;
onFinished: (success: boolean) => void;
}
/*

View file

@ -23,6 +23,7 @@ import { accessSecretStorage } from '../../../../SecurityManager';
import { IKeyBackupInfo, IKeyBackupRestoreResult } from "matrix-js-sdk/src/crypto/keybackup";
import { ISecretStorageKeyInfo } from "matrix-js-sdk/src/crypto/api";
import * as sdk from '../../../../index';
import { IDialogProps } from "../IDialogProps";
enum RestoreType {
Passphrase = "passphrase",
@ -37,15 +38,13 @@ enum ProgressState {
}
interface IProps {
interface IProps extends IDialogProps {
// if false, will close the dialog as soon as the restore completes succesfully
// default: true
showSummary?: boolean;
// If specified, gather the key from the user but then call the function with the backup
// key rather than actually (necessarily) restoring the backup.
keyCallback?: (key: Uint8Array) => void;
onFinished: (success: boolean) => void;
}
interface IState {

View file

@ -20,6 +20,7 @@ import BaseDialog from '../BaseDialog';
import { _t } from '../../../../languageHandler';
import { SetupEncryptionStore, Phase } from '../../../../stores/SetupEncryptionStore';
import { replaceableComponent } from "../../../../utils/replaceableComponent";
import { IDialogProps } from "../IDialogProps";
function iconFromPhase(phase: Phase) {
if (phase === Phase.Done) {
@ -29,10 +30,7 @@ function iconFromPhase(phase: Phase) {
}
}
interface IProps {
onFinished: (success: boolean) => void;
}
interface IProps extends IDialogProps {}
interface IState {
icon: string;
}