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

Commit 53ea045

Browse files
authored
Update @vector-im/compound-web (#12718)
* deps: update `@vector-im/compound-web` * feat: use new EditInPlace * e2e: update snapshots
1 parent 510fb1b commit 53ea045

File tree

11 files changed

+148
-217
lines changed

11 files changed

+148
-217
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"@sentry/browser": "^8.0.0",
8080
"@testing-library/react-hooks": "^8.0.1",
8181
"@vector-im/compound-design-tokens": "^1.2.0",
82-
"@vector-im/compound-web": "^4.9.0",
82+
"@vector-im/compound-web": "^5.1.2",
8383
"@zxcvbn-ts/core": "^3.0.4",
8484
"@zxcvbn-ts/language-common": "^3.0.4",
8585
"@zxcvbn-ts/language-en": "^3.0.2",
Loading
Loading

res/css/views/settings/_UserProfileSettings.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ limitations under the License.
3535

3636
.mx_UserProfileSettings_profile_controls_userId {
3737
width: 100%;
38+
margin-top: var(--cpd-space-4x);
3839
.mx_CopyableText {
3940
margin-top: var(--cpd-space-1x);
4041
width: 100%;

src/components/views/settings/ThemeChoicePanel.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import {
2323
RadioControl,
2424
EditInPlace,
2525
IconButton,
26+
ErrorMessage,
27+
HelpMessage,
2628
} from "@vector-im/compound-web";
2729
import { Icon as DeleteIcon } from "@vector-im/compound-design-tokens/icons/delete.svg";
2830
import classNames from "classnames";
@@ -231,10 +233,9 @@ function CustomTheme({ theme }: CustomThemeProps): JSX.Element {
231233
<EditInPlace
232234
className="mx_ThemeChoicePanel_CustomTheme_EditInPlace"
233235
label={_t("settings|appearance|custom_theme_add")}
236+
cancelButtonLabel={_t("action|cancel")}
234237
saveButtonLabel={_t("settings|appearance|custom_theme_add")}
235238
savingLabel={_t("settings|appearance|custom_theme_downloading")}
236-
helpLabel={_t("settings|appearance|custom_theme_help")}
237-
error={error}
238239
value={customTheme}
239240
onChange={(e: ChangeEvent<HTMLInputElement>) => {
240241
setError(undefined);
@@ -281,7 +282,10 @@ function CustomTheme({ theme }: CustomThemeProps): JSX.Element {
281282
await SettingsStore.setValue("custom_themes", null, SettingLevel.ACCOUNT, currentThemes);
282283
}}
283284
onCancel={clear}
284-
/>
285+
>
286+
<HelpMessage>{_t("settings|appearance|custom_theme_help")}</HelpMessage>
287+
{error && <ErrorMessage>{error}</ErrorMessage>}
288+
</EditInPlace>
285289
<CustomThemeList theme={theme} />
286290
</div>
287291
);

src/components/views/settings/UserProfileSettings.tsx

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

1717
import React, { ChangeEvent, useCallback, useEffect, useMemo, useState } from "react";
1818
import { logger } from "matrix-js-sdk/src/logger";
19-
import { EditInPlace, Alert } from "@vector-im/compound-web";
19+
import { EditInPlace, Alert, ErrorMessage } from "@vector-im/compound-web";
2020

2121
import { _t } from "../../../languageHandler";
2222
import { OwnProfileStore } from "../../../stores/OwnProfileStore";
@@ -68,7 +68,6 @@ interface UserProfileSettingsProps {
6868
const UserProfileSettings: React.FC<UserProfileSettingsProps> = ({ canSetDisplayName, canSetAvatar }) => {
6969
const [avatarURL, setAvatarURL] = useState(OwnProfileStore.instance.avatarMxc);
7070
const [displayName, setDisplayName] = useState(OwnProfileStore.instance.displayName ?? "");
71-
const [initialDisplayName, setInitialDisplayName] = useState(OwnProfileStore.instance.displayName ?? "");
7271
const [avatarError, setAvatarError] = useState<boolean>(false);
7372
const [maxUploadSize, setMaxUploadSize] = useState<number | undefined>();
7473
const [displayNameError, setDisplayNameError] = useState<boolean>(false);
@@ -135,7 +134,6 @@ const UserProfileSettings: React.FC<UserProfileSettingsProps> = ({ canSetDisplay
135134
try {
136135
setDisplayNameError(false);
137136
await client.setDisplayName(displayName);
138-
setInitialDisplayName(displayName);
139137
} catch (e) {
140138
setDisplayNameError(true);
141139
throw e;
@@ -174,17 +172,17 @@ const UserProfileSettings: React.FC<UserProfileSettingsProps> = ({ canSetDisplay
174172
className="mx_UserProfileSettings_profile_displayName"
175173
label={_t("settings|general|display_name")}
176174
value={displayName}
177-
disableSaveButton={displayName === initialDisplayName}
178175
saveButtonLabel={_t("common|save")}
179176
cancelButtonLabel={_t("common|cancel")}
180177
savedLabel={_t("common|saved")}
181178
savingLabel={_t("common|updating")}
182179
onChange={onDisplayNameChanged}
183180
onCancel={onDisplayNameCancel}
184181
onSave={onDisplayNameSave}
185-
error={displayNameError ? _t("settings|general|display_name_error") : undefined}
186182
disabled={!canSetDisplayName}
187-
/>
183+
>
184+
{displayNameError && <ErrorMessage>{_t("settings|general|display_name_error")}</ErrorMessage>}
185+
</EditInPlace>
188186
</div>
189187
{avatarError && (
190188
<Alert title={_t("settings|general|avatar_upload_error_title")} type="critical">

0 commit comments

Comments
 (0)