[#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}
[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])}

View File

@ -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)]

View File

@ -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]])))
[main.views/popup-view]])))

View File

@ -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}])}]]]])