From a9355c4ea68fce2701731ea24ed512d988a25dbb Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Mon, 3 Apr 2023 14:43:01 +0400 Subject: [PATCH] Web: Added new LiveChat and BookTraining menu to Profile --- .../client/src/store/ProfileActionsStore.js | 66 ++++++++++++++++--- packages/common/store/SettingsStore.js | 3 + public/images/book.training.react.svg | 6 ++ public/locales/en/Common.json | 2 + 4 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 public/images/book.training.react.svg diff --git a/packages/client/src/store/ProfileActionsStore.js b/packages/client/src/store/ProfileActionsStore.js index 8e09b82a28..d0a2d4151b 100644 --- a/packages/client/src/store/ProfileActionsStore.js +++ b/packages/client/src/store/ProfileActionsStore.js @@ -3,8 +3,10 @@ import HotkeysReactSvgUrl from "PUBLIC_DIR/images/hotkeys.react.svg?url"; import ProfileReactSvgUrl from "PUBLIC_DIR/images/profile.react.svg?url"; import PaymentsReactSvgUrl from "PUBLIC_DIR/images/payments.react.svg?url"; import HelpCenterReactSvgUrl from "PUBLIC_DIR/images/help.center.react.svg?url"; -import SupportReactSvgUrl from "PUBLIC_DIR/images/support.react.svg?url"; -import VideoGuidesReactSvgUrl from "PUBLIC_DIR/images/video.guides.react.svg?url"; +import EmailReactSvgUrl from "PUBLIC_DIR/images/email.react.svg?url"; +import LiveChatReactSvgUrl from "PUBLIC_DIR/images/support.react.svg?url"; +import BookTrainingReactSvgUrl from "PUBLIC_DIR/images/book.training.react.svg?url"; +//import VideoGuidesReactSvgUrl from "PUBLIC_DIR/images/video.guides.react.svg?url"; import InfoOutlineReactSvgUrl from "PUBLIC_DIR/images/info.outline.react.svg?url"; import LogoutReactSvgUrl from "PUBLIC_DIR/images/logout.react.svg?url"; import { makeAutoObservable } from "mobx"; @@ -93,6 +95,10 @@ class ProfileActionsStore { window.open(helpUrl, "_blank"); }; + onLiveChatClick = () => { + //window.open(supportUrl, "_blank"); + }; + onSupportClick = () => { const supportUrl = this.authStore.settingsStore.additionalResourcesData ?.feedbackAndSupportUrl; @@ -100,6 +106,13 @@ class ProfileActionsStore { window.open(supportUrl, "_blank"); }; + onBookTraining = () => { + const trainingEmail = this.authStore.settingsStore.additionalResourcesData + ?.trainingEmail; + + trainingEmail && window.open(`mailto:${trainingEmail}`, "_blank"); + }; + // onVideoGuidesClick = () => { // window.open(VIDEO_GUIDES_URL, "_blank"); // }; @@ -173,6 +186,29 @@ class ProfileActionsStore { }; } // } + + let liveChat = null; + + if (!isMobile) { + liveChat = { + key: "user-menu-live-chat", + icon: LiveChatReactSvgUrl, + label: t("Common:LiveChat"), + onClick: this.onLiveChatClick, + }; + } + + let bookTraining = null; + + if (!isMobile) { + bookTraining = { + key: "user-menu-book-training", + icon: BookTrainingReactSvgUrl, + label: t("Common:BookTraining"), + onClick: this.onBookTraining, + }; + } + const actions = [ { key: "user-menu-profile", @@ -187,18 +223,16 @@ class ProfileActionsStore { label: t("Common:PaymentsTitle"), onClick: this.onPaymentsClick, }, + { + isSeparator: true, + key: "separator1", + }, { key: "user-menu-help-center", icon: HelpCenterReactSvgUrl, label: t("Common:HelpCenter"), onClick: this.onHelpCenterClick, }, - { - key: "user-menu-support", - icon: SupportReactSvgUrl, - label: t("Common:FeedbackAndSupport"), - onClick: this.onSupportClick, - }, // { // key: "user-menu-video", // icon: VideoGuidesReactSvgUrl, @@ -206,6 +240,18 @@ class ProfileActionsStore { // onClick: this.onVideoGuidesClick, // }, hotkeys, + { + isSeparator: true, + key: "separator2", + }, + liveChat, + { + key: "user-menu-support", + icon: EmailReactSvgUrl, + label: t("Common:FeedbackAndSupport"), + onClick: this.onSupportClick, + }, + bookTraining, { key: "user-menu-about", icon: InfoOutlineReactSvgUrl, @@ -214,7 +260,7 @@ class ProfileActionsStore { }, { isSeparator: true, - key: "separator", + key: "separator3", }, { key: "user-menu-logout", @@ -226,7 +272,7 @@ class ProfileActionsStore { ]; if (debugInfo) { - actions.splice(3, 0, { + actions.splice(4, 0, { key: "user-menu-debug", icon: InfoOutlineReactSvgUrl, label: "Debug Info", diff --git a/packages/common/store/SettingsStore.js b/packages/common/store/SettingsStore.js index 392f38ed7f..caa622b8f1 100644 --- a/packages/common/store/SettingsStore.js +++ b/packages/common/store/SettingsStore.js @@ -389,6 +389,9 @@ class SettingsStore { setAdditionalResourcesData = (data) => { this.additionalResourcesData = data; + if (!this.additionalResourcesData?.trainingEmail) { + this.additionalResourcesData.trainingEmail = "training@onlyoffice.com"; + } }; setAdditionalResourcesIsDefault = (additionalResourcesIsDefault) => { diff --git a/public/images/book.training.react.svg b/public/images/book.training.react.svg new file mode 100644 index 0000000000..d5f35b93a6 --- /dev/null +++ b/public/images/book.training.react.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/public/locales/en/Common.json b/public/locales/en/Common.json index a69e60d2dc..668d40b64c 100644 --- a/public/locales/en/Common.json +++ b/public/locales/en/Common.json @@ -20,6 +20,7 @@ "Audio": "Audio", "BarMaintenanceDescription": "We apologize for any short-term technical issues in service functioning that may appear on {{targetDate}} during the update of {{productName}}.", "BarMaintenanceDisclaimer": "Please, make sure that all the changes are successfully saved during this day.", + "BookTraining": "Book a training", "ByFirstNameSorting": "By first name", "ByLastNameSorting": "By last name", "Bytes": "bytes", @@ -124,6 +125,7 @@ "LastName": "Last name", "LatePayment": "Late payment", "LearnMore": "Learn more", + "LiveChat": "Live chat", "Load": "Load", "LoadingDescription": "Please wait...", "LoadingProcessing": "Loading...",