From c6d97c7fc561e82ddec3b9fd40f62e0f9f7fb2a9 Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Tue, 16 Nov 2021 18:23:39 +0300 Subject: [PATCH 1/6] Web: Components: add avatar max size label --- packages/asc-web-components/avatar-editor/index.js | 3 +++ .../sub-components/avatar-editor-body.js | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/asc-web-components/avatar-editor/index.js b/packages/asc-web-components/avatar-editor/index.js index 5447358c93..f675240a00 100644 --- a/packages/asc-web-components/avatar-editor/index.js +++ b/packages/asc-web-components/avatar-editor/index.js @@ -131,6 +131,7 @@ class AvatarEditor extends React.Component { saveButtonLoading, useModalDialog, cancelButtonLabel, + maxSizeLabel, } = this.props; return useModalDialog ? ( @@ -165,6 +166,7 @@ class AvatarEditor extends React.Component { unknownTypeError={unknownTypeError} maxSizeFileError={maxSizeFileError} unknownError={unknownError} + maxSizeLabel={maxSizeLabel} /> @@ -271,6 +273,7 @@ AvatarEditor.propTypes = { style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), /** Use for the view of the modal dialog or not */ useModalDialog: PropTypes.bool, + maxSizeLabel: PropTypes.string, }; AvatarEditor.defaultProps = { diff --git a/packages/asc-web-components/avatar-editor/sub-components/avatar-editor-body.js b/packages/asc-web-components/avatar-editor/sub-components/avatar-editor-body.js index 8648565a7e..f6f59adb4a 100644 --- a/packages/asc-web-components/avatar-editor/sub-components/avatar-editor-body.js +++ b/packages/asc-web-components/avatar-editor/sub-components/avatar-editor-body.js @@ -326,7 +326,14 @@ class AvatarEditorBody extends React.Component { }; render() { - const { maxSize, accept, role, title, useModalDialog } = this.props; + const { + maxSize, + accept, + role, + title, + useModalDialog, + maxSizeLabel, + } = this.props; const desktopMode = isDesktop(); //const tabletMode = isTablet(); @@ -483,6 +490,10 @@ class AvatarEditorBody extends React.Component { )} + + {maxSizeLabel} + + {this.state.errorText !== null && ( @@ -514,6 +525,7 @@ AvatarEditorBody.propTypes = { role: PropTypes.string, title: PropTypes.string, useModalDialog: PropTypes.bool, + maxSizeLabel: PropTypes.string, }; AvatarEditorBody.defaultProps = { From e0f297bf0a16321abcde9b2c636105085b295f56 Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Tue, 16 Nov 2021 18:24:02 +0300 Subject: [PATCH 2/6] Web: People: add translations --- products/ASC.People/Client/public/locales/de/Translations.json | 3 ++- products/ASC.People/Client/public/locales/en/Translations.json | 3 ++- products/ASC.People/Client/public/locales/ru/Translations.json | 3 ++- .../Client/src/pages/Profile/Section/Header/index.js | 1 + .../src/pages/ProfileAction/Section/Body/avatarEditorPage.js | 1 + .../pages/ProfileAction/Section/Body/createAvatarEditorPage.js | 1 + .../src/pages/ProfileAction/Section/Body/createUserForm.js | 1 + .../src/pages/ProfileAction/Section/Body/updateUserForm.js | 1 + 8 files changed, 11 insertions(+), 3 deletions(-) diff --git a/products/ASC.People/Client/public/locales/de/Translations.json b/products/ASC.People/Client/public/locales/de/Translations.json index 3dd1dbf4f1..26cc6eb8d1 100644 --- a/products/ASC.People/Client/public/locales/de/Translations.json +++ b/products/ASC.People/Client/public/locales/de/Translations.json @@ -25,5 +25,6 @@ "SocialProfiles": "Soziale Profile", "SuccessChangeUserStatus": "Der Benutzerstatus war erfolgreich geändert", "SuccessSentInvitation": "Die Einladung wurde erfolgreich gesendet", - "Birthdate": "Geburtsdatum" + "Birthdate": "Geburtsdatum", + "maxSizeLabel": "(JPG oder PNG, maximal 1 MB)" } diff --git a/products/ASC.People/Client/public/locales/en/Translations.json b/products/ASC.People/Client/public/locales/en/Translations.json index a6fd9c6b20..eb69f66770 100644 --- a/products/ASC.People/Client/public/locales/en/Translations.json +++ b/products/ASC.People/Client/public/locales/en/Translations.json @@ -26,5 +26,6 @@ "SuccessChangeUserStatus": "The user status was successfully changed", "SuccessSentInvitation": "The invitation was successfully sent", "SuccessDeletePersonalData": "Personal data has been successfully deleted", - "Birthdate": "Date of birth" + "Birthdate": "Date of birth", + "maxSizeLabel": "(JPG or PNG, max 1 MB)" } diff --git a/products/ASC.People/Client/public/locales/ru/Translations.json b/products/ASC.People/Client/public/locales/ru/Translations.json index 00c37976d2..c908dfd813 100644 --- a/products/ASC.People/Client/public/locales/ru/Translations.json +++ b/products/ASC.People/Client/public/locales/ru/Translations.json @@ -26,5 +26,6 @@ "SuccessChangeUserStatus": "Статус пользователя успешно изменен", "SuccessSentInvitation": "Приглашение было успешно отправлено", "SuccessDeletePersonalData": "Персональные данные успешно удалены", - "Birthdate": "Дата рождения" + "Birthdate": "Дата рождения", + "maxSizeLabel": "(JPG или PNG, максимум 1 Мб)" } diff --git a/products/ASC.People/Client/src/pages/Profile/Section/Header/index.js b/products/ASC.People/Client/src/pages/Profile/Section/Header/index.js index a038ab85a6..b638cd0db3 100644 --- a/products/ASC.People/Client/src/pages/Profile/Section/Header/index.js +++ b/products/ASC.People/Client/src/pages/Profile/Section/Header/index.js @@ -476,6 +476,7 @@ class SectionHeaderContent extends React.PureComponent { maxSizeFileError={t("Translations:maxSizeFileError")} unknownError={t("Common:Error")} saveButtonLabel={t("Common:SaveButton")} + maxSizeLabel={t("Translations:maxSizeLabel")} /> {dialogsVisible.deleteSelfProfile && ( diff --git a/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/avatarEditorPage.js b/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/avatarEditorPage.js index b81b5a28e6..5e8c8a3f81 100644 --- a/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/avatarEditorPage.js +++ b/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/avatarEditorPage.js @@ -304,6 +304,7 @@ class AvatarEditorPage extends React.PureComponent { } cancelButtonLabel={t("Common:CancelButton")} saveButtonLoading={this.state.isLoading} + maxSizeLabel={t("Translations:maxSizeLabel")} /> ) : ( diff --git a/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createAvatarEditorPage.js b/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createAvatarEditorPage.js index 1c3a02ec2a..a83c84c3bd 100644 --- a/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createAvatarEditorPage.js +++ b/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createAvatarEditorPage.js @@ -267,6 +267,7 @@ class CreateAvatarEditorPage extends React.PureComponent { } cancelButtonLabel={t("Common:CancelButton")} saveButtonLoading={this.state.isLoading} + maxSizeLabel={t("Translations:maxSizeLabel")} /> ) : ( diff --git a/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createUserForm.js b/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createUserForm.js index f96233ad15..6dc3dd9058 100644 --- a/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createUserForm.js +++ b/products/ASC.People/Client/src/pages/ProfileAction/Section/Body/createUserForm.js @@ -489,6 +489,7 @@ class CreateUserForm extends React.Component { maxSizeFileError={t("Translations:maxSizeFileError")} unknownError={t("Common:Error")} saveButtonLabel={t("Common:SaveButton")} + maxSizeLabel={t("Translations:maxSizeLabel")} /> Date: Thu, 18 Nov 2021 18:40:14 +0300 Subject: [PATCH 3/6] Web: Components: fix label position --- .../sub-components/avatar-editor-body.js | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/packages/asc-web-components/avatar-editor/sub-components/avatar-editor-body.js b/packages/asc-web-components/avatar-editor/sub-components/avatar-editor-body.js index f6f59adb4a..56f735b095 100644 --- a/packages/asc-web-components/avatar-editor/sub-components/avatar-editor-body.js +++ b/packages/asc-web-components/avatar-editor/sub-components/avatar-editor-body.js @@ -307,10 +307,18 @@ class AvatarEditorBody extends React.Component { }; renderLinkContainer = () => { - const { selectNewPhotoLabel, orDropFileHereLabel } = this.props; + const { + selectNewPhotoLabel, + orDropFileHereLabel, + maxSizeLabel, + } = this.props; + const { image } = this.state; + const desktopMode = isDesktop(); + const labelAlign = image === "" ? "center" : "left"; + return ( - + {" "} {desktopMode && orDropFileHereLabel} + + {maxSizeLabel} + ); }; render() { - const { - maxSize, - accept, - role, - title, - useModalDialog, - maxSizeLabel, - } = this.props; + const { maxSize, accept, role, title, useModalDialog } = this.props; const desktopMode = isDesktop(); //const tabletMode = isTablet(); @@ -490,9 +500,6 @@ class AvatarEditorBody extends React.Component { )} - - {maxSizeLabel} - {this.state.errorText !== null && ( From 2720604f8d14c4a17aa6bce88d0983c58bc0ac7c Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Thu, 18 Nov 2021 18:53:35 +0300 Subject: [PATCH 4/6] Web: Components: fix mobile align --- packages/asc-web-components/avatar-editor/index.js | 1 + .../avatar-editor/sub-components/avatar-editor-body.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/asc-web-components/avatar-editor/index.js b/packages/asc-web-components/avatar-editor/index.js index f675240a00..164ddcbb96 100644 --- a/packages/asc-web-components/avatar-editor/index.js +++ b/packages/asc-web-components/avatar-editor/index.js @@ -201,6 +201,7 @@ class AvatarEditor extends React.Component { maxSizeFileError={maxSizeFileError} unknownError={unknownError} useModalDialog={false} + maxSizeLabel={maxSizeLabel} />