[#5452][desktop] Add help center in profile menu

Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
This commit is contained in:
yenda 2018-12-14 16:57:00 +01:00 committed by Vitaliy Vlasov
parent 9bc98405a0
commit 7934bfb2d7
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964
4 changed files with 44 additions and 17 deletions

View File

@ -196,10 +196,31 @@
:accessibility-label :share-my-contact-code-button} :accessibility-label :share-my-contact-code-button}
[vector-icons/icon :icons/qr {:style {:tint-color colors/blue}}]]]]) [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/defview profile [{:keys [seed-backed-up? mnemonic] :as user}]
(views/letsubs [current-view-id [:get :view-id] (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 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) (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) backup-recovery-phrase-open? (= current-view-id :backup-recovery-phrase)
notifications? (get-in user [:desktop-notifications?]) notifications? (get-in user [:desktop-notifications?])
show-backup-seed? (and (not seed-backed-up?) (not (string/blank? mnemonic)))] show-backup-seed? (and (not seed-backed-up?) (not (string/blank? mnemonic)))]
@ -218,15 +239,8 @@
[react/switch {:on-tint-color colors/blue [react/switch {:on-tint-color colors/blue
:value notifications? :value notifications?
:on-value-change #(re-frame/dispatch [:accounts.ui/notifications-enabled (not notifications?)])}]] :on-value-change #(re-frame/dispatch [:accounts.ui/notifications-enabled (not notifications?)])}]]
[react/touchable-highlight {:style (styles/profile-row adv-settings-open?) [advanced-settings-item adv-settings-open?]
:on-press #(do [help-item help-open?]
(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}}]]]
(when show-backup-seed? (when show-backup-seed?
[react/touchable-highlight {:style (styles/profile-row backup-recovery-phrase-open?) [react/touchable-highlight {:style (styles/profile-row backup-recovery-phrase-open?)
:on-press #(re-frame/dispatch [:navigate-to :backup-recovery-phrase])} :on-press #(re-frame/dispatch [:navigate-to :backup-recovery-phrase])}

View File

@ -5,6 +5,7 @@
[status-im.ui.screens.desktop.main.styles :as styles] [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.chat.views :as chat.views]
[status-im.ui.screens.desktop.main.add-new.views :as add-new.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.desktop.tabs :as tabs]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[re-frame.core :as re-frame])) [re-frame.core :as re-frame]))
@ -40,8 +41,9 @@
:desktop/new-one-to-one add-new.views/new-one-to-one :desktop/new-one-to-one add-new.views/new-one-to-one
:desktop/new-public-chat add-new.views/new-public-chat :desktop/new-public-chat add-new.views/new-public-chat
:desktop/new-group-chat add-new.views/new-group-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 :advanced-settings profile.views/advanced-settings
:help-center help-center.views/help-center
:chat-profile chat.views/chat-profile :chat-profile chat.views/chat-profile
:backup-recovery-phrase profile.views/backup-recovery-phrase :backup-recovery-phrase profile.views/backup-recovery-phrase
status-view)] status-view)]

View File

@ -30,6 +30,7 @@
:desktop/new-group-chat :desktop/new-group-chat
:desktop/new-public-chat :desktop/new-public-chat
:advanced-settings :advanced-settings
:help-center
:chat :chat
:home :home
:qr-code :qr-code

View File

@ -6,6 +6,7 @@
[status-im.ui.components.status-bar.view :as status-bar] [status-im.ui.components.status-bar.view :as status-bar]
[status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.screens.help-center.styles :as styles] [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])) [status-im.ui.screens.profile.components.views :as profile.components]))
(views/defview help-center [] (views/defview help-center []
@ -16,10 +17,19 @@
[react/scroll-view [react/scroll-view
[react/view [react/view
[profile.components/settings-item-separator] [profile.components/settings-item-separator]
[profile.components/settings-item {:label-kw :t/faq [profile.components/settings-item
:accessibility-label :faq-button {:label-kw :t/faq
:action-fn #(.openURL react/linking "https://status.im/docs/FAQs.html")}] :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-separator]
[profile.components/settings-item {:label-kw :t/ask-in-status [profile.components/settings-item
:accessibility-label :submit-bug-button {:label-kw :t/ask-in-status
:action-fn #(re-frame/dispatch [:chat.ui/start-public-chat "status" {:navigation-reset? false}])}]]]]) :accessibility-label :submit-bug-button
:action-fn #(re-frame/dispatch [:chat.ui/start-public-chat
(if platform/desktop?
"status-desktop"
"status")
{:navigation-reset? false}])}]]]])