From 7934bfb2d7f818786f8fd7b5e595fd8b8245c567 Mon Sep 17 00:00:00 2001 From: yenda Date: Fri, 14 Dec 2018 16:57:00 +0100 Subject: [PATCH] [#5452][desktop] Add help center in profile menu Signed-off-by: Vitaliy Vlasov --- .../desktop/main/tabs/profile/views.cljs | 32 +++++++++++++------ .../ui/screens/desktop/main/views.cljs | 4 ++- src/status_im/ui/screens/desktop/views.cljs | 3 +- .../ui/screens/help_center/views.cljs | 22 +++++++++---- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs b/src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs index e5076cc51e..b6638ed99d 100644 --- a/src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs +++ b/src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs @@ -196,10 +196,31 @@ :accessibility-label :share-my-contact-code-button} [vector-icons/icon :icons/qr {:style {:tint-color colors/blue}}]]]]) +(defn help-item [help-open?] + [react/touchable-highlight {:style (styles/profile-row help-open?) + :on-press #(re-frame/dispatch [:navigate-to (if help-open? :home :help-center)])} + [react/view {:style styles/adv-settings} + [react/text {:style (styles/profile-row-text colors/black) + :font (if help-open? :medium :default)} + (i18n/label :t/help-center)] + [vector-icons/icon :icons/forward {:style {:tint-color colors/gray}}]]]) + +(defn advanced-settings-item [adv-settings-open?] + [react/touchable-highlight {:style (styles/profile-row adv-settings-open?) + :on-press #(do + (re-frame/dispatch [:navigate-to (if adv-settings-open? :home :advanced-settings)]) + (re-frame/dispatch [:load-debug-metrics]))} + [react/view {:style styles/adv-settings} + [react/text {:style (styles/profile-row-text colors/black) + :font (if adv-settings-open? :medium :default)} + (i18n/label :t/advanced-settings)] + [vector-icons/icon :icons/forward {:style {:tint-color colors/gray}}]]]) + (views/defview profile [{:keys [seed-backed-up? mnemonic] :as user}] (views/letsubs [current-view-id [:get :view-id] editing? [:get :my-profile/editing?]] ;; TODO janherich: refactor my-profile, unnecessary complicated structure in db (could be just `:staged-name`/`:editing?` fields in account map) and horrible way to access it woth `:get`/`:set` subs/events (let [adv-settings-open? (= current-view-id :advanced-settings) + help-open? (= current-view-id :help-center) backup-recovery-phrase-open? (= current-view-id :backup-recovery-phrase) notifications? (get-in user [:desktop-notifications?]) show-backup-seed? (and (not seed-backed-up?) (not (string/blank? mnemonic)))] @@ -218,15 +239,8 @@ [react/switch {:on-tint-color colors/blue :value notifications? :on-value-change #(re-frame/dispatch [:accounts.ui/notifications-enabled (not notifications?)])}]] - [react/touchable-highlight {:style (styles/profile-row adv-settings-open?) - :on-press #(do - (re-frame/dispatch [:navigate-to (if adv-settings-open? :home :advanced-settings)]) - (re-frame/dispatch [:load-debug-metrics]))} - [react/view {:style styles/adv-settings} - [react/text {:style (styles/profile-row-text colors/black) - :font (if adv-settings-open? :medium :default)} - (i18n/label :t/advanced-settings)] - [vector-icons/icon :icons/forward {:style {:tint-color colors/gray}}]]] + [advanced-settings-item adv-settings-open?] + [help-item help-open?] (when show-backup-seed? [react/touchable-highlight {:style (styles/profile-row backup-recovery-phrase-open?) :on-press #(re-frame/dispatch [:navigate-to :backup-recovery-phrase])} diff --git a/src/status_im/ui/screens/desktop/main/views.cljs b/src/status_im/ui/screens/desktop/main/views.cljs index 98613d4b29..28bda01f43 100644 --- a/src/status_im/ui/screens/desktop/main/views.cljs +++ b/src/status_im/ui/screens/desktop/main/views.cljs @@ -5,6 +5,7 @@ [status-im.ui.screens.desktop.main.styles :as styles] [status-im.ui.screens.desktop.main.chat.views :as chat.views] [status-im.ui.screens.desktop.main.add-new.views :as add-new.views] + [status-im.ui.screens.help-center.views :as help-center.views] [status-im.ui.components.desktop.tabs :as tabs] [status-im.ui.components.react :as react] [re-frame.core :as re-frame])) @@ -40,8 +41,9 @@ :desktop/new-one-to-one add-new.views/new-one-to-one :desktop/new-public-chat add-new.views/new-public-chat :desktop/new-group-chat add-new.views/new-group-chat - :qr-code profile.views/qr-code + :qr-code profile.views/qr-code :advanced-settings profile.views/advanced-settings + :help-center help-center.views/help-center :chat-profile chat.views/chat-profile :backup-recovery-phrase profile.views/backup-recovery-phrase status-view)] diff --git a/src/status_im/ui/screens/desktop/views.cljs b/src/status_im/ui/screens/desktop/views.cljs index bced610dcb..7ef7d83592 100644 --- a/src/status_im/ui/screens/desktop/views.cljs +++ b/src/status_im/ui/screens/desktop/views.cljs @@ -30,6 +30,7 @@ :desktop/new-group-chat :desktop/new-public-chat :advanced-settings + :help-center :chat :home :qr-code @@ -39,4 +40,4 @@ react/view)] [react/view {:style {:flex 1}} [component] - [main.views/popup-view]]))) \ No newline at end of file + [main.views/popup-view]]))) diff --git a/src/status_im/ui/screens/help_center/views.cljs b/src/status_im/ui/screens/help_center/views.cljs index 122a5ec632..c185e3e89c 100644 --- a/src/status_im/ui/screens/help_center/views.cljs +++ b/src/status_im/ui/screens/help_center/views.cljs @@ -6,6 +6,7 @@ [status-im.ui.components.status-bar.view :as status-bar] [status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.screens.help-center.styles :as styles] + [status-im.utils.platform :as platform] [status-im.ui.screens.profile.components.views :as profile.components])) (views/defview help-center [] @@ -16,10 +17,19 @@ [react/scroll-view [react/view [profile.components/settings-item-separator] - [profile.components/settings-item {:label-kw :t/faq - :accessibility-label :faq-button - :action-fn #(.openURL react/linking "https://status.im/docs/FAQs.html")}] + [profile.components/settings-item + {:label-kw :t/faq + :accessibility-label :faq-button + :action-fn #(.openURL react/linking + (if platform/desktop? + "https://status.im/docs/FAQ-desktop.html" + "https://status.im/docs/FAQs.html"))}] [profile.components/settings-item-separator] - [profile.components/settings-item {:label-kw :t/ask-in-status - :accessibility-label :submit-bug-button - :action-fn #(re-frame/dispatch [:chat.ui/start-public-chat "status" {:navigation-reset? false}])}]]]]) + [profile.components/settings-item + {:label-kw :t/ask-in-status + :accessibility-label :submit-bug-button + :action-fn #(re-frame/dispatch [:chat.ui/start-public-chat + (if platform/desktop? + "status-desktop" + "status") + {:navigation-reset? false}])}]]]])