diff --git a/package.json b/package.json index 648630a253b..356eb7b6862 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@sentry/browser": "^8.0.0", "@testing-library/react-hooks": "^8.0.1", "@vector-im/compound-design-tokens": "^1.2.0", - "@vector-im/compound-web": "^4.9.0", + "@vector-im/compound-web": "^5.1.2", "@zxcvbn-ts/core": "^3.0.4", "@zxcvbn-ts/language-common": "^3.0.4", "@zxcvbn-ts/language-en": "^3.0.2", diff --git a/playwright/snapshots/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts/theme-panel-custom-theme-added-linux.png b/playwright/snapshots/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts/theme-panel-custom-theme-added-linux.png index ffde3eb92e2..d44c1073072 100644 Binary files a/playwright/snapshots/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts/theme-panel-custom-theme-added-linux.png and b/playwright/snapshots/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts/theme-panel-custom-theme-added-linux.png differ diff --git a/playwright/snapshots/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts/theme-panel-custom-theme-linux.png b/playwright/snapshots/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts/theme-panel-custom-theme-linux.png index 0a24053a1c4..76a0befd339 100644 Binary files a/playwright/snapshots/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts/theme-panel-custom-theme-linux.png and b/playwright/snapshots/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts/theme-panel-custom-theme-linux.png differ diff --git a/playwright/snapshots/settings/general-user-settings-tab.spec.ts/general-linux.png b/playwright/snapshots/settings/general-user-settings-tab.spec.ts/general-linux.png index 4fa467dd351..4cf8df1c326 100644 Binary files a/playwright/snapshots/settings/general-user-settings-tab.spec.ts/general-linux.png and b/playwright/snapshots/settings/general-user-settings-tab.spec.ts/general-linux.png differ diff --git a/playwright/snapshots/settings/general-user-settings-tab.spec.ts/general-smallscreen-linux.png b/playwright/snapshots/settings/general-user-settings-tab.spec.ts/general-smallscreen-linux.png index 0b5a08979d9..d0380e6a4fc 100644 Binary files a/playwright/snapshots/settings/general-user-settings-tab.spec.ts/general-smallscreen-linux.png and b/playwright/snapshots/settings/general-user-settings-tab.spec.ts/general-smallscreen-linux.png differ diff --git a/res/css/views/settings/_UserProfileSettings.pcss b/res/css/views/settings/_UserProfileSettings.pcss index f9ca149bf78..b1909dde12a 100644 --- a/res/css/views/settings/_UserProfileSettings.pcss +++ b/res/css/views/settings/_UserProfileSettings.pcss @@ -35,6 +35,7 @@ limitations under the License. .mx_UserProfileSettings_profile_controls_userId { width: 100%; + margin-top: var(--cpd-space-4x); .mx_CopyableText { margin-top: var(--cpd-space-1x); width: 100%; diff --git a/src/components/views/settings/ThemeChoicePanel.tsx b/src/components/views/settings/ThemeChoicePanel.tsx index e3df157d615..c22da69bedd 100644 --- a/src/components/views/settings/ThemeChoicePanel.tsx +++ b/src/components/views/settings/ThemeChoicePanel.tsx @@ -23,6 +23,8 @@ import { RadioControl, EditInPlace, IconButton, + ErrorMessage, + HelpMessage, } from "@vector-im/compound-web"; import { Icon as DeleteIcon } from "@vector-im/compound-design-tokens/icons/delete.svg"; import classNames from "classnames"; @@ -231,10 +233,9 @@ function CustomTheme({ theme }: CustomThemeProps): JSX.Element { ) => { setError(undefined); @@ -281,7 +282,10 @@ function CustomTheme({ theme }: CustomThemeProps): JSX.Element { await SettingsStore.setValue("custom_themes", null, SettingLevel.ACCOUNT, currentThemes); }} onCancel={clear} - /> + > + {_t("settings|appearance|custom_theme_help")} + {error && {error}} + ); diff --git a/src/components/views/settings/UserProfileSettings.tsx b/src/components/views/settings/UserProfileSettings.tsx index 6d1bccb30e9..af1c098cef3 100644 --- a/src/components/views/settings/UserProfileSettings.tsx +++ b/src/components/views/settings/UserProfileSettings.tsx @@ -16,7 +16,7 @@ limitations under the License. import React, { ChangeEvent, useCallback, useEffect, useMemo, useState } from "react"; import { logger } from "matrix-js-sdk/src/logger"; -import { EditInPlace, Alert } from "@vector-im/compound-web"; +import { EditInPlace, Alert, ErrorMessage } from "@vector-im/compound-web"; import { _t } from "../../../languageHandler"; import { OwnProfileStore } from "../../../stores/OwnProfileStore"; @@ -68,7 +68,6 @@ interface UserProfileSettingsProps { const UserProfileSettings: React.FC = ({ canSetDisplayName, canSetAvatar }) => { const [avatarURL, setAvatarURL] = useState(OwnProfileStore.instance.avatarMxc); const [displayName, setDisplayName] = useState(OwnProfileStore.instance.displayName ?? ""); - const [initialDisplayName, setInitialDisplayName] = useState(OwnProfileStore.instance.displayName ?? ""); const [avatarError, setAvatarError] = useState(false); const [maxUploadSize, setMaxUploadSize] = useState(); const [displayNameError, setDisplayNameError] = useState(false); @@ -135,7 +134,6 @@ const UserProfileSettings: React.FC = ({ canSetDisplay try { setDisplayNameError(false); await client.setDisplayName(displayName); - setInitialDisplayName(displayName); } catch (e) { setDisplayNameError(true); throw e; @@ -174,7 +172,6 @@ const UserProfileSettings: React.FC = ({ canSetDisplay className="mx_UserProfileSettings_profile_displayName" label={_t("settings|general|display_name")} value={displayName} - disableSaveButton={displayName === initialDisplayName} saveButtonLabel={_t("common|save")} cancelButtonLabel={_t("common|cancel")} savedLabel={_t("common|saved")} @@ -182,9 +179,10 @@ const UserProfileSettings: React.FC = ({ canSetDisplay onChange={onDisplayNameChanged} onCancel={onDisplayNameCancel} onSave={onDisplayNameSave} - error={displayNameError ? _t("settings|general|display_name_error") : undefined} disabled={!canSetDisplayName} - /> + > + {displayNameError && {_t("settings|general|display_name_error")}} + {avatarError && ( diff --git a/test/components/views/settings/__snapshots__/ThemeChoicePanel-test.tsx.snap b/test/components/views/settings/__snapshots__/ThemeChoicePanel-test.tsx.snap index ecbd1e38a4a..15889d241b7 100644 --- a/test/components/views/settings/__snapshots__/ThemeChoicePanel-test.tsx.snap +++ b/test/components/views/settings/__snapshots__/ThemeChoicePanel-test.tsx.snap @@ -19,20 +19,20 @@ exports[` custom theme should display custom theme 1`] = ` class="mx_SettingsSubsection_content mx_SettingsSubsection_content_newUi" > custom theme should display custom theme 1`] = ` Match system theme @@ -55,13 +55,13 @@ exports[` custom theme should display custom theme 1`] = ` custom theme should display custom theme 1`] = ` custom theme should display custom theme 1`] = ` Light custom theme should display custom theme 1`] = ` Dark custom theme should display custom theme 1`] = ` High contrast custom theme should display custom theme 1`] = ` Alice theme @@ -195,72 +195,36 @@ exports[` custom theme should display custom theme 1`] = ` class="mx_ThemeChoicePanel_CustomTheme" > - Add custom theme - - - + + Add custom theme + - - - - - - - - - - + + + Enter the URL of a custom theme you want to apply. + - - Enter the URL of a custom theme you want to apply. - custom theme should render the custom theme sectio class="mx_SettingsSubsection_content mx_SettingsSubsection_content_newUi" > custom theme should render the custom theme sectio Match system theme @@ -357,13 +321,13 @@ exports[` custom theme should render the custom theme sectio custom theme should render the custom theme sectio Light @@ -394,10 +358,10 @@ exports[` custom theme should render the custom theme sectio custom theme should render the custom theme sectio Dark @@ -427,10 +391,10 @@ exports[` custom theme should render the custom theme sectio custom theme should render the custom theme sectio High contrast @@ -460,10 +424,10 @@ exports[` custom theme should render the custom theme sectio custom theme should render the custom theme sectio Alice theme @@ -497,72 +461,36 @@ exports[` custom theme should render the custom theme sectio class="mx_ThemeChoicePanel_CustomTheme" > - Add custom theme - - - + + Add custom theme + - - - - - - - - - - + + + Enter the URL of a custom theme you want to apply. + - - Enter the URL of a custom theme you want to apply. - renders the theme choice UI 1`] = ` class="mx_SettingsSubsection_content mx_SettingsSubsection_content_newUi" > renders the theme choice UI 1`] = ` Match system theme @@ -659,13 +587,13 @@ exports[` renders the theme choice UI 1`] = ` renders the theme choice UI 1`] = ` Light @@ -696,10 +624,10 @@ exports[` renders the theme choice UI 1`] = ` renders the theme choice UI 1`] = ` Dark @@ -729,10 +657,10 @@ exports[` renders the theme choice UI 1`] = ` renders the theme choice UI 1`] = ` High contrast diff --git a/test/components/views/settings/tabs/user/__snapshots__/AppearanceUserSettingsTab-test.tsx.snap b/test/components/views/settings/tabs/user/__snapshots__/AppearanceUserSettingsTab-test.tsx.snap index 20d18bc65be..460c788ae2f 100644 --- a/test/components/views/settings/tabs/user/__snapshots__/AppearanceUserSettingsTab-test.tsx.snap +++ b/test/components/views/settings/tabs/user/__snapshots__/AppearanceUserSettingsTab-test.tsx.snap @@ -32,13 +32,13 @@ exports[`AppearanceUserSettingsTab should render 1`] = ` class="mx_SettingsSubsection_content mx_SettingsSubsection_content_newUi" > Light @@ -69,10 +69,10 @@ exports[`AppearanceUserSettingsTab should render 1`] = ` Dark @@ -103,10 +103,10 @@ exports[`AppearanceUserSettingsTab should render 1`] = ` High contrast diff --git a/yarn.lock b/yarn.lock index 9b0b1dbbef0..0e2acf9b55a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3045,10 +3045,10 @@ dependencies: svg2vectordrawable "^2.9.1" -"@vector-im/compound-web@^4.9.0": - version "4.10.0" - resolved "https://registry.yarnpkg.com/@vector-im/compound-web/-/compound-web-4.10.0.tgz#5403c9933af91d432b5fb5f92a305acadc810893" - integrity sha512-SPeol6FK/h/q8ChHyuCCncUIVoIGNdPODBf7UqvaohRjt8EzyAAHKP89l1YhWKqEaOtG67+28IXoFvdS46tbUA== +"@vector-im/compound-web@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@vector-im/compound-web/-/compound-web-5.1.2.tgz#2ee3d859819e153c898770c058a4277c0b8ef3b8" + integrity sha512-p7ide2JRblCkcSMPNakkWjK9GxA8boMQCEgXCT7Dp+owhONf2QsYpyRzlW+tPZ3DULd+h4nqWRova4uSeZtBbA== dependencies: "@floating-ui/react" "^0.26.9" "@floating-ui/react-dom" "^2.0.8"