Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit e2c5dc6

Browse files
authored
Merge pull request #3300 from matrix-org/dbkr/change_is
Add UI in settings to change ID Server
2 parents a5cac02 + f883495 commit e2c5dc6

File tree

13 files changed

+273
-20
lines changed

13 files changed

+273
-20
lines changed

.stylelintrc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ module.exports = {
1515
"number-leading-zero": null,
1616
"selector-list-comma-newline-after": null,
1717
"at-rule-no-unknown": null,
18-
"scss/at-rule-no-unknown": true,
18+
"scss/at-rule-no-unknown": [true, {
19+
// https://github.com/vector-im/riot-web/issues/10544
20+
"ignoreAtRules": ["define-mixin"],
21+
}],
1922
}
2023
}

res/css/_common.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,3 +559,7 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus {
559559
.mx_Username_color8 {
560560
color: $username-variant8-color;
561561
}
562+
563+
@define-mixin mx_Settings_fullWidthField {
564+
margin-right: 200px;
565+
}

res/css/_components.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
@import "./views/settings/_Notifications.scss";
169169
@import "./views/settings/_PhoneNumbers.scss";
170170
@import "./views/settings/_ProfileSettings.scss";
171+
@import "./views/settings/_SetIdServer.scss";
171172
@import "./views/settings/tabs/_SettingsTab.scss";
172173
@import "./views/settings/tabs/room/_GeneralRoomSettingsTab.scss";
173174
@import "./views/settings/tabs/room/_RolesRoomSettingsTab.scss";

res/css/views/elements/_Tooltip.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ limitations under the License.
5555
border-radius: 4px;
5656
box-shadow: 4px 4px 12px 0 $menu-box-shadow-color;
5757
background-color: $menu-bg-color;
58-
z-index: 2000;
58+
z-index: 4000; // Higher than dialogs so tooltips can be used in dialogs
5959
padding: 10px;
6060
pointer-events: none;
6161
line-height: 14px;

res/css/views/settings/_ProfileSettings.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ limitations under the License.
2626
height: 4em;
2727
}
2828

29+
.mx_ProfileSettings_controls .mx_Field {
30+
margin-right: 100px;
31+
}
32+
2933
.mx_ProfileSettings_controls .mx_Field:first-child {
3034
margin-top: 0;
3135
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
Copyright 2019 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
.mx_SetIdServer .mx_Field_input {
18+
@mixin mx_Settings_fullWidthField;
19+
}

res/css/views/settings/tabs/user/_GeneralUserSettingsTab.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616

1717
.mx_GeneralUserSettingsTab_changePassword .mx_Field,
1818
.mx_GeneralUserSettingsTab_themeSection .mx_Field {
19-
margin-right: 100px; // Align with the other fields on the page
19+
@mixin mx_Settings_fullWidthField;
2020
}
2121

2222
.mx_GeneralUserSettingsTab_changePassword .mx_Field:first-child {
@@ -26,5 +26,5 @@ limitations under the License.
2626
.mx_GeneralUserSettingsTab_accountSection .mx_EmailAddresses,
2727
.mx_GeneralUserSettingsTab_accountSection .mx_PhoneNumbers,
2828
.mx_GeneralUserSettingsTab_languageInput {
29-
margin-right: 100px; // Align with the other fields on the page
29+
@mixin mx_Settings_fullWidthField;
3030
}

res/css/views/settings/tabs/user/_PreferencesUserSettingsTab.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ limitations under the License.
1515
*/
1616

1717
.mx_PreferencesUserSettingsTab .mx_Field {
18-
margin-right: 100px; // Align with the rest of the controls
18+
@mixin mx_Settings_fullWidthField;
1919
}

res/css/views/settings/tabs/user/_VoiceUserSettingsTab.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
.mx_VoiceUserSettingsTab .mx_Field {
18-
margin-right: 100px; // align with the rest of the fields
18+
@mixin mx_Settings_fullWidthField;
1919
}
2020

2121
.mx_VoiceUserSettingsTab_missingMediaPermissions {

src/components/views/elements/Field.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export default class Field extends React.PureComponent {
4646
// and a `feedback` react component field to provide feedback
4747
// to the user.
4848
onValidate: PropTypes.func,
49+
// If specified, contents will appear as a tooltip on the element and
50+
// validation feedback tooltips will be suppressed.
51+
tooltipContent: PropTypes.node,
4952
// All other props pass through to the <input>.
5053
};
5154

@@ -134,7 +137,7 @@ export default class Field extends React.PureComponent {
134137
}, VALIDATION_THROTTLE_MS);
135138

136139
render() {
137-
const { element, prefix, onValidate, children, ...inputProps } = this.props;
140+
const { element, prefix, onValidate, children, tooltipContent, ...inputProps } = this.props;
138141

139142
const inputElement = element || "input";
140143

@@ -165,20 +168,20 @@ export default class Field extends React.PureComponent {
165168

166169
// Handle displaying feedback on validity
167170
const Tooltip = sdk.getComponent("elements.Tooltip");
168-
let tooltip;
169-
if (this.state.feedback) {
170-
tooltip = <Tooltip
171+
let fieldTooltip;
172+
if (tooltipContent || this.state.feedback) {
173+
fieldTooltip = <Tooltip
171174
tooltipClassName="mx_Field_tooltip"
172175
visible={this.state.feedbackVisible}
173-
label={this.state.feedback}
176+
label={tooltipContent || this.state.feedback}
174177
/>;
175178
}
176179

177180
return <div className={fieldClasses}>
178181
{prefixContainer}
179182
{fieldInput}
180183
<label htmlFor={this.props.id}>{this.props.label}</label>
181-
{tooltip}
184+
{fieldTooltip}
182185
</div>;
183186
}
184187
}

0 commit comments

Comments
 (0)