diff --git a/src/components/views/elements/RoomAliasField.js b/src/components/views/elements/RoomAliasField.js
index d3de6a5d34..ee18913971 100644
--- a/src/components/views/elements/RoomAliasField.js
+++ b/src/components/views/elements/RoomAliasField.js
@@ -45,7 +45,7 @@ export default class RoomAliasField extends React.PureComponent {
const maxlength = 255 - this.props.domain.length - 2; // 2 for # and :
return (
allowEmpty || !!value,
- invalid: () => _t("Please provide a room alias"),
+ invalid: () => _t("Please provide a room address"),
}, {
key: "taken",
final: true,
@@ -107,8 +107,8 @@ export default class RoomAliasField extends React.PureComponent {
return !!err.errcode;
}
},
- valid: () => _t("This alias is available to use"),
- invalid: () => _t("This alias is already in use"),
+ valid: () => _t("This address is available to use"),
+ invalid: () => _t("This address is already in use"),
},
],
});
diff --git a/src/components/views/room_settings/AliasSettings.js b/src/components/views/room_settings/AliasSettings.js
index 3994d78390..37d1e66e98 100644
--- a/src/components/views/room_settings/AliasSettings.js
+++ b/src/components/views/room_settings/AliasSettings.js
@@ -220,10 +220,10 @@ export default class AliasSettings extends React.Component {
}
}).catch((err) => {
console.error(err);
- Modal.createTrackedDialog('Error creating alias', '', ErrorDialog, {
- title: _t("Error creating alias"),
+ Modal.createTrackedDialog('Error creating address', '', ErrorDialog, {
+ title: _t("Error creating address"),
description: _t(
- "There was an error creating that alias. It may not be allowed by the server " +
+ "There was an error creating that address. It may not be allowed by the server " +
"or a temporary failure occurred.",
),
});
@@ -245,15 +245,15 @@ export default class AliasSettings extends React.Component {
console.error(err);
let description;
if (err.errcode === "M_FORBIDDEN") {
- description = _t("You don't have permission to delete the alias.");
+ description = _t("You don't have permission to delete the address.");
} else {
description = _t(
- "There was an error removing that alias. It may no longer exist or a temporary " +
+ "There was an error removing that address. It may no longer exist or a temporary " +
"error occurred.",
);
}
- Modal.createTrackedDialog('Error removing alias', '', ErrorDialog, {
- title: _t("Error removing alias"),
+ Modal.createTrackedDialog('Error removing address', '', ErrorDialog, {
+ title: _t("Error removing address"),
description,
});
});
diff --git a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js
index eb2b885a22..c67596a3a5 100644
--- a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js
+++ b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js
@@ -247,7 +247,7 @@ export default class SecurityRoomSettingsTab extends React.Component {
- {_t("To link to this room, please add an alias.")}
+ {_t("To link to this room, please add an address.")}
);
diff --git a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js
index d22b7ec183..f1fe5f2556 100644
--- a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js
+++ b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js
@@ -84,7 +84,7 @@ export default class MjolnirUserSettingsTab extends React.Component {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Failed to subscribe to Mjolnir list', '', ErrorDialog, {
title: _t('Error subscribing to list'),
- description: _t('Please verify the room ID or alias and try again.'),
+ description: _t('Please verify the room ID or address and try again.'),
});
} finally {
this.setState({busy: false});
@@ -305,7 +305,7 @@ export default class MjolnirUserSettingsTab extends React.Component {
;
diff --git a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js
index 12b71206d0..e6ab07c449 100644
--- a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js
+++ b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js
@@ -538,8 +538,10 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
const Field = sdk.getComponent('views.elements.Field');
let matchText;
+ let changeText;
if (this.state.passPhraseConfirm === this.state.passPhrase) {
matchText = _t("That matches!");
+ changeText = _t("Use a different passphrase?");
} else if (!this.state.passPhrase.startsWith(this.state.passPhraseConfirm)) {
// only tell them they're wrong if they've actually gone wrong.
// Security concious readers will note that if you left riot-web unattended
@@ -549,6 +551,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
// Note that not having typed anything at all will not hit this clause and
// fall through so empty box === no hint.
matchText = _t("That doesn't match.");
+ changeText = _t("Go back to set it again.");
}
let passPhraseMatch = null;
@@ -557,7 +560,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
{matchText}
- {_t("Go back to set it again.")}
+ {changeText}
;
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 96ccf1589d..ded320250b 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -2217,6 +2217,7 @@
"Back up encrypted message keys": "Back up encrypted message keys",
"Set up with a recovery key": "Set up with a recovery key",
"That matches!": "That matches!",
+ "Use a different passphrase?": "Use a different passphrase?",
"That doesn't match.": "That doesn't match.",
"Go back to set it again.": "Go back to set it again.",
"Enter your recovery passphrase a second time to confirm it.": "Enter your recovery passphrase a second time to confirm it.",
From 63f78b0808f89dc0fbffd70cc3d176d45d1a57b3 Mon Sep 17 00:00:00 2001
From: Jorik Schellekens
Date: Mon, 25 May 2020 13:40:05 +0100
Subject: [PATCH 071/114] Move tooltip to ts
---
package.json | 2 +
.../views/elements/{Field.js => Field.tsx} | 159 ++++++++++--------
.../elements/{Tooltip.js => Tooltip.tsx} | 86 +++++-----
.../views/settings/account/PhoneNumbers.js | 2 +-
src/dispatcher/actions.ts | 5 +
src/dispatcher/payloads/ViewUserPayload.ts | 17 ++
yarn.lock | 12 ++
7 files changed, 170 insertions(+), 113 deletions(-)
rename src/components/views/elements/{Field.js => Field.tsx} (67%)
rename src/components/views/elements/{Tooltip.js => Tooltip.tsx} (71%)
diff --git a/package.json b/package.json
index 7c008d5ccc..620957dd04 100644
--- a/package.json
+++ b/package.json
@@ -118,9 +118,11 @@
"@peculiar/webcrypto": "^1.0.22",
"@types/classnames": "^2.2.10",
"@types/flux": "^3.1.9",
+ "@types/lodash": "^4.14.152",
"@types/modernizr": "^3.5.3",
"@types/qrcode": "^1.3.4",
"@types/react": "16.9",
+ "@types/react-dom": "^16.9.8",
"@types/zxcvbn": "^4.4.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
diff --git a/src/components/views/elements/Field.js b/src/components/views/elements/Field.tsx
similarity index 67%
rename from src/components/views/elements/Field.js
rename to src/components/views/elements/Field.tsx
index 2ebb90da26..100a6ebf56 100644
--- a/src/components/views/elements/Field.js
+++ b/src/components/views/elements/Field.tsx
@@ -15,10 +15,9 @@ limitations under the License.
*/
import React from 'react';
-import PropTypes from 'prop-types';
import classNames from 'classnames';
import * as sdk from '../../../index';
-import { debounce } from 'lodash';
+import { debounce, Cancelable } from 'lodash';
// Invoke validation from user input (when typing, etc.) at most once every N ms.
const VALIDATION_THROTTLE_MS = 200;
@@ -29,51 +28,88 @@ function getId() {
return `${BASE_ID}_${count++}`;
}
-export default class Field extends React.PureComponent {
- static propTypes = {
- // The field's ID, which binds the input and label together. Immutable.
- id: PropTypes.string,
- // The element to create. Defaults to "input".
- // To define options for a select, use
- element: PropTypes.oneOf(["input", "select", "textarea"]),
- // The field's type (when used as an ). Defaults to "text".
- type: PropTypes.string,
- // id of a